getting caller number
# support
b
I'm trying to set up a make workflow with a webhook to a function after a call is made to collect the phone number of the user calling. I see that the user calling's number as stored in the dataset passed to Make is under message, customer and then phone number but how do I extract that value with Json or is there another way to do it?
v
Hi @beta1_94648, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Create Phone Call]() * [Buy Phone Number]() * [Update Phone Number]() * [Get Phone Number]() -----------------------------
### Answer To extract the caller's phone number from the JSON data received in a webhook, you can use JSON parsing to navigate through the structure and access the desired value. Assuming the JSON structure looks like what you described (
message
,
customer
, and then
phone number
), you would typically parse the JSON in your programming language of choice and access the phone number. For example, in JavaScript, you might do something like this:
Copy code
javascript
// Assuming 'data' is the JSON object you've received
const phoneNumber = data.message.customer.phoneNumber;
This is a simplified example. The exact method to parse and access the JSON data would depend on the programming language and libraries you're using in your webhook function. If you're using a specific programming language or framework and need more detailed guidance, I recommend referring to the documentation for JSON parsing in that context. Remember, this is a generic approach based on common JSON handling practices since the specific JSON path (
message.customer.phoneNumber
) is based on the structure you mentioned and might not exactly match the payload structure from Vapi if not detailed directly in the [(1)]() , [(2)]() , [(3)]() documents.
s
Can you elaborate a little more?
2 Views