Data Action’s POST to a webhook receiver is failing; getting a 400. It’s intermittent; happens maybe 1 in 10 attempts. The receiver logs show valid JSON; the platform’s error isn’t helpful.
Architect flow has a Data Action; POSTing interaction attributes to our internal system. We’re using the SDK 9.1.2; Python 3.9. The receiver is a Flask API; simple endpoint.
Data Action configuration (paraphrased)
Method: POST
URL: https://our-system.example.com/webhook-receiver
Headers: Content-Type: application/json
Request Body: ${interaction.customer.phoneNumber}
The receiver’s Flask app:
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/webhook-receiver', methods=['POST'])
def webhook_receiver():
data = request.get_json()
print(f"Received data: {data}") # logs look fine
return jsonify({"status": "received"}), 200
if __name__ == '__main__':
app.run(debug=True)
We’ve tested the receiver directly with curl; works perfectly. The platform’s error message is consistently: 400 Bad Request - malformed JSON. It isn’t malformed; it’s a simple string. Seems like the SDK or the platform is adding something; or maybe escaping it incorrectly. It’s odd; intermittent issues are the worst. The platform’s debug logs show nothing useful; just the 400. We’ve tried setting the Content-Type explicitly in the Data Action; didn’t change anything; still happens.