✅ WHAT YOU NEED TO BUILD
You must create a Botpress Custom Action that does 5 things:
1️⃣ Accept a nested JSON input
Example:
{
"customer": {
"name": "Sarah James",
"customer_ref": "cust_001"
},
"order": {
"service_code": "DOC_GEN",
"price_id": "price_12345",
"details": {
"quantity": 1,
"notes": "Urgent delivery"
}
}
}
2️⃣ Validate the payload using Zod
Validate nested objects
Required + optional fields
Clear error messages
Proper try/catch
3️⃣ Make a POST request to a sample API
Example Targets:
reqres.in
jsonplaceholder
mockapi.io
make.com api-
Include:
✔ Retry logic (3 attempts)
✔ Fail gracefully
4️⃣ Update Botpress State
Write to:
user.response_data
conversation.last_api_status
5️⃣ Return a structured response
Like:
{
"success": true,
"validationErrors": [],
"apiStatus": "SUCCESS",
"responseData": {},
"state": {
"user": {},
"conversation": {}
}
}