> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-console/automations/actions/notification.md).

# Notification

Send a push notification to your users' devices through Firebase Cloud Messaging.

The Notification action pushes a message to devices through Firebase Cloud Messaging (FCM). In this guide, it completes the `Transfer alerts` automation from the [Monitor](/baas-console/automations/triggers/monitor.md) page: a push lands on your device whenever someone moves more than 1 token.

{% hint style="info" %}
**The Notification plugin needs a one-time setup.** Add your Firebase credentials in [Action Plugins](/baas-console/action-plugins.md#notification), then activate the plugin.
{% endhint %}

## Compose the notification

{% stepper %}
{% step %}

### Pick the Notification type

[Add a step](/baas-console/automations/actions.md) to the pipeline and pick **Notification**.
{% endstep %}

{% step %}

### Choose the recipients

**Recipient** takes one FCM token per device to notify, separated by commas or line breaks. Every device that enabled push in your app has one. In our example, the alert goes to your own device, so paste its token. In [batch mode](/baas-console/automations/batch.md), the field holds each user's device tokens instead.
{% endstep %}

{% step %}

### Write the message

**Title** and **Body** are what the device displays, and both accept templates. In our example:

* **Title**: `Transfer alert`
* **Body**: `{{trigger.event.args.value.formatted}} tokens ({{trigger.event.raw.transactionHash}})`

`value.formatted` is the amount in the token's [unit](/baas-console/contracts/units.md), which is what a message should show.
{% endstep %}

{% step %}

### Save

Click **Save**. The notification now goes out on every run.
{% endstep %}
{% endstepper %}

## Attach data

The device displays Title and Body; **Data** adds values meant for your app's code. Values accept templates. In our example, `{"txHash": "{{trigger.event.raw.transactionHash}}"}` gives the app the hash it needs to open the transaction when the notification is tapped.

## What the next step receives

| Field        | Contents                                          |
| ------------ | ------------------------------------------------- |
| `tokenCount` | How many device tokens FCM accepted, possibly `0` |
| `userCount`  | How many users were looked up for the send        |

A pasted token list targets devices directly, with no user lookup, so `userCount` stays `0`.

{% hint style="info" %}
**Tokens come from your app.** Each recipient is an FCM registration token created by your app's Firebase client; the [Push notifications](/baas-sdk/integrations/push-notifications.md) guide walks through getting one and registering it with BaaS.
{% endhint %}

## Next

* [Function](/baas-console/automations/actions/function.md): shorten the transaction hash first.
* [Push notifications](/baas-sdk/integrations/push-notifications.md): register device tokens from your app.
* [Action Plugins](/baas-console/action-plugins.md#notification): the Firebase credentials.
