We’ve changed our name! API.AI is now Dialogflow. Learn more here.

Twilio Programmable Chat

Dialogflow Twilio Programmable Chat Integration allows you to easily create Twilio Programmable Chat bots with natural language understanding based on the Dialogflow technology.

Setting Up Programmable Chat

In order to set up the Twilio Programmable Chat integration for your agent, you'll need the
following:

Create a Chat Service in Twilio

Login to Twilio and click on the three horizontal dots, and then Programmable Chat
Click on the Get Started button, then the Create a Chat Service button
Enter a Friendly Name and then click on the Create button

Getting Your Service SID

  1. Make note of the Service SID on the Base Configuration page

Getting Your Account SID

  1. Click on the three horizontal dots, Programmable Chat, and then Show API Credentials in the upper right corner
  2. Make note of the Account SID in the revealed section

Getting Your API SID and Secret

  1. Click on Tools > API Keys then the Create new API Key button
  2. Enter a Friendly Name and then click the Create API Key button
  3. Make note of the SID and Secret, check the box and click the Done button. Note: The API Secret is only shown once, so make sure to keep this information somewhere in case you need to reference it again.

Setting Up Dialogflow

  1. In Dialogflow, go to Integrations in the left hand menu
  2. Click on the Twilio tile
  3. Enter the related info into the following fields:
    • Service Instance SID
    • Account SID
    • API Key SID
    • API Secret
  4. Click the Start button

Testing

To test your agent, you will need to download and setup a test application.

  1. Download the IP Messaging Demo Application and unzip it
  2. Open the unzipped folder and make a copy of "credentials.example.json"
  3. Rename the file to "credentials.json" and enter the following info:
    • accountSid - This is your Account SID
    • signingKeySid - This is your API Key SID
    • signingKeySecret - This is your API Secret
    • serviceSid - This is your Service Instance SID
  4. Save the file
  5. In a terminal, cd to the unzipped folder and run the following commands:
    • npm install
    • npm start
      Note: If you receive an error, try editing the package.json file. Change "node" on line seven to "nodejs".
  6. Go to http://localhost:8080 in your browser, enter a name, and click the Log in As Guest button
  7. Click Channel for Dialogflow bot on the left and then start talking to your agent