call_id
# support
p
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??
v
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:
Copy code
js
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](https://docs.vapi.ai/tools/custom-tools)
@User ???
k
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..
p
But How do i do it in the prompt ?? ??
k
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..
p
@Kings_big💫 I tried that still doesnt work
Copy code
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"
}
Copy code
{
  "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
@Vapi Support Bot ??
k
{{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..
p
@User @User how do i reference it in the vapi prompt in vapi dashboard??
c
Just use the dynamic variable {{call.id}} inside the assistant prompt.
3 Views