ratty-blush
ratty-blush17mo ago

get metadata and include it in a call

When user submits a contact form from our website, a GHL automation will send the content of the message and send this a Make Scenario where the data from the message is parsed and included into the request body of the actual phone call post. Here's the sample request body:
{
"maxDurationSeconds": 1800,
"assistantId": "------------------",
"phoneNumberId": "------------------",
"customer": {
"number": "{{3.phone}}",
"name": "{{3.full_name}}"
},
"metadata": {
"message": "{{3.`How can we help you?`}}"
}
}
{
"maxDurationSeconds": 1800,
"assistantId": "------------------",
"phoneNumberId": "------------------",
"customer": {
"number": "{{3.phone}}",
"name": "{{3.full_name}}"
},
"metadata": {
"message": "{{3.`How can we help you?`}}"
}
}
How can I instruct my assistant to get the following: 1. Get the customer.name and say, "...May I speak with [name]?" 2. "We would like to confirm that you wanted [metadata.message]?"
5 Replies
Ask Inkeep
Ask Inkeep17mo ago
Hi @binaryruel, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Create Phone Call * Create Assistant * Update Assistant * List Assistants ----------------------------- Answer To achieve the functionality you're asking for—having the assistant use the customer.name and metadata.message in its conversation—you'll need to incorporate these elements directly into the assistant's system prompt or first message, as these parameters are not automatically utilized in the conversation by Vapi. Based on the information in the documents, the customer.name attribute and metadata are for your own reference and are not inherently included in the conversation by the assistant. To ensure the assistant mentions the customer’s name and their message, you'll need to dynamically generate the firstMessage or system prompt to include these details before making the POST request to create a phone call. From the scenario you provided, here's a way to structure your POST request body with pseudo-code placeholders for dynamic content to be replaced with actual values from your system:
{
"maxDurationSeconds": 1800,
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-number-id",
"customer": {
"number": "{{customer_phone_number}}",
"name": "{{customer_full_name}}"
},
"metadata": {
"message": "{{customer_message}}"
},
"assistant": {
"firstMessage": "May I speak with {{customer_full_name}}? We would like to confirm that you wanted {{customer_message}}?"
}
}
{
"maxDurationSeconds": 1800,
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-number-id",
"customer": {
"number": "{{customer_phone_number}}",
"name": "{{customer_full_name}}"
},
"metadata": {
"message": "{{customer_message}}"
},
"assistant": {
"firstMessage": "May I speak with {{customer_full_name}}? We would like to confirm that you wanted {{customer_message}}?"
}
}
Ask Inkeep
Ask Inkeep17mo ago
In the firstMessage, replace {{customer_full_name}} and {{customer_message}} with the actual customer's name and their message. This dynamic content needs to be processed and inserted into the request by your backend or integration layer (e.g., GHL automation or Make Scenario) before sending it to Vapi. Note: This approach assumes that the assistant is capable of handling dynamic firstMessage content per call, which aligns with Vapi's flexible assistant configuration as indicated in the documentation (1) . However, the direct manipulation of firstMessage to include custom variables from metadata or any other dynamic source isn't explicitly covered in the provided documents. Therefore, ensure your implementation preprocesses these variables into the request payloads as needed. For more detailed guidance on creating assistants and calls, please refer to the official Vapi documentation on creating a phone calland creating an assistant (2) .
sensitive-blue
sensitive-blue17mo ago
Put the data directly into System Prompt.
ratty-blush
ratty-blushOP17mo ago
how?
sensitive-blue
sensitive-blue17mo ago
Jannis Moore | AI Automation
YouTube
Build an AI Real Estate Cold Caller in 10 minutes | Vapi Tutorial F...
In this video, I will create an AI cold calling agent in just a few minutes! This step-by-step tutorial provides the quickest and most cost-effective method to build your own AI caller, complete with personalized data for higher lead conversion rates. Resource Hub: https://hub.integraticus.com https://hub.integraticus.com/build-an-ai-cold-call...

Did you find this page helpful?