Translate and send OneSignal push notifications with Gridly

Are you a mobile app developer with an international user base? Learn how to effectively communicate with your users by translating and sending OneSignal push notifications using Gridly.
Localization
Automation
Development
 11-11-2024        Quang Pham, Norbert Szolnoki
Translate and send OneSignal push notifications with Gridly

Push notifications are a crucial communication tool for mobile apps, helping developers keep users informed. For apps with a global user base, localizing push notifications in multiple languages can be challenging and time-consuming. In this guide, we show you how to automate the translation and distribution of multi-language push notifications using Gridly and OneSignal—streamlining the process and ensuring timely delivery of messages to users in their preferred language.

What’s covered:

Setting up OneSignal push notifications

Here is how we set up OneSignal push notifications for your mobile application:

Step 1. Create an account: Sign up for an account here.

Step 2. Create a new app: With your new account create a new OneSignal app and choose your preferred channel. For this article, we will use Google Android (FCM).

OneSignal push notifications set up step 1

Step 3. Upload Service Account JSON: Retrieve your Service Account JSON file from Firebase Console. Refer to this OneSignal guide for detailed instructions.

OneSignal push notifications set up step 2

Step 4. Select SDK: Choose Native Android as your SDK.

OneSignal push notifications set up step 3

Step 5. Install OneSignal Android SDK: Follow this guide to install the OneSignal Android SDK on your mobile app. After installation, OneSignal will be able to detect the user’s operating system language and save it as their language preference.

Step 6. Retrieve credentials: You can also find your OneSignal API key and App ID in Settings > Keys & IDs. This information is unique to you and should be kept private.

OneSignal push notifications set up step 4

Automating translation and API request swith Gridly

To achieve our goal, we need to configure two Automations in Gridly capable of:

  • Translating notification content
  • Sending source and translated content as requests to the OneSignal API

First, sign up for a 14-day free trial Gridly account. This will grant you access to the necessary features for this tutorial. Next, create a new project and your first localization Grid. Add your source language and target languages. Make sure to cover all the major languages of your users.

OneSignal push notifications set up step 5

Inside your Grid, create the first Automation to translate content:

  1. Select Record updated as the trigger, watching the source language column.
  2. Select Google loc translate. Add the source language and target language columns.

OneSignal push notifications set up step 6

Activate and verify if the automated translation works by inserting content into the source language column. If it works correctly, we can move on to the second Automation:

  1. Select Manual record trigger as the trigger.
  2. Select Send web request and configure the settings:

OneSignal push notifications set up step 7

  • Payload: Structure the payload as follows. The “app_id” value is your OneSignal App ID. “contents” includes the language codes of source and target languages, then select corresponding columns as values.

OneSignal push notifications set up step 8

To run this Automation, right click on the row containing your notification, click Run Automations and select it from the list.

OneSignal push notifications set up step 9

Sending multi-language push notifications

  1. Enter your message in the source language column of the Gridly interface or via the Gridly API.
  2. The first automation will translate the content into the target languages.
  3. Run the second automation to send the source and translated content to OneSignal.
  4. OneSignal push notifications will be distributed based on the user’s system language (e.g., English users receive “en” content, Polish users receive “pl” content).

OneSignal push notifications and Gridly workflow diagram

Let’s send a sample notification. Enter the message in your source language field.

When the translation is complete, run the web request Automation. Users will receive notifications based on their system language.

OneSignal push notifications and Gridly workflow diagram

Final thoughts

In this article, we have built a workflow in Gridly to automate the translation and sending of OneSignal push notifications to your mobile app users. It reduces the time and efforts needed for manual translation and distribution. To improve upon this result, consider these next steps:

  • Using GPT-4o or DeepL automation action to enhance translation quality.
  • Customizing OneSignal push notifications with headers, app icons, images, etc. Images can be stored using CDN in Gridly.
  • Creating different user segments in OneSignal for better content targeting.

Localization tips & trends, delivered.

Get the latest posts in your email