https://discord.gg/botpress logo
Need Help: Mapping Website Payload to Botpress Flo...
# šŸ¤help
s
Hi, I’m totally new to bot building and I’m blown away by Botpress and its features. I’m building a bot with three types of users — "guest", "couple", and "planner" — for my own wedding project, but I’ve hit a roadblock trying to detect the user type from my Squarespace site. Here’s the script I’m using in my website footer: //REST OF WEBCHAT SCRIPT // After webchat is ready, send a CUSTOM event with a clear key window.botpress.on("webchat:ready", async () => { await window.botpress.sendEvent({ type: "custom", payload: { audience: "guest" } // change to "guest" | "couple" | "planner" }); }); What I’ve tried so far: Using a Custom Trigger (advanced) node that reads {{event.payload}} and routes to either guest, couple, or planner flows. Tested multiple node types (Standard nodes, AI nodes with AI Transition, AI Tasks and Standard Transition nodes). Tried different expressions, for example: event.payload.audience === 'guest' and other variants. Also tested sending "text": "guest" in the payload instead of audience: "guest". And other variations I could find. The problem: In the logs, the payload often comes through as empty, or the AI Transition logs say the content does not relate to ā€œguestā€, ā€œcoupleā€, or ā€œplannerā€ and routes back to the main flow. This happens even when I can see in the footer script that I’m sending "audience": "guest". When I do get the logs to read the json payload and it correctly routes (AI Task with expressions) the user.user_flow will not set for some reason, presumably because it is bundling the whole json and not the string. I’ve watched your documentation videos on triggers and AI transitions, but I can’t seem to get this working. Could you please clarify: The correct event type and payload structure to send from the website so Botpress can reliably route to a branch based on "guest" | "couple" | "planner". The best node/condition setup in the flow to detect and store this value in a user variable (e.g., user.user_flow). I’ve attached screenshots of my flow and logs so you can see my setup. I've also included the emulator and variable screenshots to show output. Thanks so much for your help! https://cdn.discordapp.com/attachments/1404430908584493106/1404430908844675163/Screenshot_2025-08-11_at_12.40.12.png?ex=689b29b5&is=6899d835&hm=36bbb8d11fffd4aa083b4effda8b4aaf52eca297132686465d89a47204bda94b& https://cdn.discordapp.com/attachments/1404430908584493106/1404430909129621646/Screenshot_2025-08-11_at_12.40.40.png?ex=689b29b5&is=6899d835&hm=8be165a527957a284e8def3f2dbef1de8e0d6035bd5a25f77d76a50eda5e863c& https://cdn.discordapp.com/attachments/1404430908584493106/1404430909402382427/Screenshot_2025-08-11_at_12.41.17.png?ex=689b29b5&is=6899d835&hm=572249f1af762f1008e19aa8bb60dc2a75800bcfe8b4cb766a5d4f1323055186& https://cdn.discordapp.com/attachments/1404430908584493106/1404430909733867540/Screenshot_2025-08-11_at_12.41.48.png?ex=689b29b5&is=6899d835&hm=a1c261a9cb2ee57d8bcd3cde6dc88a45ec629614f65c40a5e12d85e1bd7c1b5d& https://cdn.discordapp.com/attachments/1404430908584493106/1404430909989453924/Screenshot_2025-08-11_at_12.42.12.png?ex=689b29b6&is=6899d836&hm=0d9a34153600762b3ee9d93dedad93c252e3c417ec3a3afd4db6b0f7e8ca2215& https://cdn.discordapp.com/attachments/1404430908584493106/1404430910220271616/Screenshot_2025-08-11_at_12.42.50.png?ex=689b29b6&is=6899d836&hm=1bf97a9a96df02fd380604d6c2eb5baadd3987a491021d1b598df5dff5b9c77c& https://cdn.discordapp.com/attachments/1404430908584493106/1404430910555951244/Screenshot_2025-08-11_at_12.43.09.png?ex=689b29b6&is=6899d836&hm=00b97dd75022e43e44e0ee84ea91c2787ee787e433f951740f0abde044f063d8& https://cdn.discordapp.com/attachments/1404430908584493106/1404430910853480560/Screenshot_2025-08-11_at_12.43.22.png?ex=689b29b6&is=6899d836&hm=c41a30823c1d76891bb6a5146f1d7637e051ceb7026d22eefcfe22aad4014572&
p
I suggest avoiding the use of the Ai task and simply writing out the correct path in your transitions. To identify what the payload looks like, you can print it via a text card. Hope this helps!
s
Thanks for getting back to me @prehistoric-airplane-85682. I've tried replacing the AI Task with standard transitions a few times times, using a Router node with Expression conditions and a debug Text card immediately after. The issue remains the same: the payload sent from my website on webchat:ready is not being recognised in Botpress. In the debug Text card, event.payload.audience, event.payload.data.audience, and event.payload.text are always empty. The logs then classify the input as Anything_Else, which routes to ā€œunknownā€ and ends the conversation. I’ve tested both sending a text event and a custom event from the site, and I have triggers set up for webchat:message and webchat:trigger (predicate true, scope dm). The triggers fire, but the variables in the payload are blank. This behaviour only happens when I send the event from the website script — if I trigger it manually from the emulator, it works fine. Is there a specific event shape or field name Botpress expects when sending an event from webchat:ready so the Router transitions can match it?
3 Views