How to send application/x-www-form-urlencoded with...
# support
x
Hi VAPI team, I'm trying to integrate Twilio Verify API which requires
application/x-www-form-urlencoded
format for POST requests, but I'm having trouble with VAPI tools. WHAT I NEED TO SEND: POST https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications Content-Type: application/x-www-form-urlencoded Body: To=+13417668501&Channel=sms WHAT I'VE TRIED: 1. API Request Tool: - Set Content-Type header to application/x-www-form-urlencoded - Configured body properties (To, Channel) - Result: Twilio returns error 20001 "Missing required parameters" - The body data isn't being sent 2. Found this Discord thread saying API Request tools are hardcoded to JSON: https://discord.com/channels/.../API-Request-Tool-adds-default-Content-Type Kyle mentioned "function tool will allow you to customize the header" 3. Function Tool: - Added Content-Type: application/x-www-form-urlencoded header - Configured parameters (To, Channel) - Result: "No result returned" error - Seems Function Tools expect to call my server, not external APIs? QUESTIONS: 1. Is it possible to send form-encoded POST requests directly to external APIs with VAPI tools? 2. If yes, what's the correct configuration? 3. If no, do I need to create a backend proxy that reformats the request? The API works perfectly in Postman with form-encoded data, just can't figure out how to make VAPI send that format. Any guidance would be greatly appreciated!
v
VAPI tools do not natively support sending
application/x-www-form-urlencoded
bodies to external APIs.
The recommended approach is to create a simple backend proxy that accepts JSON from VAPI and forwards it as form-encoded data to Twilio. For example, in Node.js/Express:
Copy code
js
app.post('/twilio-proxy', (req, res) => {
  const qs = require('querystring');
  fetch('https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications', {
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body: qs.stringify(req.body)
  }).then(r => r.json()).then(data => res.json(data));
});
Point your VAPI Function Tool to this endpoint. For more, see the [VAPI API Request Tool documentation](https://docs.vapi.ai/api-reference/tools/create?explorer=true). Sources: - [VAPI API Reference: Create Tool](https://docs.vapi.ai/api-reference/tools/create?explorer=true) - [VAPI Customization: Tool Calling Integration](https://docs.vapi.ai/customization/tool-calling-integration)
3 Views