Custom Tool - how do I pass header info?
# support
n
I have a python code that basically cleans input and does a fuzzy match in a database. I tried it on post man it seems to work fine, but requires following input. Header: Content-Type : application/json Body: { "phone_number": {{phone_number_vapi.}} } I attached the screenshot, but i am not sure where you put headers, query, etc information for API post. https://cdn.discordapp.com/attachments/1290703380339232852/1290703380762726440/image.png?ex=66fd6cb2&is=66fc1b32&hm=ccc9b55f6bd807798047f218c7586326564b2555f54a719052ca34e3304e8bae&
v
@NexaDev It's great to hear that your Python code is working well! To make a POST request with the required headers and body using cURL, you would structure your command like this:
Copy code
bash
curl --request POST \
  --url https://api.vapi.ai/your-endpoint \
  --header 'Content-Type: application/json' \
  --data '{
    "phone_number": "your_phone_number_here"
  }'
Make sure to replace
https://api.vapi.ai/your-endpoint
with the actual endpoint URL you are targeting, and
your_phone_number_here
with the actual phone number you want to use for the fuzzy match. If you're using Postman, you would: 1. Set the HTTP method to POST. 2. Enter the request URL. 3. Go to the Headers section and add a key
Content-Type
with the value
application/json
. 4. Go to the Body section, select the
raw
option, and enter the JSON data. 5. Click the Send button to make the request. If you need to do this programmatically in Python, you can use the
requests
library like so:
Copy code
python
import requests

headers = {
    'Content-Type': 'application/json',
}

data = {
    'phone_number': 'your_phone_number_here'
}

response = requests.post('https://api.vapi.ai/your-endpoint', headers=headers, json=data)

print(response.text)
Again, replace the placeholder URL and phone number with the actual values you're working with. If you need further assistance or have any more questions, feel free to ask!
You can continue this conversation by mentioning me in the message.
n
I am not sure if I understand. The screenshot shows the Custom Tool GUI. How do i add header info there
s
@NexaDev you can add custom headers as of now but, you can create tools right before the call and use query params and assistant overrides to add additonal details.
8 Views