https://discord.gg/botpress logo
Different workflow for different website
# 🤝help
b
I want to install my chatbot on two different websites. I need the chatbot to trigger a different workflow upon initialization, depending on the website it is installed on. I've seen that 'custom triggers' exist, but I don't understand how they work. What code should I use to pass the website information to the chatbot? https://cdn.discordapp.com/attachments/1470449918840672398/1470449919142789241/image.png?ex=698b56b4&is=698a0534&hm=2638935a3083da33fb848d11e39506c7259d73f1904be3bf1a203d384b9fde2b&
l
Would a quick work around be just using 2 different workspaces?
You can read more on the custom trigger here by the way 😄 https://botpress.com/docs/studio/concepts/triggers#custom-trigger
b
I want to do that but not when the user click on a button but when the chatbot open
w
you can pass the url via userData on the botpress init
Copy code
js
<script>
  window.botpress.init({
    botId: "YOUR_BOT_ID",
    // ...
    userData: {
      pageUrl: window.location.href,
      pageHost: window.location.hostname
    }
  });
</script>
after that you can use the "get user data" node to get the pageUrl value, then use an expression to route the user
like
workflow.pageUrl = workflow.userData.userData.pageUrl
b
Thank you
2 Views