# Events

**Events** are a versatile way to trigger a flow whenever either:

* a variable changed
* a silence was detected

{% hint style="info" %}
Note that Events are not the same as [Track events,](https://docs.chatlayer.ai/bot-answers/track-events-for-analytics) which are used for analytics purposes.
{% endhint %}

## Variables Changed event

Using a **Variables Changed event** will allow you to trigger a block whenever a variable value is changed. This can happen for example within a [Condition](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/plugins) block, a [button](https://docs.chatlayer.ai/bot-answers/dialog-state/message-components#next-bot-dialog), or even when an [entity](https://docs.chatlayer.ai/understanding-users/natural-language-processing-nlp/synonym-entities) is detected. In other words, the bot will continue to the next block set to happen when this change of variable was detected.

To add an Variables Changed event to your bot:

1. Open the **Events** page under the **Bot builder** tab, on the left-hand side of the screen.
2. Click on **Create event.**
3. Fill in the event with the features that you would like. In this example, we want to trigger the block called Variable changed whenever the `test_variable` changed.&#x20;
4. Click on **Create.**

{% hint style="info" %}
Please note that if you want to create an event triggered when a variable changed, that variable needs to be created beforehand, otherwise you won't find it in the dropdown menu.
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FIPGu9wyvPDUMN9pJSbh1%2FScreenshot%202023-10-13%20at%2016.43.49.png?alt=media&#x26;token=6a71f3f1-9bb9-45e0-9e99-0185cfbf48ba" alt="" width="274"><figcaption><p>Create a Variables changed event</p></figcaption></figure>

This results in the following flow:

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F6PdUvF1zaSgEVilfcZRI%2FScreenshot%202023-10-13%20at%2016.46.46.png?alt=media&#x26;token=16628471-ff1a-4931-8103-eeb3f679ad4a" alt=""><figcaption><p>A flow example where a Variables Changed event takes place.</p></figcaption></figure>

And this flow will result in this type of conversation:

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2Fe9sE9d4mHkpJZTIP0RDs%2FScreenshot%202023-10-13%20at%2016.48.15.png?alt=media&#x26;token=30a50995-d584-49e4-b9a2-95e3521fa63d" alt=""><figcaption><p>An example of conversation using a Variables changed event.</p></figcaption></figure>

The changed variables are also stored in the user session, from your **Debugger** tab, where you can access them in the `events.variablesChanged` array.

![Access the changed variables from your Debugger tab.](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-M0bNdk-aEhqurz6mg5T%2F-M0bQiQqeNniGa3Sgll7%2Fimage.png?alt=media\&token=2cf5a36e-0f5b-4101-9cc9-475fa294365a)

{% hint style="success" %}
Customers often use Variables Changed events to perfrom an API request through an [API action](https://docs.chatlayer.ai/integrateandcode/custom-back-end-integrations).&#x20;
{% endhint %}

## Silence Detected event

**Silence Detected events** allow you to steer the conversation to a new block when the user doesn't respond for a defined period of time. The duration of silence can range from 1 minute to a maximum of 1440 minutes (24 hours).

{% hint style="info" %}
Silence Detected events are not the same as Delays, which are a way to wait before the bot goes to the next block. Learn more about Delays [here](https://docs.chatlayer.ai/bot-answers/dialog-state/action-bot-dialog#delay).
{% endhint %}

To add a Silence Detected event to your bot:

1. Open the **Events** page under the **Bot builder** tab, on the left-hand side of the screen.
2. Click on **Create event**.
3. Fill in the name, trigger and duration (in minutes) that you would like to wait before the next block. In this example, we trigger the block called Next block after 1 minute.
4. Click on **Create**.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F7bOmjqNgRZ0D3i6w2zlc%2FScreenshot%202023-10-13%20at%2017.08.40.png?alt=media&#x26;token=c5c75c58-d4d3-4d24-a148-437409754987" alt=""><figcaption><p>Create a Silence Detected event.</p></figcaption></figure>

{% hint style="info" %}
You can create **multiple Silence Detected events** within one bot. All of them will start counting at the same time, i.e. your bot will prompt the user at several intervals. It's best practice to not create multiple Silence Detected events with the same duration so that users aren't spammed with multiple messages in a row.
{% endhint %}

## Whatsapp Flow Completed event&#x20;

**Whatsapp Flow Completed** events allow you to handle the events created by whatsapp when a user completes a [whatsapp flow](https://business.whatsapp.com/products/whatsapp-flows) . To add a Whatsapp Flow Completed event to your bot:<br>

1. Open the **Events** page under the **Bot builder** tab, on the left-hand side of the screen.
2. Click on **Create event**. And choose **Whatsapp flow completed** as trigger
3. Fill in the name, destination variable and bot dialog to visit
4. Click on **Create**.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FdVmxmHpvbFK3rUhZShWg%2FScreenshot%202026-04-01%20at%2015.51.14.png?alt=media&#x26;token=58f67c91-7696-495b-86ea-e15e6baef33e" alt=""><figcaption></figcaption></figure>

The data the user provided when completing the flow will be saved in the chosen **destination variable** and the bot will continue from the dialog chosen in the **Bot dialog to visit** field. <br>

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F8I9JJy93JAOgncWJ7TWd%2FScreenshot%202026-04-01%20at%2016.11.32.png?alt=media&#x26;token=4a6f2f15-fbbd-46e7-b7ab-5ecefb7c19ed" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can only define **one** Whatsapp Flow Completed event **per bot version.** If your conversation includes multiple whatsapp flows you should make sure to handle the possible differences in the destination bot dialog
{% endhint %}
