How to get customer mobile number using api reques...
# support
v
Hello everyone, i need help in vapi.ai for voice call agent. How i get customer mobile number using Api request tool while begin of conversation in agent call. i already used {{customer.number}} and {{call.customer.number}} and {{phoneNumber.number}} this also. but i can't get customer number. this tool return string only. so i need help for how i get customer number.
v
To get the customer mobile number at the start of a Vapi.ai agent call, set up a server endpoint to receive POST requests from Vapi. In your endpoint, extract the number like this:
Copy code
js
const phoneNumber = req.body.call.from.phoneNumber;
Use this value to personalize your assistant or make further API calls. Template variables like
{{customer.number}}
will not work for this purpose—use the server approach instead
([see documentation](https://docs.vapi.ai/assistants/personalization)). Source: - [Personalization with user information](https://docs.vapi.ai/assistants/personalization)
This is the variable im using {{callerId}} in vapi tool assistant API request post method tool Attaching the prompt im using for this agent But im not able to get the caller number https://cdn.discordapp.com/attachments/1443861717183496202/1443895775800066089/message.txt?ex=692b64fb&is=692a137b&hm=ea0c6ad41d92f467f4db1d85781b8659b17575af47b287c71aec703971019bd0&
l
To get the customer’s mobile number using the API request tool, first make sure you are using the correct variable that your platform provides for the caller ID (for example {{call.customer.number}}). This variable is only available after the call starts, so trigger your API request after the call begins. Then send this number inside your POST body like {"phone":"{{call.customer.number}}"}. If the tool returns the number as plain text, just read that text and extract the digits. If the variable still shows empty, check the logs to confirm whether the number is actually being received, or use a later event in the call flow where the number becomes available.
v
now i used that variable {"phone":"{{call.customer.number}}"}. but first time i check, it return the 11-digit number maybe it caller id. then i check 2nd and 3rd time it only return the string text only. What can i do? Can it explain me how i use API request tool for post method. how i use this for request body for pass the customer mobile number to my backend web-hook.
c
Hi, could you please provide a call id where you experienced this issue? We would like to review the logs to identify the cause.