! ArduinoGuru
05/02/2024, 7:33 PMVapi Support
05/02/2024, 7:33 PMVapi Support
05/02/2024, 7:34 PMpython
import requests
# Your Vapi API Authorization token
auth_token = 'YOUR_AUTH_TOKEN'
# The Phone Number ID, and the Customer details for the call
phone_number_id = 'PHONE_NUMBER_ID_FROM_DASHBOARD'
customer_number = "+14151231234" # Customer's phone number
# Create the header with Authorization token
headers = {
'Authorization': f'Bearer {auth_token}',
'Content-Type': 'application/json',
}
# Create the data payload for the API request, including the customer's phone number
data = {
'assistant': {
"firstMessage": "Hey, what's up?",
"model": {
"provider": "openai",
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are an assistant."
}
]
},
"voice": "jennifer-playht"
},
'phoneNumberId': phone_number_id,
'customer': {
'number': customer_number, # Here is where you include the customer's number
},
}
# Make the POST request to Vapi to create the phone call
response = requests.post(
'https://api.vapi.ai/call/phone', headers=headers, json=data)
# Check if the request was successful and print the response
if response.status_code == 201:
print('Call created successfully')
print(response.json())
else:
print('Failed to create call')
print(response.text)
Vapi Support
05/02/2024, 7:34 PMcustomer
object within the data
payload. This way, you can automatically include the customer's phone number in your Make automation process for booking an appointment, without needing to ask the customer directly.
Remember to replace 'YOUR_AUTH_TOKEN'
, 'PHONE_NUMBER_ID_FROM_DASHBOARD'
, and "+14151231234"
with your actual Vapi authorization token, the phone number ID from your Vapi dashboard, and the customer's phone number, respectively.
This approach allows you to programmatically manage call setups with all necessary details, which can then be integrated into your Make automation workflows.! ArduinoGuru
05/02/2024, 7:35 PMMrpoopybutthole
05/11/2024, 6:04 AM