Receive Telephone Calls (Vapi)
Although Twilio does a great job at providing voice call services, Vapi integration allows for a more realistic voice call. Vapi integration supports both incoming and outgoing phone calls. In other words, you can use this integration to call your agent, or an agent can use it to call you.
Goal: Integrate Vapi and allow for calling a digital employee agent.
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. 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 (Copy the Skill Script from the Embedded Instructions tutorial)
Vapi Integration
For details on creating a Vapi connector, go here.
Create an Event (Vapi Integration)
To enable your Agent to answer incoming phone calls you need to subscribe this Agent's flow to the “user_message” event triggered by the Vapi connector you just created.
- Navigate to your agent's Flow. The agent should be the same one you selected when setting up the Vapi connector.
- 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 calls the generated phone number, select a specific Skill to activate.
- In this case, you want to activate the Skill your agent will use when on the phone. 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
- Click Save and Publish in the top-right corner of the Flow Builder.
- Call the number you selected when setting up the Vapi connector. You can also see this number by looking at the event you just created (i.e., vapi_[phone number]). Your digital employee should answer the phone. Have fun asking your agent questions and hearing the responses.
Updated 6 months ago