https://discord.gg/botpress logo
New thread to integrate code to connect with Wazen...
# đŸ€help
r
👋 Hi , Leanne After several attempts, I was finally able to create and edit a custom action. Previously, the editor wouldn’t let me type, and I didn’t know that you can only write code starting from the third line — thank you if that’s been clarified or improved recently. Now I have an action called sendWazendReply which performs a POST request using axios to Wazend’s API (to send WhatsApp messages). This works perfectly when tested outside of Botpress — the message is received on the phone without issue. The problem is that the action does not work when triggered from within a Botpress flow. We’ve tried the following: Calling the action using await actions.sendWazendReply() from an “Execute code” card. Writing the full axios code directly into the code block. Using bp.axios and fetch as alternatives. We've verified the endpoint, phone format, token, and response — Wazend returns a 200 OK consistently. 🔮 However, in all cases: The message is delivered via Wazend (we see it on the phone). But Botpress throws execution errors, such as: Cannot read properties of undefined (reading 'post') Integration sendWazendReply not found Node not found The flow breaks and does not continue to the next card. Could you please confirm the recommended way to make external API calls (like Wazend) from an action or webhook, without breaking the flow? Are there any cloud limitations or considerations when using axios, bp.axios, fetch, or similar HTTP request methods from within Botpress? Thank you in advance — we really appreciate your help to get this working properly. Let me know if you want to include any screenshots or the actual action code with it. https://cdn.discordapp.com/attachments/1377354572670177330/1377355528581152869/image.png?ex=6838a9cc&is=6837584c&hm=004e7948fcf14c21e6b7fd4c2708f2070b69280ed03be5a624080f5e8a8ec0e6& https://cdn.discordapp.com/attachments/1377354572670177330/1377355528883409016/image.png?ex=6838a9cc&is=6837584c&hm=071256d964d08591ccb5a047a7d94dd5563373ea170e6a8aa492a38d577d1f5c& https://cdn.discordapp.com/attachments/1377354572670177330/1377355529239793774/image.png?ex=6838a9cc&is=6837584c&hm=86aeb184812333932074083f875f96e722a97fcc2ac0a7d9f9c5291b04e23496&
p
The recommended way is to use an execute code card for api calls, if you want to stick to your action then it must be used within the AN not called through the execute code card. If you type await in the search bar on discord you'll find many examples of api calls made within execute code cards. Hope this helps!
r
Hi! Thanks for your response. We've created a brand new bot from scratch, installed only the Webhook integration, and implemented a single workflow that uses an "Execute Code" card to send a fetch() POST request to Wazend API. The code works perfectly in Postman and with other platforms (Make, Node.js, etc.), but in Botpress we always get the same error from the conversation-analyzer-track-conversation hook: vbnet Copiar Editar Error: data must have required property 'conversationId' We’ve already removed every card from the Conversation End workflow and deleted all possible connections, but the hook still fires internally and fails, even if we never call anything related to it. This happens just because it’s there by default. 💡 So our question is: Is there any guaranteed way to use fetch() (or axios, or any external API call like Wazend) inside an Execute Code card and avoid Botpress’s automatic conversation tracking or background actions that require a conversationId? We’re fine using only the Execute Code method — we don’t need the Action Node if it's going to cause problems. But we’d like clear confirmation that: It's possible to call external APIs (like Wazend) inside Execute Code without using actions[]. It's possible to disable or bypass the automatic conversation-analyzer to prevent it from breaking the flow. Hope this helps clarify the case — thanks again for your support!
l
event.conversationId should have a conversationId for botpress code to work. when the hook receives a payload, it does not execute, if there is no conversationId attached to the payload
r
Hi, thank you for the clarification. We understand that the payload needs to include a conversationId in order for the Botpress code to execute properly. In our case, we're triggering the bot via a custom webhook from Make.com (Integromat), using messages received through Wazend (WhatsApp API). The payload that reaches Botpress doesn't include a conversationId, only the sender ID from WhatsApp. We tried to manually assign event.conversationId = event.payload?.sender || "whatsapp_user_" + Date.now(); inside an Execute Code card, but it still fails with an error. Is there any way to initialize or simulate a conversationId programmatically in the webhook payload or inside Botpress to allow execution? Or would you recommend using a Send Message card and avoid code execution altogether in this case? Thanks again for your help.
l
You cannot create conversationId with some random value. It is generated by the Botpress engine The correct process is you integrate WhatsApp using a manual method and instead of sending data to the custom webhook let it send to the webhook in the WhatsApp integration, that will create a conversationId. The alternative is a length process, read the create conversation documentation process in Botpress docs You have to create a user for channel WhatsApp, from the user creating a conversation that will generate the conversationId. You will need to store the details of sender, user, conversation somewhere
r
Hi Lijo, Thanks a lot for the clarification. We now understand that conversationId is generated only when using an official Botpress integration (like the WhatsApp module), and that custom webhooks — like the one we're using with Make and Wazend — do not trigger that process automatically. We initially chose this method for its flexibility and lower cost, but we now see that it has limitations when working with modules like SummaryAgent or conversation-analyzer, which require a valid conversationId. For now, we’ll wait to see if Botpress support can help us disable those modules or confirm an alternative setup. Meanwhile, your explanation has been really helpful to understand the architecture behind how conversations are managed in Botpress. Thanks again for your time and help! Best regards, JosĂ©
p
You should be able disable the agents yourself, by clicking on them and toggling off enable agent.
r
Hi Leanne, Thanks so much for the help! I was finally able to uninstall the Conversation Analyzer module, and after doing that, everything started working correctly — no more errors with the webhook or conversationId. 😄 Really appreciate your support đŸ€ Best regards, JosĂ© Antonio
p
I'm glad everything is now working as expected! Happy to have helped :))
r
Thank you, greetings
3 Views