| title | Inbound Support Example ⚙️ |
|---|---|
| sidebarTitle | Inbound Support |
| description | 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.
We'll start by taking a look at the [Assistant API reference](/api-reference/assistants/create-assistant) and define our assistant:```json
{
"transcriber":{
"provider": "deepgram",
"keywords": ["iPhone:1", "MacBook:1.5", "iPad:1", "iMac:0.8", "Watch:1", "TV:1", "Apple:2"],
},
"model": {
"provider": "openai",
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "You're a technical support assistant. You're helping a customer troubleshoot their Apple device. You can ask the customer questions, and you can use the following troubleshooting guides to help the customer solve their issue: ..."
}
]
},
"forwardingPhoneNumber": "+16054440129",
"firstMessage": "Hey, I'm an A.I. assistant for Apple. I can help you troubleshoot your Apple device. What's the issue?",
"recordingEnabled": true,
}
```
<Card title="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](/assistants#transfer-call) 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](/assistants/persistent-assistants).
For this example, we're going to store the conversation on our server between calls and use the [Server URL's `assistant-request`](/server-url#retrieving-assistants) to fetch a new configuration based on the caller every time someone calls.
```json
{
"id": "c86b5177-5cd8-447f-9013-99e307a8a7bb",
"orgId": "aa4c36ba-db21-4ce0-9c6e-99e307a8a7bb",
"number": "+11234567890",
"createdAt": "2023-09-29T21:44:37.946Z",
"updatedAt": "2023-12-08T00:57:24.706Z",
}
```
First, we'll create an endpoint on our server for Vapi to hit. It'll receive messages as shown in the [Assistant Request](/server-url#retrieving-assistants-calling) docs. Once created, we'll add that endpoint URL to the **Server URL** field in the Account page on the [Vapi Dashboard](https://dashboard.vapi.ai).
At the end of each call, we'll get a message like this:
```json
{
"message": {
"type": "end-of-call-report",
"endedReason": "hangup",
"call": { Call Object },
"recordingUrl": "https://vapi-public.s3.amazonaws.com/recordings/1234.wav",
"summary": "The user mentioned they were having an issue with their iPhone restarting randomly. They restarted their phone, but the issue persisted. They mentioned they were using an iPhone 12 Pro Max. They mentioned they were using iOS 15.",
"transcript": "Hey, I'm an A.I. assistant for Apple...",
"messages":[
{
"role": "assistant",
"message": "Hey, I'm an A.I. assistant for Apple. I can help you troubleshoot your Apple device. What's the issue?",
},
{
"role": "user",
"message": "Yeah I'm having an issue with my iPhone restarting randomly.",
},
...
]
}
}
```
We'll save the `call.customer.number` and `summary` fields to our database for the next time they call.
</Step>
<Step title="Handle assistant requests.">
When our number receives a call, Vapi will also hit our server's endpoint with a message like this:
```json
{
"message": {
"type": "assistant-request",
"call": { Call Object },
}
}
```
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:
```json
{
"assistant": {
...
"model": {
"provider": "openai",
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "You're a technical support assistant. Here's where we left off: ..."
}
]
},
...
}
}
```
If we don't, we'll just respond with the assistant configuration from Step 1.
</Step>
Hang up, and call back. Then ask what the issue was. The assistant should remember where we left off.