https://discord.gg/botpress logo
Facing issue to implement Validate the payload usi...
# 🤝help
c
✅ 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": {} } }
l
What exactly is the issue? Are you able to share more details / screenshots it would help 🙂
w
- [Actions](https://botpress.com/docs/studio/concepts/actions#then-use-the-generated-action) should only be used as agent tools in an Autonomous Node. - Actions already receive an input object defined by a Zod [Schema](https://botpress.com/docs/studio/concepts/schemas) (if the output is not valid, the call fails) - Actions also return an output object defined by a Zod Schema. - The action body behaves like any other function, allowing you to define your [axios](https://botpress.com/docs/studio/guides/advanced/use-code#libraries) call with your back-off logic.
2 Views