unwilling-turquoise
unwilling-turquoise6mo ago

call_id

Is there a way in which we can also sent the call_id of the call during the tool call, while the call is ongoing??
11 Replies
Vapi Support Bot
Yes, the call_id is included in the tool call payload sent to your server during an ongoing call.
You can access it like this in your handler:
const callId = req.body.message.call.id;
const callId = req.body.message.call.id;
Just extract it from the "call" object in the incoming request and use it as needed in your tool logic. Source: - Custom Tools Documentation
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
unwilling-turquoise
unwilling-turquoiseOP6mo ago
This is how the tool call is made but i dont see the call_id??
No description
unwilling-turquoise
unwilling-turquoiseOP6mo ago
@Vapi Team ???
ambitious-aqua
ambitious-aqua6mo ago
Yes, Vapi includes the call_id in live tool calls via the controlUrl and webhooks, so you can use it during an ongoing call without needing to send it manually..
unwilling-turquoise
unwilling-turquoiseOP6mo ago
But How do i do it in the prompt ?? ??
ambitious-aqua
ambitious-aqua6mo ago
You can reference {{call.id}} directly in your prompt, and Vapi will automatically inject the live call ID during the call, making it available for tools like transferCall without needing to pass it manually..
unwilling-turquoise
unwilling-turquoiseOP6mo ago
@Kings_big💫 I tried that still doesnt work
Create_user{
firstName: firstname,
lastName: lastname,
dob: dob,
pob: pob,
gender: User's Gender(m/f)
id: "{{call.id}}",
caller_id: "15e0a521",
endpoint: "create_client"
}
Create_user{
firstName: firstname,
lastName: lastname,
dob: dob,
pob: pob,
gender: User's Gender(m/f)
id: "{{call.id}}",
caller_id: "15e0a521",
endpoint: "create_client"
}
{
"role": "tool_calls",
"time": 1749645663784,
"message": "",
"toolCalls": [
{
"id": "call_QsjcE3dOl7wLhH5KYVYfxQH0",
"type": "function",
"function": {
"name": "Create_user",
"arguments": "{\n \"firstName\": \"John\",\n \"lastName\": \"Test\",\n \"dob\": \"1989-01-01\",\n \"pob\": \"L6H6M4\",\n \"gender\": \"m\",\n \"id\": \"\",\n \"caller_id\": \"15e0a521\",\n \"endpoint\": \"create_client\"\n}"
}
}
],
"secondsFromStart": 113.478
}
{
"role": "tool_calls",
"time": 1749645663784,
"message": "",
"toolCalls": [
{
"id": "call_QsjcE3dOl7wLhH5KYVYfxQH0",
"type": "function",
"function": {
"name": "Create_user",
"arguments": "{\n \"firstName\": \"John\",\n \"lastName\": \"Test\",\n \"dob\": \"1989-01-01\",\n \"pob\": \"L6H6M4\",\n \"gender\": \"m\",\n \"id\": \"\",\n \"caller_id\": \"15e0a521\",\n \"endpoint\": \"create_client\"\n}"
}
}
],
"secondsFromStart": 113.478
}
id remained null @Vapi @Duckie ??
ambitious-aqua
ambitious-aqua6mo ago
{{call.id}} only works inside assistant prompts during live calls, it won’t auto-fill in tool calls, so you need to either reference it in the prompt or pass it manually from a webhook..
unwilling-turquoise
unwilling-turquoiseOP6mo ago
@Kings_big💫 @Shubham Bajaj how do i reference it in the vapi prompt in vapi dashboard??
Kyle
Kyle6mo ago
Just use the dynamic variable {{call.id}} inside the assistant prompt.

Did you find this page helpful?