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&