Rate this page:

Custom Channel V1 [Deprecated]

With Twilio Autopilot, you can build your own channel integrations to integrate your custom-built chat or existing messaging platforms that we don't support natively. In this guide, we will walk you through sending a message to the custom channel endpoint and the structure of the Autopilot response so you can build a bot on any channel.

When should I use a custom channel?

You should use a custom channel when you want to build a bot on a channel that Autopilot does not support natively. For example, if you want to build a bot on your custom-built webchat or a platform like Intercom, Front or Discord.

Sending a Message

When a user sends a message to the bot, you need to receive that message and send it to the custom channel endpoint.

Custom Endpoint

To send a message to Autopilot, you need to make an HTTP POST request to the custom endpoint you can find below:{AccountSid}/{AssistantSid}/custom/{YouCustomChannelName}

Replace the following in the url:

{AccountSid} = You Account Sid found in Console->Autopilot->Your Assistant ->Overview ->Properties

{AssistantSid} = You Autopilot Assistant Sid found in Console->Autopilot->Your Assistant ->Overview ->Properties

{YourCustomChannelName} = The name of your custom channel (For example: "webchat" or "discord")


The Custom Channel endpoint takes the following parameters:

Parameter Description
text The user's text input.
user_id A user identifier. It can be any string that identifies the user.


Your POST request must be authenticated using your AccountSid and token like any other Twilio API request.

The Response

When you send a message to the custom endpoint you will get a JSON back with the content to display back to the user.

  "shows": [],
  "says": [
      "speech": "Welcome to Deep Table, The world's smartest restaurant. I'm Deep Table's virtual Assistant. I can help you make reservations or tell you about today's special. What would you like to do?"
  "listen": {}

Your channel integration should take this content and render it back to the user.

Autopilot will still do all the dialogue and state management for Actions like Collect. It will just respond with one message at a time.

Autopilot URL Parameters

Parameter Description

A string representing the unique name of the destination Task. If no TargetTask is provided, the destination task is determined by the natural language understanding.

TargetTask is useful when you want to control what task a user is routed to.


Lets you send Inbound Context to Autopilot. Should be a JSON string containing key-value pairs to insert into the Autopilot memory before starting a dialogue with the bot.

Useful for passing data stored in third party systems like a CRM into Autopilot to deliver a more contextual experience.

For Example: Note the TargetTask parameter at the end of the URL<ACCOUNT_SID>/<ASSISTANT_SID>/custom/{YouCustomChannelName}?TargetTask=handle_appointment_confirmation

Any message sent to number or messaging service configured with this URL will land in the handle_appointment_confirmation task.

Example 2: Passing Inbound Context with Memory<ACCOUNT_SID>/<ASSISTANT_SID>/custom/{YourCustomChannelName}?Memory={"CarModel":"Diablo","CarMake":"Lamborghini","CarYear":"2019"}

Any message sent to a bot with this URL will insert CarModel, CarMake and CarYear into the Autopilot Memory.

Example Function

- Make sure you enable ACCOUNT_SID and AUTH_TOKEN in the Functions -> Configure.

Screen Shot 2019-07-30 at 1.06.19 PM.png

- Replace {AssistantSid} with your Assistant Sid.

var got = require('got');

exports.handler = function(context, event, callback) {
    // Takes the first message, creates the channel webhook
    // Pipe body to Autopilot
    let requestPayload = "user_id=nico&text=Monis"''+context.ACCOUNT_SID+'/{AssistantSid}/custom/UberEatsBot', 
        headers: { 
            'content-type': 'application/x-www-form-urlencoded',
            'accept': 'application/json',
            'authorization' :  'Basic ' + new Buffer(context.ACCOUNT_SID+ ':' + context.AUTH_TOKEN).toString('base64')
        body: requestPayload
    }).then(function(response) {
        let apResponse = JSON.parse(response.body);
    }).catch(function(error) {
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Loading Code Sample...

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!