Trigger a Call in Twilio


In addition to receiving calls from Twilio within Cognigy.AI, you can also trigger Twilio to make a call.

Cognigy will use a HTTP Node to trigger Twilio to make a call and then connect the call back to a Cognigy.AI Flow.

For this, you need to perform the following steps:

1. Set up a Flow that the call will connect to

First you need to set up a Flow and Twilio Voice Endpoint in Cognigy and connect them to a Twilio number as per Deploy a Twilio Voice Endpoint.

2. Set up a TwiML Bin

Twilio can host TwiML for you. For that, create a TwilML bin under Runtime. This TwiML is called from Cognigy.AI and tells Twilio what to do after the call connects.


You can see the TwiML to use below. Replace YOUR ENDPOINT URL with a valid Cognigy Endpoint URL.

<?xml version="1.0" encoding="UTF-8"?>
  <Redirect>YOUR ENDPOINT URL</Redirect>

Copy the TwiML Bin URL. You'll need it later.

3. Trigger the call from Cognigy

Build a Flow that contains a HTTP Request Node with the following parameters:

HeadersContent-Type: application/x-www-form-urlencoded
Payload is JSONfalse
Authorization TypeBasic Auth

You can find the Twilio Account SID and Auth Token on your Twilio Dashboard.

This HTTP Request will trigger the call, connect it to your Endpoint specified in the TwiML Bin and return a call SID, which you could use to tie sessions together using Contact Profiles.