Response Code: 400
-
Hello!
I’m trying to integrate Contact Form 7 → Webhook with an external REST API (RO App).
The API requires a raw JSON object in the request body (Content-Type: application/json).
However, your plugin seems to always send the body as a stringified JSON, not as a real JSON object.
This is clearly visible in the debug email/logs:
Request Body:
"{
\"lead_type_id\": 318825,
\"contact_name\": \"John Doe\",
\"contact_phone\": \"123456789\",
\"description\": \"test\"
}"Because the body is wrapped in quotes, the receiving API treats it as a string, fails to parse JSON, and returns validation errors (required fields reported as empty).
Expected request body (raw JSON object, without quotes):
{
"lead_type_id": 318825,
"contact_name": "John Doe",
"contact_phone": "123456789",
"description": "test"
}"CF7 to Webhook" has a built-in feature that detects when a webhook fails and notifies you with this automated email.
- Form: #892 - Contact form 2
- Webhook: https://api.roapp.io/lead/
- Error: "Webhook returned a error code."
Request Method:
POST
Request Headers:
{"Content-Type":"application\/json","Authorization":"Bearer MY API","Accept":"application\/json"}
Request Body:
"{\n \"_notify_leadtype_id\": 318825,\n \"contact_name\": \"Filip Pok\\u0142osiewicz\",\n \"contact_phone\": \"509465301\",\n \"contact_email\": \"[email protected]\",\n \"description\": \"terst\"\n}"
Response Code:
400
Response Message:
"Bad Request"
Response Headers:
{}
Response Body:
"{\"code\": 400, \"success\": false, \"message\": {\"validation\": {\"_notify_leadtype_id\": [\"Field cannot be empty\"]}}}"Im getting those errors. Can you help me with it?My questions:
- Is there a way in your plugin to send the request body as a raw JSON object, not a string?
- Is there a setting to disable JSON stringification / escaping?
- If not, is this a known limitation of the plugin?
At the moment, this behavior makes it impossible to integrate with APIs that strictly validate JSON bodies.
Thank you in advance for clarification.
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.
