Receive Telephone Calls (Twilio)

The Sandbox chat is great for online websites needing an intelligent agent to handle customer inquiries, among many other use cases. However, you may find that for your use case, a better-suited option is having your intelligent agent handle telephone calls. In this case, you'd need to integrate Twilio.

Goal: Integrate Twilio and allow for calling an intelligent agent.

📘

Video tutorial coming soon!

🎉

Prefer a different perspective on the Newo.ai platform functionality? Check out our co-founder lessons YouTube channel. Like, comment, and share to get the word out!

If you don't want to create a new agent, use your existing agent from the Embedded Instructions tutorial and simply create a new Flow and add a new Sandbox connector (Idn = connector_call). Alternatively, let's start fresh and create a new agent. Follow the steps outlined in the "Hello World," which are:

  • Create an Agent
  • Create a Sandbox Connector
  • Create a Flow
  • Add a User
  • Create a Skill
  • Add Code to the Skill Script
  • Create an Event (Sandbox Integration)

Set Up a Twilio Account

Navigate to the Twilio website and click Sign up. Once you have an account, log in and navigate to My first Twilio account at the top-left corner. Under "Account Info" you will see your "Account SID" and "Auth Token."

🚧

Ensure your Twilio account is funded with at least the minimum amount.

Add Twilio Settings

In order for the Newo.ai platform to communicate with your Twilio account, Twilio settings need to be added.

  1. Navigate to the Integrations page from the left-side panel on the Newo.ai platform.
  2. Click the gear icon on the “Twilio Integration” item.
  3. Copy your "Account SID" and "Auth Token" from Twilio into the available fields.
  1. Click Save.

Create a Twilio Connector

A Twilio connector needs to be created, which will be used to create an Event Subscription.

  1. Click the plus icon on the “Twilio Integration” item.
  2. Select a "Phone Number."
  3. Fill in the connector "Title" and "Idn." It is advisable to use the format tw_[phone number] for the "Title" and "Idn" to easily see the number being used for a particular connector. For example, tw_6592272513.
  4. Select the "Agent" you want to answer the phone.
  5. Choose the "Language" of your agent. In this case, type "en-US" for now.
  6. Choose the "Voice" of your agent. In this case, type "Polly.Matthew-Neural" for now.
  7. You can add an optional "Greeting Phrase" if you'd like your agent to answer the phone in a specific way.
  8. Click Save.

Enable the Twilio Connector

Once a connector is created, its status will be "Stopped," and you will need to enable it.

  1. Click the three dots icon on the right of the created connector.
  2. Click Run.

Create an Event (Twilio Integration)

Besides the Sandbox integration event, a second event needs to be created using the Twilio integration, which will also trigger when a message is sent in the Sandbox chat.

  1. Navigate to your agent's Flow.
  2. Click the plus icon next to the Event Subscription section on the left-side panel.
  3. Under the “Event Idn,” select “user_message” from the dropdown.
  4. Under “Integration,” select “twilio” from the dropdown.
  5. Under “Connector,” select “tw_[phone number]” from the dropdown.
  6. Under “Skill selector,” select “skill_idn” from the dropdown. You are telling your flow that when a user sends a message from the Sandbox chat, select a specific skill to activate.
  7. In this case, you want to activate the newly created skill. Select it from the “Skill name” dropdown.
  8. Add an “Event description.” This field is optional but will help in the future when identifying the purpose of an event from a complex flow containing multiple event subscriptions.
  9. Click Create to save the event.

Test Functionality and View Results

  1. Click Save and Publish in the top-right corner of the Flow Builder.
  2. Call the number you selected when setting up the Twilio connector. You can also see this number by looking at the event you just created (i.e., tw_[phone number]). Your intelligent agent should answer the phone. Have fun asking your agent questions and hearing the responses.