This page describes how to use a HTTP Node to trigger Twilio to make a call and then connect the call back to a Cognigy.AI Flow.

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.

c4e59db-Capture.jpg

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"?>
<Response>
  <Redirect>YOUR ENDPOINT URL</Redirect>
</Response>

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:

Parameter

Value

Type

POST

URL

https://api.twilio.com/2010-04-01/Accounts/YOUR_TWILIO_ACCOUNT_SID/Calls.json

Headers

Content-Type: application/x-www-form-urlencoded

Payload is JSON

false

Payload

To=NUMBER_TO_CALL&Url=YOUR_TWIML_BIN_URL&From=YOUR_TWILIO_NUMBER

Authorization Type

Basic Auth

Username

YOUR_TWILIO_ACCOUNT_SID

Password

YOUR_TWILIO_AUTH_TOKEN

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.


Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful