rival-black
rival-black4mo ago

How Can I Reference a Parameter Passed By a Tool in Vapi in GHL?

My goal is that whenever the lead says they want to enable DND/be removed from our contacts list during the call, the tool called "EnableDNDWorkflow" will be triggered and which triggers a workflow I made in GHL to enable DND for that contact. The tool has the following description: If the lead wants to opt-out or enable DND, fire this function to trigger a workflow in GoHighLevel named "Lead Opts Out During Vapi Call" And has a string parameter called "LeadsPhone" with the following description: The lead's phone number In GHL, I have a workflow that's responsible with enabling DND for the lead. It has "Inbound Webhook" as the trigger linked to the tool. So that when the tool fires, it will trigger the workflow in GHL. The connection is fine. The tool is able to trigger the workflow in GHL. The problem is, the workflow is unable to identify the lead who wants to enable DND. That's why I have the "LeadsPhone". So that the workflow can search for a phone number in the CRM that matches with "LeadsPhone". But I can't seem to access the "LeadsPhone" parameter within GHL even though it's being passed by the tool.
11 Replies
Vapi
Vapi4mo ago
Based on the information I found, try using the metadata parameter when configuring your Vapi tool to ensure the phone number is properly passed to GHL:
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
In GHL, you may need to check the webhook payload structure to determine how to reference this parameter in your workflow. Source: - Discord Channel Discussion
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
Vapi
Vapi4mo ago
Based on the information I found, try using the metadata parameter when configuring your Vapi tool to ensure the phone number is properly passed to GHL:
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
In GHL, you may need to check the webhook payload structure to determine how to reference this parameter in your workflow. Source: - Discord Channel Discussion
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
rival-black
rival-blackOP4mo ago
@Duckie I think that my Vapi tool is passing the number properly. Because upon examining the mapping reference ni GHL, I see that the "LeadsPhone" has a phone number inside it. Also, I tried checking the webhook payload structure like you asked. And I can see that the parameter is being passed. But for some reason, I can't access the parameter inside the "Create Contact" action inside the workflow.
No description
Duckie
Duckie4mo ago
Message marked as helpful by @sibyorself! 🎉
rival-black
rival-blackOP4mo ago
@Duckie I think that my Vapi tool is passing the number properly. Because upon examining the mapping reference ni GHL, I see that the "LeadsPhone" has a phone number inside it. Also, I tried checking the webhook payload structure like you asked. And I can see that the parameter is being passed. But for some reason, I can't access the parameter inside the "Create Contact" action inside the workflow.
No description
Vapi
Vapi4mo ago
I need to understand how you're trying to access the parameter in GHL. Could you share more details about how you're attempting to reference the "LeadsPhone" parameter within the "Create Contact" action in your GHL workflow? For example, are you using a specific syntax like {{webhook.LeadsPhone}}, {{data.LeadsPhone}}, or something else? This would help me identify where the issue might be in accessing the parameter. I need to understand how you're trying to access the parameter in GHL. Could you share more details about how you're attempting to reference the "LeadsPhone" parameter within the "Create Contact" action in your GHL workflow? For example, are you using a specific syntax like {{webhook.LeadsPhone}}, {{data.LeadsPhone}}, or something else? This would help me identify where the issue might be in accessing the parameter.
rival-black
rival-blackOP4mo ago
@Duckie Not exactly like a specific syntax. But more like selecting from a dropdown. GHL lists all the possible parameters I'm able to access from the webhook connection but the "LeadsPhone" isn't on that dropdown.
Vapi
Vapi4mo ago
Try deleting your current assistant and creating a new one with the metadata parameter to pass the phone number:
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
This approach allows you to pass customer information that can be retrieved later using the API, potentially bypassing the dropdown limitation in GHL. Source: - Discord Channel Discussion Try deleting your current assistant and creating a new one with the metadata parameter to pass the phone number:
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
vapiInstance = vapiSDK.run({
apiKey: apiKey,
assistant: agentId,
metadata: { LeadsPhone: phoneNumber },
config: buttonConfig,
});
This approach allows you to pass customer information that can be retrieved later using the API, potentially bypassing the dropdown limitation in GHL. Source: - Discord Channel Discussion Could you check exactly where in the webhook payload structure the "LeadsPhone" parameter appears? Based on your image description, it seems to be nested inside toolCalls[0].arguments. GHL might be looking for parameters at the root level of the payload rather than nested within the arguments object. Have you tried examining other successful webhook integrations with GHL to see how their parameters are structured in comparison to yours? Source: - Discord Channel Discussion Could you check exactly where in the webhook payload structure the "LeadsPhone" parameter appears? Based on your image description, it seems to be nested inside toolCalls[0].arguments. GHL might be looking for parameters at the root level of the payload rather than nested within the arguments object. Have you tried examining other successful webhook integrations with GHL to see how their parameters are structured in comparison to yours? Source: - Discord Channel Discussion
rival-black
rival-blackOP4mo ago
@Duckie Looking at other webhooks, almost all of the parameters are appearing. Even the nested ones.
Vapi
Vapi4mo ago
Try manually mapping the parameter by using a custom field in the GHL workflow. Add a JavaScript step before the "Create Contact" action to extract the value:
// Extract the phone number from the nested structure
const leadsPhone = payload.message.toolCalls[0].arguments.LeadsPhone;

// Store it in a custom variable that will appear in the dropdown
workflow.setVariable('extractedLeadsPhone', leadsPhone);
// Extract the phone number from the nested structure
const leadsPhone = payload.message.toolCalls[0].arguments.LeadsPhone;

// Store it in a custom variable that will appear in the dropdown
workflow.setVariable('extractedLeadsPhone', leadsPhone);
Then use extractedLeadsPhone in your Create Contact action. Source: - Understanding GoHighLevel webhook payload structure Try manually mapping the parameter by using a custom field in the GHL workflow. Add a JavaScript step before the "Create Contact" action to extract the value:
// Extract the phone number from the nested structure
const leadsPhone = payload.message.toolCalls[0].arguments.LeadsPhone;

// Store it in a custom variable that will appear in the dropdown
workflow.setVariable('extractedLeadsPhone', leadsPhone);
// Extract the phone number from the nested structure
const leadsPhone = payload.message.toolCalls[0].arguments.LeadsPhone;

// Store it in a custom variable that will appear in the dropdown
workflow.setVariable('extractedLeadsPhone', leadsPhone);
Then use extractedLeadsPhone in your Create Contact action. Source: - Understanding GoHighLevel webhook payload structure
Shubham Bajaj
Shubham Bajaj4mo ago
[ Hey! To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead
This would really help us figure out what went wrong!

Did you find this page helpful?