https://discord.gg/botpress logo
g
Hello dev team, I’m facing a blocking issue, and I’ve been stuck on it for two days now. Context: • A webhook trigger is fired whenever my autoresponder (Brevo) registers a new contact (this part works perfectly). • After retrieving the contact details, especially the phone number, I initiate a WhatsApp conversation (this also works). However, after the ā€œWhatsApp Start Conversation Card,ā€ the bot somehow restarts at the Start node, then moves to the next node and stops. From the logs, I noticed that my variables in the User scope were empty at that moment. Additionally, the event.payload did not contain a conversationId or userId (unlike the webchat trigger, which I assume generates them automatically). I figured I might need to generate a ConversationId and UserId myself. If that’s the case, my questions are: 1. How can I generate them using the SDK ? 2. How can I use them to ensure the current conversation is properly associated with them? I found a previous discussion on this topic, but it’s still not very clear to me—sorry for that.
l
First and foremost you cannot create a conversationid from a trigger, meaning the conversationId should be present. This is because (I am not from Botpress but my guess) a conversationid is created when a conversation starts and a trigger enters the workflow from anywhere. In webchat, the conversation id is passed to the chat window and in every response the conversationid is passed along with the payload to Botpress from the web chat, which is not true in case of WhatsApp. Since the trigger enters the workflow from anywhere, the context, variables and conversationId is not known by the bot, so you will have to provide them in the trigger payload for the bot to get context
g
Thanks for your feedback. I found a solution. I store certain pieces of information from the webhook payload in a table. When the conversation is triggered by the bot, I retrieve the relevant information from this table using the WhatsApp ID (the contact’s phone number). It works perfectly 🤌
l
That is the way
3 Views