mateuscdantas
01/04/2025, 5:38 PMVapi
01/04/2025, 5:38 PMmetadata attribute, which allows you to attach key-value pairs that can be passed along with the call. Here's how you can do it:
1. Prepare your call setup request JSON object.
2. Include a metadata field in your request.
3. Add the context as key-value pairs within the metadata object.
For example:
json
{
"to": [
{
"type": "phone",
"number": "1234567890"
}
],
"from": {
"type": "phone",
"number": "0987654321"
},
"metadata": {
"previousConversationId": "abc123",
"customerSupportTicket": "ticket456"
}
}
In this example, previousConversationId and customerSupportTicket are custom keys that hold the context you want to pass along with the call. When the call is initiated, VAPI will carry this metadata, and it can be accessed by your application during the call for reference or to maintain continuity in the conversation.
If you need to initiate a call with this context, please provide the necessary details such as the destination number, caller number, and any additional context you wish to include, and I can assist you further.mateuscdantas
01/04/2025, 5:40 PMmateuscdantas
01/04/2025, 5:41 PMVapi
01/04/2025, 5:41 PMpreviousConversationId in the metadata is a custom field that you can use to reference past interactions. However, it's up to your application's logic to retrieve and utilize the associated data.
When you include previousConversationId in the metadata, you should have a mechanism on your server that can recognize this ID and fetch the relevant conversation data. This data can then be used to provide context during the call, such as by informing the agent or guiding the flow of the conversation.
If you need to retrieve data based on the previousConversationId, you would typically do so from your own databases or storage systems where previous conversations are recorded. If you have any specific functionalities or integrations in mind that you would like to implement using VAPI, please let me know, and I can provide more detailed guidance.mateuscdantas
01/04/2025, 5:42 PMVapi
01/04/2025, 5:42 PMpreviousConversationId from your database or storage system.
2. **Prepare Call Setup Request**: Create a call setup request object for VAPI. This object includes details about the call, such as the destination and caller numbers.
3. **Include Context in Metadata**: Add a metadata field to the call setup request and include the retrieved context as key-value pairs within this field. This allows you to pass custom data along with the call.
4. **Initiate the Call**: Send the call setup request to VAPI to initiate the call with the included context.
Here's an example of how you might structure the call setup request with context included in the metadata:
json
{
"to": [
{
"type": "phone",
"number": "1234567890"
}
],
"from": {
"type": "phone",
"number": "0987654321"
},
"metadata": {
"previousConversationId": "abc123",
"customerSupportTicket": "ticket456",
"savedContext": {
// Include the retrieved context here
"lastIssueResolved": "Billing Inquiry",
"customerSatisfaction": "Positive",
// ... other context data
}
}
}
In this example, savedContext is a nested object within metadata that contains the actual context data from the previous conversation. This data will be attached to the call and can be accessed by your application or agents during the call to provide a seamless experience.
If you're ready to initiate a call and need assistance with including the saved context, please provide the necessary details, and I can guide you through the process.mateuscdantas
01/04/2025, 5:46 PMVapi
01/04/2025, 5:46 PMmetadata property to add context to the call. Instead, the metadata property is a mechanism for you, as the developer, to pass along custom data with the call setup request. It is then your responsibility to handle this data on your server and use it appropriately during the call.
Here's how the process typically works:
1. **Attach Metadata**: You include the metadata property with relevant context data in the call setup request when initiating a call with VAPI.
2. **VAPI Passes Metadata**: When VAPI initiates the call, it simply passes along the metadata as part of the call data. VAPI does not interpret or act on this data itself.
3. **Your Server Receives Metadata**: Your server, which handles the call logic and interacts with VAPI, receives the metadata along with the call notification (usually via a webhook).
4. **Use Metadata in Call Logic**: Your server-side application is responsible for interpreting the metadata and using it to provide context during the call. This could involve:
- Displaying the context data to a human agent.
- Using the context to guide an IVR (Interactive Voice Response) system.
- Making decisions in a voice bot's conversation flow based on the context.
5. **End-of-Call Actions**: After the call, your server can also use the metadata to log the call with the associated context, update records, or trigger post-call workflows.
To summarize, VAPI treats the metadata as a "carrier" for whatever data you want to include with the call. It is up to your application to make use of this data to enhance the call experience. If you have any specific questions about implementing this on your server or how to structure your application logic to use the metadata, please let me know, and I can provide further assistance.mateuscdantas
01/04/2025, 6:52 PM