JM
05/16/2024, 10:59 AMVapi Support
05/16/2024, 10:59 AMVapi Support
05/16/2024, 11:00 AMid
of the call in the response. Use this ID to fetch call details if necessary.
2. **Retrieve Call Details to Get Caller Number**:
You can use the Get Call
API to retrieve details of the call, including the caller's phone number. Here is an example of how to get the call details:
python
import requests
call_id = "<call_id>"
url = f"https://api.vapi.ai/call/{call_id}"
headers = {
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
call_details = response.json()
caller_number = call_details['customer']['number']
3. **Check Caller Number Against Google Sheets**:
Use Google Sheets API to check if the caller's number exists in your members' list.
4. **End the Call if Caller is Not a Member**:
If the number is not found, you can end the call programmatically.
Example of ending the call (assuming a function to end the call):
python
import requests
end_call_url = f"https://api.vapi.ai/call/{call_id}/end"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(end_call_url, headers=headers)
if response.status_code == 200:
print("Call ended successfully")
JM
05/16/2024, 11:03 AMVapi Support
05/16/2024, 11:03 AMSahil
05/16/2024, 11:52 AMweissm
05/16/2024, 1:33 PMAlexi
05/16/2024, 1:58 PMJM
05/16/2024, 2:07 PMAlexi
05/16/2024, 2:11 PMAlexi
05/16/2024, 2:12 PMAlexi
05/16/2024, 2:13 PMAlexi
05/16/2024, 2:13 PMAlexi
05/16/2024, 2:14 PMJM
05/16/2024, 2:21 PMAlexi
05/16/2024, 2:22 PMSahil
05/16/2024, 3:05 PMJM
05/16/2024, 3:06 PM