> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reyapp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Push Notifications and In-App Messages with OneSignal

> Connect OneSignal to Rey to send push notifications, in-app messages, and automated campaigns to your users — no server code, no APNs certificates, no Firebase setup required.

OneSignal is the leading push notification and messaging platform used by over a million apps to re-engage users, drive retention, and send transactional alerts. Connecting OneSignal to Rey lets you send push notifications, in-app messages, and automated campaigns to your users from a single dashboard — without writing server code or wrestling with APNs certificates and Firebase Cloud Messaging setup.

## What OneSignal Does

OneSignal handles the entire delivery pipeline for user messaging: push notifications on iOS and Android, in-app messages that appear while users are using your app, email, and SMS. It also gives you audience segmentation, A/B testing, automated journeys, and delivery analytics out of the box. The free tier supports unlimited mobile push notifications, so you can ship without worrying about cost.

## Prerequisites

Before connecting OneSignal to Rey, make sure you have:

* A [OneSignal account](https://onesignal.com) with an app created for your Rey project.
* Your **OneSignal App ID** and **REST API Key** — find them in OneSignal under **Settings → Keys & IDs**.

## Connect OneSignal to Rey

<Steps>
  <Step title="Create a OneSignal app">
    Log in to [OneSignal](https://onesignal.com) and click **New App/Website**. Give it a name that matches your Rey project. When prompted for a platform, select **Apple iOS** and/or **Google Android** — you can add both to a single app.
  </Step>

  <Step title="Configure platform credentials">
    OneSignal walks you through setting up the platform credentials it needs to deliver notifications:

    * **iOS**: OneSignal generates and manages the APNs authentication key for you — no manual certificate handling required.
    * **Android**: OneSignal provisions Firebase Cloud Messaging (FCM) credentials automatically.

    Rey handles the client-side SDK setup as part of the build — you don't need to modify any native code.
  </Step>

  <Step title="Copy your App ID and REST API Key">
    In OneSignal, navigate to **Settings → Keys & IDs** and copy both the **OneSignal App ID** and the **REST API Key**.
  </Step>

  <Step title="Enter your credentials in Rey">
    In the Rey editor, open the **Integrations** panel, select **OneSignal**, and paste your App ID and REST API Key into the corresponding fields.
  </Step>

  <Step title="Save and verify the connection">
    Click **Save**. Rey activates the OneSignal integration and registers every new app session as a subscribed device. A green status indicator appears on the OneSignal card in the Integrations panel. Open your OneSignal dashboard and check **Audience → Subscriptions** — you should see your test device appear within a few seconds of your next app launch.
  </Step>
</Steps>

<Warning>
  Your REST API Key is a secret. Never share it publicly or commit it to source control. Rey stores it encrypted and only uses it server-side to send messages on your behalf.
</Warning>

## Send Your First Push Notification

Once connected, send a test notification straight from the OneSignal dashboard:

1. In OneSignal, go to **Messages → New Push**.
2. Enter a title and message body.
3. Under **Audience**, select **Test Users** and add your device.
4. Click **Review & Send**.

You should see the notification arrive on your device within seconds. From here you can target broader audiences, schedule sends, or trigger notifications from user actions.

## Trigger Notifications from Rey Actions

Rey lets you send OneSignal notifications directly from any action — for example, when a user submits a form or completes a purchase.

1. In the Rey editor, select the component that should trigger the notification (a button, form submit, etc.).
2. Open the **Logic** tab in the property toolbar, choose a trigger, and add a **Send Push Notification** action.
3. Choose a target: the current user, a segment, or a custom filter.
4. Enter the title and body. Use variables like `{{user.name}}` to personalize the message.
5. Save. The notification fires the next time that trigger runs.

<Tip>
  Use OneSignal **segments** to group users by behavior (for example, "users who opened the app in the last 7 days") and target notifications precisely. Segments update automatically as users' behavior changes.
</Tip>

## Send In-App Messages

In-app messages appear while users are actively in your app — perfect for onboarding tips, promotions, or feature announcements without interrupting the experience with a push notification.

1. In OneSignal, go to **Messages → In-App → New In-App**.
2. Design your message using OneSignal's visual editor.
3. Set a trigger — for example, when a user reaches a specific screen or performs a tagged action.
4. Set your audience and click **Make Active**.

Rey automatically syncs screen views and user tags to OneSignal, so your triggers work out of the box.

## Identify Users and Add Tags

To target notifications by user attributes (subscription tier, signup date, favorite category, etc.), tag your users from Rey.

1. Select any component or interaction in the Rey editor.
2. Add a **Set User Tags** action.
3. Provide key-value pairs, such as `plan: pro` or `signup_source: referral`.

Those tags appear on the user's OneSignal profile immediately and can be used in segments, targeting, and automations.

<AccordionGroup>
  <Accordion title="Do I need to configure APNs or Firebase myself?">
    No. OneSignal manages APNs and FCM credentials for you, and Rey handles the SDK setup as part of the build. You only need to connect your OneSignal account with the App ID and REST API Key.
  </Accordion>

  <Accordion title="Can I A/B test notification content?">
    Yes. OneSignal supports A/B testing on both push notifications and in-app messages. Create multiple variants when composing a message and OneSignal automatically splits your audience and reports the winner based on open or conversion rate.
  </Accordion>

  <Accordion title="How much does OneSignal cost?">
    OneSignal's mobile push notifications are free for unlimited devices. Paid plans unlock advanced features like journeys, higher email volume, and priority support. See [onesignal.com/pricing](https://onesignal.com/pricing) for current tiers.
  </Accordion>

  <Accordion title="Is OneSignal GDPR compliant?">
    Yes. OneSignal is GDPR- and CCPA-compliant and offers EU data residency for customers who need it. Rey does not require any additional configuration — just use the App ID from your EU-region OneSignal app.
  </Accordion>
</AccordionGroup>
