Make Telephone Calls (Twilio)

Calling your agent works well for user inquiries, but what about an agent needing to confirm information from a user and doing this telephonically? For this case, the agent needs to be given the ability to make calls to a user, which involves adding a new call skill.

Goal: Integrate Twilio and allow an agent to call a user.

📘

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!

Let's use the same agent and flow from the previous example. A new skill and event need to be created. Delete all existing events from the previous example, as we will be using different event connectors.

Calling Skill

Create a new skill (Skill Idn = "MakeCallSkill") and copy the following into the Skill Script:

{{SendCommand(
    commandIdn="make_call", 
    integrationIdn="twilio", 
    connectorIdn="tw_[phone number]",
    phone_number="+12345678912"
)}}

Ensure the "connectorIdn" name exists under the Sandbox Integration on the Integrations page. The "phone_number" should be the phone number you want the agent to call.

Sandbox Event

Create a new Sandbox event as follows:

  1. Click the plus icon next to the Event Subscription section on the left-side panel.
  2. Under the “Event Idn,” select “user_message” from the dropdown.
  3. Under “Integration,” select “sandbox” from the dropdown.
  4. Under “Connector,” select “connector” from the dropdown. This is the connector created under the Sandbox Integration.
  5. 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.
  6. In this case, you want to activate the newly created skill, "MakeCallSkill". Select it from the “Skill name” dropdown.
  7. 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.
  8. Click Create to save the event.

Twilio Event

Create a new Twilio event as follows:

  1. Click the plus icon next to the Event Subscription section on the left-side panel.
  2. Under the “Event Idn,” select “user_message” from the dropdown.
  3. Under “Integration,” select “twilio” from the dropdown.
  4. Under “Connector,” select “tw_[phone number]” from the dropdown.
  5. 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.
  6. In this case, you want to activate your main agent skill. Select it from the “Skill name” dropdown.
  7. 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.
  8. Click Create to save the event.

Test Functionality and View Results

When a user sends a message in the Sandbox chat, the Sandbox event will trigger and activate the "MakeCallSkill." The "MakeCallSkill" will trigger the Twilio event and activate the main skill, which allows the agent to use that skill for the telephonic conversation with a user.

  1. Click Save and Publish in the top-right corner of the Flow Builder.
  2. Type any message in the Sandbox chat and your agent will call your number and have a conversation with you. Have fun asking your agent questions and hearing the responses.