# Built-In Events

The following events are automatically fired by Critical Moments, and can be used for triggers or conditions.

[Watching events](/events/event-overview.md#watching-events) in debug mode can help you vizualize all the built-in events as they fire.

### App Lifecycle Events

* `app_start`: fired immediatly after the SDK starts. There may be a small delay while we fetch the latest config over the network.
* `session_start`: fired when a user session starts. This is both when the app is initially launced, and if the app enters the foreground after 10 mintues or more in the background. &#x20;
* `app_entered_foreground`: fired when the app enters the forground, including the initial launch
* `app_entered_background`: fired when the app enters the background
* `app_terminated`: fired right before the app is terminated (evicted from memory). Note: the OS will not fire this event in some cases including if the user manually closes the app, or if the app was suspended prior to termination.&#x20;

### Feature Flag Events

* `ff_true:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](/feature-flags/conditional-feature-flags.md) and returns true. Latter half of the string is the condition name which was evaluated.
* `ff_false:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](/feature-flags/conditional-feature-flags.md) and returns true. Latter half of the string is the condition name which was evaluated.
* `ff_error:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](/feature-flags/conditional-feature-flags.md) and returns true. Latter half of the string is the condition name which was evaluated.

### Action Events

* `action:[action_name]`: Fired when a named action is performed. For example, if you fired an action named `gdpr_banner`, the event log would have an event for `action:gdpr_banner`
* `action_error:[action_name]`: Fired when we attempt to perform a named action, but there is an error.

#### App Review Action

* `system_app_review_requested`: fired when any [app review action](/actions-in-app-messaging/app-reviews.md) is fired.&#x20;

#### Banner Actions

* `sub-action:[action_name]:tapped`: fired when a banner is tapped.
* `sub-action:[action_name]:closed`: fired when a banner is closed.

#### Alert Actions

* `sub-action:[action_name]:button:[button_label]`: fired when a button is tapped on an alert. The button\_label is the string label of the button. The "OK" and "Cancel" strings are not localized in events, unlike UI, so the database is consistent across locales.
* `sub-action:[action_name]:button_index:[button_index]`: fired when a button is tapped on an alert. The button\_index is the index of the button tapped. The custom button array starts at index 0, the OK button has a constant value -1, and the Cancel button has a constant value -2.

#### Modal Actions

* `sub-action:[action_name]:closed`: fired when a modal is closed.
* `sub-action:[action_name]:button:[button_label]`: fired when a button is tapped on an modal. The button\_label is the string label of the button.
* `sub-action:[action_name]:button_index:[button_index]`: fired when a button is tapped on an modal. The button\_index is the index of the button tapped. Not fired for the "close" button (see the `closed` event above).

### Notification Events

* `notifications:tapped:[notification_id]`: fired when a notification is tapped. The notification id is the [UNNotificationRequest identifier](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) of the notification. For notifications created in Critical Moments the ID format is `io.criticalmoments.notifications.[notification_name]`.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.criticalmoments.io/events/built-in-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
