Make Telephone Calls (Vapi)
For this use case, the agent needs to be given the ability to make calls to a user, which involves adding a new call Skill.
Goal: Integrate Vapi and allow an agent to call a user.
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.
Vapi Integration
For details on creating a Vapi connector, go here.
Calling Skill
Create a new Skill (Skill Idn = "MakeCallSkill") and copy the following into the Skill Script:
{{SendCommand(
commandIdn="make_call",
integrationIdn="vapi",
connectorIdn="vapi_[phone number]",
phoneNumber="+12345678912"
)}}
Replace the “connectorIdn” with the Idn of the Vapi connector you just created. Replace the phone number with the number you want your agent to call.
Sandbox Event
Create a new Sandbox event as follows:
- Click the plus icon next to the Event Subscription section on the left-side panel.
- Under the “Event Idn,” select “user_message” from the dropdown.
- Under “Integration,” select “sandbox” from the dropdown.
- Under “Connector,” select “connector” from the dropdown. This is the connector created under the Sandbox Integration.
- 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.
- In this case, you want to activate the newly created Skill, "MakeCallSkill". Select it from the “Skill name” dropdown.
- 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.
- Click Create to save the event.
Create an Event (Vapi Integration)
Create a new Twilio event as follows:
- Click the plus icon next to the Event Subscription section on the left-side panel.
- Under the “Event Idn,” select “user_message” from the dropdown.
- Under “Integration,” select “vapi” from the dropdown.
- Under “Connector,” select “vapi_[phone number]” from the dropdown.
- 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.
- In this case, you want to activate your "MakeCallSkill." Select it from the “Skill name” dropdown.
- 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.
- Click Create to save the event.
Test Functionality
When a user sends a message in the Sandbox chat, the Sandbox event will trigger and activate the "MakeCallSkill." The "MakeCallSkill" will trigger the Vapi event and activate the main Skill, which allows the agent to use that Skill for the telephonic conversation with a user.
- Click Save and Publish in the top-right corner of the Flow Builder.
- 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.
Updated 6 months ago