Inbound Support Example ⚙️
Let’s build a technical support assistant that remembers where we left off.
We want a phone number we can call to get technical support. We want the assistant to use a provided set of troubleshooting guides to help walk the caller through solving their issue.
As a bonus, we also want the assistant to remember by the phone number of the caller where we left off if we get disconnected.
Create an assistant
We’ll start by taking a look at the Assistant API reference and define our assistant:
Let's break this down
transcriber
- We’re defining this to make sure the transcriber picks up the custom words related to our devices.model
- We’re using the OpenAI GPT-3.5-turbo model. It’s much faster and preferred if we don’t need GPT-4.messages
- We’re defining the assistant’s instructions for how to run the call.forwardingPhoneNumber
- Since we’ve added this, the assistant will be provided the transferCall function to use if the caller asks to be transferred to a person.firstMessage
- This is the first message the assistant will say when the user picks up.recordingEnabled
- We’re recording the call so we can hear the conversation later.
Since we want the assistant to remember where we left off, its configuration is going to change based on the caller. So, we’re not going to use temporary assistants.
For this example, we’re going to store the conversation on our server between calls and use the Server URL’s assistant-request
to fetch a new configuration based on the caller every time someone calls.
Buy a phone number
We’ll buy a phone number for inbound calls using the Phone Numbers API.
Configure your Server URL
When someone calls our number, we want to fetch the assistant configuration from our server. We’ll use the Server URL’s assistant-request
to do this.
First, we’ll create an endpoint on our server for Vapi to hit. It’ll receive messages as shown in the Assistant Request docs. Once created, we’ll add that endpoint URL to the Server URL field in the Account page on the Vapi Dashboard.
Save the conversation at the end of the call
We’ll want to save the conversation at the end of the call for the next time they call. We’ll use the Server URL’s end-of-call-report
message to do this.
At the end of each call, we’ll get a message like this:
We’ll save the call.customer.number
and summary
fields to our database for the next time they call.
Handle assistant requests.
When our number receives a call, Vapi will also hit our server’s endpoint with a message like this:
We’ll check our database to see if we have a conversation for this caller. If we do, we’ll create an assistant configuration like in Step 1 and respond with it:
If we don’t, we’ll just respond with the assistant configuration from Step 1.
Try calling it!
We’ll call our number and see if it works. Give it a call, and tell it you’re having an issue with your iPhone restarting randomly.
Hang up, and call back. Then ask what the issue was. The assistant should remember where we left off.
Was this page helpful?