Skip to content

Commit

Permalink
Merge pull request #260 from botpress/rk-triggers
Browse files Browse the repository at this point in the history
Update - Triggers
  • Loading branch information
ptrckbp authored Mar 28, 2024
2 parents 0900dad + 410db58 commit 3ba5aff
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions pages/cloud/toolbox/events-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ Events and Triggers in Botpress allow you to interact with your bot based on dif

Events represent interactions or changes of state within the chat platform. These might not directly involve a message exchange in a conversation, but they capture a variety of activities. For instance, it could be when a user opens the chat in WhatsApp, when a new issue is created in Linear, or a member joining a group in Telegram.


## Fixed Schedule

Fixed Schedule is a feature that allows you to schedule events to occur at specific times. This can be useful for sending reminders, notifications, or other time-sensitive messages to users. Here's how you can use the Fixed Schedule feature:

### Cron Expression

A cron expression is a string representing a schedule. It consists of five fields separated by spaces, each representing a different aspect of the schedule. The fields are as follows:

1. Minute (0 - 59)
2. Hour (0 - 23)
3. Day of the month (1 - 31)
4. Month (1 - 12)
5. Day of the week (0 - 7)

Here are some examples of cron expressions:

- `0 0 12 * * ?` - This expression triggers an event every day at 12:00 PM.
- `0 0 12 ? * MON-FRI` - This expression triggers an event every weekday at 12:00 PM.
- `0 0 12 1/1 * ? *` - This expression triggers an event every minute.

## Webchat Triggers

When you enable the webchat, you can access Webchat Triggers. These are specific types of events that you can use for your benefit. Here are the types of Webchat Triggers:
Expand Down Expand Up @@ -36,6 +57,10 @@ To use a trigger, add it to the studio editor. Here's what you need to remember
</Callout>
<br />

### Advanced Options - Conversation ID

The conversation ID is a unique identifier for each conversation. It can be used to track the conversation history and context. You can use the conversation ID to send messages to a specific conversation or to store information about the conversation.

## Welcome Message

To make the bot send a welcome message, add a trigger to your flow, then choose the "Conversation Started" type. This would make the bot send a message even if the user didn't.
Expand Down Expand Up @@ -132,6 +157,3 @@ Here's an example:

In this example, when the user clicks on the button, the bot opens up and then sends a payload to the bot. You can customize this code based on your needs to create interactive experiences for your users.

## Conclusion

Events and Triggers in Botpress are powerful tools that allow your bot to be more interactive and responsive to user actions. Understanding how to use these features will enable you to create a more engaging user experience.

0 comments on commit 3ba5aff

Please sign in to comment.