Get Vapi Phone In Twilio Webhook
# support
a
Hello everyone. This is the situation. I called Vapi phone number using web. While calling, Vapi forwarded the call to Twilio phone number. I implemented webhook for Twilio phone number and I tried to get the phone number of Vapi but I could not find the number. The body of the request of Twilio webhook has fields like 'from' but this field has value of my web phone number. How can I get the Vapi phone number in twilio webhook?
v
message has been deleted
@adam Hello! To obtain the Vapi phone number that was used to forward the call to your Twilio number, you should look for a field in the webhook payload that Twilio sends to your server which indicates the incoming caller ID. Typically, this is the
To
field in the webhook data. When a call is forwarded, the
From
field usually contains the caller's number (in your case, the web phone number), and the
To
field should contain the number that the call was forwarded to (which should be your Twilio phone number). If you're expecting to see the Vapi number and it's not present in the
To
field, there might be an issue with how the forwarding is set up. Please ensure that the forwarding is configured correctly to pass along the Vapi number to the Twilio webhook. If you're still unable to find the Vapi phone number in the webhook data, it's possible that additional configuration or troubleshooting may be required. In that case, please ask support for more info on this, as they may need to look into the specific details of your setup.
You can continue this conversation by mentioning me in the message.
a
how to configure correctly to pass along the Vapi number to the Twilio webhook?
v
Got it. Tagging @User for additional help.
a
SupportTeam
please help me @User
@User
s
@adam could you send over a recent call ID so I can take a look?
a
@Shubham Bajaj could you help me?
s
@adam going through your call id.
a
thank you
i called my vapi phone. and the vapi forwards the call to twilio phone. in twilio webhook i cannot get vapi phone number. this is my problem
s
@adam available for a quick call?
a
sure
s
@adam There are two solutions to this issue. The first is using the
forwardedFrom
property, and the second is setting the
caller ID
for the destination number of the Vapi phone number. Twilio includes a ForwardedFrom parameter in webhook requests when it detects call forwarding. You can examine this parameter in your webhook handler to see if it contains the vapi's number. If you don't receive(let me know, I will investigate if we can send it when it's not present.) the ForwardedFrom parameter in the request body, you can use the caller ID solution instead
a
there was some problem with my mic. btw thank you.
i will try and contact soon.
s
**Step 1: **Create a custom transfer call, add the destination, and set the callerId to the Vapi Phone Number
Copy code
sh
curl -X POST https://api.vapi.ai/tool \
     -H "Authorization: Bearer " \
     -H "Content-Type: application/json" \
     -d '{
  "type": "transferCall",
  "async": false,
  "function": {
    "name": "customTransferCall"
  },
  "destinations": [
    {
      "type": "number",
      "number": "number-to-forward-call",
      "callerId": "vapi-phone-number",
      "numberE164CheckEnabled": false
    }
  ]
}'
Ref: https://docs.vapi.ai/api-reference/tools/create?playground=%2Fapi-reference%2Ftools%2Fcreate **Step2**: Attach the tool within your assistant **Step3**: Trigger the customTransferCall tool with your Here number is to number-to-forward-call.
@adam do let me know how it goes.
a
@User it works very well
thank you very much
s
@charlie19 tagging you here for your reference.