How to use events to trigger a dialog with the use...
# 🤝help
a
Hey! I'm looking for a way to make it so that an event is created through the https://botpress.com/docs/api-documentation/#create-event API and then I can pick it up in Studio to start a scenario. For example, I need to ask a user a question or remind them of something at special time. I already have access to Events in Studio. Thank you!

https://cdn.discordapp.com/attachments/1134604567892476007/1134604568043462696/Screenshot_2023-07-28_at_2.41.41_PM.png

b
I'm going through the same thing. I wanted to integrate a Stripe payment link admist the conversation and want the Bot to acknowledge that the payment had been successful.
Is there a no code or code way to do that?
a
Anyone from BotPress team @red-rocket-93714 @acceptable-kangaroo-64719 can help us? 🙂
a
@witty-football-93730 I think they would have to catch the event from Stripe in the webpage, and then send a custom event from the webpage to the bot, right? Like
window.botpressWebChat.sendEvent({type:'trigger', payload:{id:12345, note:'payment successful'}})
a
@acceptable-kangaroo-64719 how about my question? 🙏
Please suggest a solution. I don't need the code. Thank you!
a
Hey @aloof-shoe-51097 that's the best solution we hve right now. Short of making a custom Stripe integration, you'll need to deal with Stripe's webhook & events in your own webpage, then send an event to Botpress, and finally catch that event in a trigger and do soemthing in a bot. This will involve a lot of code- there's no no-code way to do this in the product right now.
a
I'm fine with a code solution with a custom backend, I just wanted you to reply faster and not offer me a complete solution, just a concept. Thanks! We'll do it via events. @acceptable-kangaroo-64719
@acceptable-kangaroo-64719 how to select my custom event in studio that I created on backend?

https://cdn.discordapp.com/attachments/1134604567892476007/1136406809628913814/Screenshot_2023-08-02_at_2.14.44_PM.png

Tried to create an custom event throught API, but I see an error
{ "type": "test_event", "payload": { "author": "Victor K", "reason": "For fun!" } } { "code": 400, "type": "ReferenceNotFound", "message": "Event type \"test_event\" isn't defined by the bot \"83d03550-ae98-4450-b105-658b72bda731\"" }
Please help @acceptable-kangaroo-64719 @red-rocket-93714
@bumpy-butcher-41910 may be you can help us
a
the type needs to be "trigger" for a custom event, check out a working example here https://jsfiddle.net/GordyNumberOne/pbhf3L0d/71/
Once you're sending triggers, you can listen for them in the studio with the "discover events" button

https://cdn.discordapp.com/attachments/1134604567892476007/1136608637792563221/image.png

a
We don't use Webchat, and creating a new event via API doesn't work "Event type "test_event" isn't defined by the bot "83d03550-ae98-4450-b105-658b72bda731""
a
@colossal-activity-12523 or @rich-battery-69172 do y'all know how to send & catch custom events through non-webchat channels?
r
@aloof-shoe-51097 you want to trigger your bot from your backend? you can use the Webhook Integration for this. You will need beta access to triggers to use it!
a
Yes! Already had access to triggers. Do you have any example on how to use it?
a
a
Perhaps you have an example of how to use the Webhook integration? I haven't found any examples.
a
I don't have an example. @early-train-33247 do you?
a
Or describe the concept of how to use them, any help would be good for me. We don't know how to approach it yet, but we need it badly.
j
hey victor, i know this is not related but do u know how to code the chatbot so it can only auto-open after 45 seconds
a
you can use
setTimeout
in javascript to wait before sending a trigger to the bot. This would all need to be done in the webpage. https://www.w3schools.com/jsref/met_win_settimeout.asp
102 Views