> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/push.md).

# Push

Send push notifications to your users' phones and browsers — one at a time or as a campaign — from templates, through a push provider.

The Push module sends notifications to the **devices** of your users: iPhones, Android phones and web browsers. Your app registers each device with Norbix, you write the message once as a **template** (a title and a body per language, with `@Model.…` tokens), connect a **provider** that delivers it (an **integration** — Apple, Firebase, web push), and send it from a **campaign** or from a trigger. Push uses the same template engine, token binding and campaign rules as Email and SMS.

## Enable the module

Open a project and choose **Push** in the left menu. While the module is off, Cloud shows this page; scroll down and press **ENABLE**. You need a project role that can manage modules (for example **Owner** or **Administrator**).

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-af081f2e24795d4a9d5bca105c1d03814cc415d6%2Fenable-1.png?alt=media" alt="The Norbix Push Notifications enable page: Send push notifications with:, three benefits (Bring users back to your app, Reach every device, Connect the provider you already trust) and a picture of the push campaign form"><figcaption><p>Push → enable page, shown while the module is off.</p></figcaption></figure>

After **ENABLE**, Cloud opens **Push → Campaigns** and shows the Push menu: Campaigns, Templates, Devices, Integrations, Settings. The first time the module is enabled, Norbix also adds:

* the [Fake Push (Test Me)](/codemash/cloud/push/integrations/providers/fake.md) integration, already tested and the default, so you can try every flow at once — it completes every send and delivers nothing;
* five ready templates for Membership flows (`New user verification`, `Password reset`, `New user invitation`, `Onboarding new app user`, `User deactivation`), in the project's default language.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-55eebe57a357c36138bb0d744c1057e383dab5d1%2Fenable-2.png?alt=media" alt="Push Campaigns list right after ENABLE, still empty, with the Template ID, Date From and Date To filters and the Push menu on the left: Campaigns, Templates, Devices, Integrations, Settings"><figcaption><p>After ENABLE: the Push Campaigns screen and the Push menu.</p></figcaption></figure>

To turn the module off again, see [Settings](/codemash/cloud/push/settings.md) — templates, devices and integrations are kept.

## Module map

| Screen                                               | What it is for                                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Campaigns](/codemash/cloud/push/campaigns.md)       | Every push send of the project — [now](/codemash/cloud/push/campaigns/new.md) or [later](/codemash/cloud/push/campaigns/schedule.md) — with its [details](/codemash/cloud/push/campaigns/details.md), [message log](/codemash/cloud/push/campaigns/log.md) and a [stop](/codemash/cloud/push/campaigns/stop.md) button.                                        |
| [Templates](/codemash/cloud/push/templates.md)       | The title and body, one version per language, with tokens: [create and edit](/codemash/cloud/push/templates/editor.md), [translate](/codemash/cloud/push/templates/translate.md), [send a test](/codemash/cloud/push/templates/test-send.md), [archive](/codemash/cloud/push/templates/publish.md), [delete](/codemash/cloud/push/templates/delete.md).        |
| [Devices](/codemash/cloud/push/devices.md)           | The phones and browsers your app registered, each with the user it belongs to, and the [details](/codemash/cloud/push/devices/details.md) of one device.                                                                                                                                                                                                       |
| [Integrations](/codemash/cloud/push/integrations.md) | The providers that deliver your push — [APNs](/codemash/cloud/push/integrations/providers/apns.md), [Firebase](/codemash/cloud/push/integrations/providers/fcm.md), [Safari](/codemash/cloud/push/integrations/providers/safari-push.md), web push and the [Fake sandbox](/codemash/cloud/push/integrations/providers/fake.md) — and which one is the default. |
| [Settings](/codemash/cloud/push/settings.md)         | Turn the module off for the project, after seeing what depends on it.                                                                                                                                                                                                                                                                                          |

## Your first push

1. [Register a device](/codemash/cloud/push/devices.md#do-it-from-code) — your app sends the device token of a signed-in user to Norbix (SDK `registerDevice`). A user with no device cannot get a push.
2. [Check the integration](/codemash/cloud/push/integrations.md) — after **ENABLE** the Fake **Test Me** is the default; connect [APNs](/codemash/cloud/push/integrations/providers/apns.md) or [Firebase](/codemash/cloud/push/integrations/providers/fcm.md) for real devices.
3. [Create a template](/codemash/cloud/push/templates/editor.md) — for example `Order shipped`: title `Your order is on its way`, body `Hi @Model.FirstName, order @Model.OrderNumber left our warehouse today.` Add a [translation](/codemash/cloud/push/templates/translate.md) for every project language.
4. [Send a test](/codemash/cloud/push/templates/test-send.md) to one user or one device from the template's **Test** panel.
5. [Create a campaign](/codemash/cloud/push/campaigns/new.md) — pick the audience, the template and the provider, press **Send** — then read its [details](/codemash/cloud/push/campaigns/details.md) and [message log](/codemash/cloud/push/campaigns/log.md).

Push can also be sent by a trigger: in a Membership, Files, Payments or Database collection trigger, choose the action **Send Push Notification** and fill the same template, language, "on behalf of" and provider fields as on a campaign. A new trigger starts enabled. See [Triggers](/codemash/cloud/concepts/triggers.md).

## Use it from code

Every **Do it from code** block in the Push pages uses this client. Install `@norbix.ai/ts` (see [SDK install](/codemash/sdks/install.md)) and set `NORBIX_API_KEY` to a project API key.

```ts
import { Norbix } from '@norbix.ai/ts';

const projectId = 'pr_1VjbjzoHqA7c2ErGtQ8O4g';
const norbix = new Norbix({ projectId }); // the key comes from NORBIX_API_KEY

const { list } = await norbix.hub.notifications.getPushTemplates();
console.log(list.items.map((t) => `${t.templateName} (${t.type})`));
// [ 'Password changed (Transactional)', 'Old promo (Marketing)', 'Appointment reminder (Transactional)', … ]
```

The CLI lines use the generic `norbix hub …` commands of `@norbix.ai/cli` (signed in with `norbix login`, project id in `NORBIX_PROJECT_ID`):

```sh
norbix hub notifications push templates get
```

{% hint style="info" %}
The client sends the project id with every call (the `norbix-project-id` header), so the requests do not repeat it. The CLI does the same with the project of `norbix login --project …`, `norbix config set projectId …` or `NORBIX_PROJECT_ID`. The shorter `norbix push …` commands work too, for example `norbix push templates`.
{% endhint %}

## Related

[Campaigns concept](/codemash/cloud/concepts/campaigns.md) · [Message templates concept](/codemash/cloud/concepts/message-templates.md) · [Tokens binding](/codemash/cloud/concepts/tokens-binding.md) · [Triggers](/codemash/cloud/concepts/triggers.md) · [SDK](/codemash/sdks/notifications/push.md) · [CLI](/codemash/cli/reference/push.md) · [API](/codemash/api-reference/notifications/push.md)
