> For the complete documentation index, see [llms.txt](https://aidocs.thunkable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aidocs.thunkable.com/features/api/push-notifications-with-onesignal.md).

# Push Notifications with OneSignal

### Overview <a href="#overview" id="overview"></a>

Push notifications are one of the biggest advantages of mobile apps over mobile websites since they can send messages to users without the app being open.

When a user first opens an app with push notifications enabled they receive an alert prompting them to enable push notifications. Once they accept they are a subscriber of your app's push notifications.

### Thunkable + OneSignal <a href="#thunkable--onesignal" id="thunkable--onesignal"></a>

Thunkable utilizes the services of [OneSignal](https://onesignal.com/) to facilitate push notifications from your app. OneSignal is a free service that supports unlimited devices and notifications. You can learn more about their features here: [OneSignal pricing page](https://onesignal.com/pricing).

To send push notifications to your app's users, you must link your Thunkable app to your OneSignal apps (iOS and/or Android). Once you've added your OneSignal App IDs into Thunkable, the work in Thunkable is done, and the remainder of the management takes place in third-party platforms (OneSignal, Apple Developer, and Firebase, depending on the platform).

### Push Notification Best Practices <a href="#push-notification-best-practices" id="push-notification-best-practices"></a>

Notifications that are irrelevant and too frequent are often dismissed or blocked. We highly recommend sending notifications only when the content is relevant to the user. Examples include an e-commerce app letting the user know about a sale, or a game app letting the user know about a new level or feature.

### Create a OneSignal Account <a href="#create-a-onesignal-account" id="create-a-onesignal-account"></a>

1. Go to [**OneSignal**](https://onesignal.com/).
2. Click **Sign Up**.
3. Create your account and complete the OneSignal onboarding.

### Create a OneSignal App <a href="#create-a-onesignal-app" id="create-a-onesignal-app"></a>

1. If you didn't create an app as part of the OneSignal onboarding, navigate to your OneSignal dashboard and click **+ New App/Website**.
2. Enter your **app name**. We recommend including the platform in your app name, for example, Employee Directory - Android or Employee Directory - iOS.
3. Select **Apple iOS (APNs)** or **Google Android (FCM)**.
4. Click **Next: Configure Your Platform**.
5. Follow the platform-specific configuration instructions below.
   1. Android Configuration
   2. iOS Configuration

### Android Configuration <a href="#android-configuration" id="android-configuration"></a>

A Google Service Account is a special type of account from Google that applications use to make authorized calls to a variety of APIs, including Firebase Cloud Messaging APIs. For more details, see Google's own [documentation on Service Accounts](https://cloud.google.com/iam/docs/service-account-overview). In order to send push notifications to Android devices, you will need a Service Account to generate a private key for OneSignal to utilize.

1. If you don't already have one, create a [**Firebase**](https://firebase.google.com/) account. Instructions for getting started with Firebase are available here: [Firebase Account Setup](https://docs.thunkable.com/sign-in#getting-started).
2. Follow OneSignal's instructions to generate Firebase Cloud Messaging API Credentials for sending Android App Notifications here: [Android: Firebase Credentials](https://documentation.onesignal.com/docs/generate-a-google-server-api-key).

   To continue sending messages in 2024, you need to provide updated authentication credentials from Firebase for all apps created in OneSignal before September 1, 2023:

   1. In your Firebase project, go to **Project settings** and the ***Service accounts*** tab to download your private key JSON.
   2. In your OneSignal App Settings, upload the private key file you just downloaded

   More information on these steps is available here: [Android: Firebase Credentials](https://documentation.onesignal.com/docs/generate-a-google-server-api-key).
3. Select **Native Android** as your target SDK.
4. Click **Save & Continue**
5. Copy **Your App ID**.

#### Android Testing <a href="#android-testing" id="android-testing"></a>

To test Android push notifications, download the app to your Android device and send a test message through OneSignal to see the push notification in action.

### iOS Configuration <a href="#ios-configuration" id="ios-configuration"></a>

#### Generate a p8 Certificate <a href="#generate-a-p8-certificate" id="generate-a-p8-certificate"></a>

1. Follow OneSignal's instructions to generate a p8 certificate: [iOS: p8 Token-Based Connection to APNs](https://documentation.onesignal.com/docs/establishing-an-apns-authentication-key).
2. When you get to the section titled "Provisioning Profiles," return to these instructions.

#### Add Push Notifications to the App Identifier <a href="#add-push-notifications-to-the-app-identifier" id="add-push-notifications-to-the-app-identifier"></a>

1. In your Apple Developer account, select **Identifiers** under the Certificates, IDs & Profiles heading.
2. Select your app from the list of Identifiers.
3. Scroll down the list of app capabilities, and place a checkmark next to **Push Notifications**.
4. Click **Save**.
5. Select your app from the list of Identifiers again.
6. Scroll down the list of app capabilities, until you get to **Push Notifications** again.
7. Click the associated **Configure** button.
8. Under Production SSL Certificate, click **Create Certificate**.
9. Under Upload a Certificate Signing Request, click **Choose File**.
10. Select the **Certificate Signing Request (CSR)** you downloaded from Thunkable as part of the publishing process.
11. Click **Continue**.
12. Click **Download** to download your iOS certificate.

#### Download your Provisioning Profile <a href="#download-your-provisioning-profile" id="download-your-provisioning-profile"></a>

1. Access your Apple Developer account’s [Profiles](https://developer.apple.com/account/resources/profiles/list).
2. Select your app from the list of Profiles.
3. Click **Edit**.
4. Click **Save**.
5. Click **Download**.

#### OneSignal <a href="#onesignal" id="onesignal"></a>

1. In OneSignal, select **Native iOS** as your target SDK.
2. Click **Save & Continue**.
3. Copy **Your App ID**.

#### Generate a Provisioning Profile <a href="#generate-a-provisioning-profile" id="generate-a-provisioning-profile"></a>

You require a new provisioning profile with push notifications enabled to publish to the App Store. See OneSignal's instructions here: [Generate a Provisioning Profile](https://documentation.onesignal.com/docs/establishing-an-apns-authentication-key#create-your-profile).

#### iOS Testing <a href="#ios-testing" id="ios-testing"></a>

To test iOS push notifications, you have to publish to TestFlight. This requires the provisioning profile with push notifications enabled.
