https://discord.gg/botpress logo
Custom trigger received but message not sent 🤔
# 🤝help
f
Hello guys, I’ve embedded my chatbot globally on my website using Google Tag Manager. I also created a second tag that’s triggered on a specific page to send a message with the bot. I tried using the following code:
Copy code
<script>
  window.botpress.on('webchat:opened', function(conversationId) {
    window.botpress.sendEvent({
      type: 'test'
    });
  });
</script>
The event is received in the Studio but the text card configured in the standard node (see picture) is not sent. Instead, I receive this message in my chatbot
It seems like I didn't catch your last message.
Do you have any idea why it doesn't work? https://cdn.discordapp.com/attachments/1362344347621654569/1362344348078969014/Capture_decran_2025-04-17_a_10.26.57.png?ex=68020d8b&is=6800bc0b&hm=1a822f5a5ec2265d8c2442e85f0e6583513f07c0709577baa3e28fc5c7d0fb87& https://cdn.discordapp.com/attachments/1362344347621654569/1362344348527755314/Capture_decran_2025-04-17_a_10.29.12.png?ex=68020d8b&is=6800bc0b&hm=d93feb46917298b9ffd34b7d9678a0ebdfba6c3989e2459882e0ff830c187333&
@bumpy-butcher-41910 Here's my issue I mentioned during the AMA sessions yesterday 😇 Thanks 🙏
w
in studio you can only use the button (after an event was sent to your published bot). Have you try without pass
{{event.convesationid}}
leaving blank the fields?
f
Yes I tried with the play button with an event I received. THen I clicked on the play button and the message is sent in test mode of the Studio and also in the published webchat. I tried with AND without
{{event.convesationid}}
. Same for
{{event.userId}}
Okay I removed the
conversation started
trigger in my workflow and my custom trigger now works so it means we can't have multiple triggers in a same workflow. I don't understand why?
w
You may have the Number of trigger you need, the trigger is sent to the current conversation and user. if you don't use a filter the trigger starts every events, if you need to have different events that do different things add to your payload one or more fields to use in expression. I usually add a
type
field with a string key and my expression is something like this: *
event.payload.payload.type === 'urlDataChanged'
*
event.payload.payload.type === 'orderButtonClick'
w
In the 2nd picture trigger is disable, and you don't need to fill Conversation ID field, the event is already send to the current conversation.
f
Yes I disabled it to avoid issue with the live version on my website but I tried when it was activated of course. I tried to remove the Conversation ID but I still have the same issue... 😦
@orange-egg-72655 We discussed that during the AMA session 🙂
p
Hey @fierce-photographer-28928! Just confirming, you are still facing the issue that the {{event.payload.payload.type == 'test'}} expression, does not trigger the following message when you test it in the preview?
f
I don't receive the message in the webchat but I can manually send it in the test mode when I check the events received. When I click on the play button, the message is received but not automatically
p
Hi Edouard, When you say you don't receive the message in webchat, do you mean the preview webpage? If that's the case, you might want to try changing the version in the url to 2.2 since it is known that the conversation started triggers don't fire in the following versions.
e
@fierce-photographer-28928 Were you able to find a fix to this problem?
f
Nope 😦
You have the same issue?
e
Yes @fierce-photographer-28928 experiencing the exact same problem.
The trigger gets logged in the test events section when we fetch last events, but donot trigger the next block its linked to. Surprising thing is that the Autonomous node, becomes aware of that event once it happens, but somehow that standard node that sits between both of these never gets triggered through the trigger in production. But if I Test the trigger within the editor, it works totally fine.
@prehistoric-airplane-85682 Can you provide any help/info on this issue?
3 Views