How personalization works
You can add custom data into messages, templates, Journey Webhooks, and Event Streams using Liquid syntax. Data can be sourced from:- Data feeds: Real-time data from your APIs.
- Custom Events: Real-time user events for personalizing Journey messages.
- Properties & Tags: Built-in user, journey, message, template, app, or org values.
- API:
custom_data: Custom data you pass directly into our Create Message API. - Dynamic content: CSV-based personalization via dashboard uploads.
Key considerations
Personalization helps users connect deeper with your app, potentially increasing engagement and revenue. Common examples are putting the person’s name or specific information (like abandoned cart items) in a message but the use cases are endless. What is the goal? What do you want to send in the message? Examples:- Add a user property like name or ID
- Show invoice or OTP
- Send dynamic content from a CSV
- Is the data stored in OneSignal like a property or a tag?
- Is the data stored in your own database?
- Do you need to pass data from your backend to OneSignal?
- One-time messages: Send the message from your server or through the OneSignal dashboard?
- Recurring messages: Using Journeys or other automated workflows?
- Goal: Send a one-time-passcode to help a user login.
- Data:
- OTP stored on your backend.
- User name store in OneSignal as a tag.
- External ID stored in OneSignal as a property.
- Send:
- From your server using our REST API.
- From an automated workflow using Journeys.
A details walkthrough of this example is available in the Verification, Magic Link, & OTP example tutorial.See more Tutorial examples below.
Data sources
Available options for personalization.Dynamic Content
This current guide on personalization explains how to add dynamic content to your messages, templates, Journeys, and Event Streams. OneSignal also provides a way of uploading a CSV of data to customize the messages based on data from your own database. See Dynamic Content for more details.Data feeds
Data Feeds are a way to pull real-time data from your APIs directly into messages at send time. Just connect a template to your data source and we will pull the data from your server and inject it into the message.Custom Events
Reference Custom Events within Templates used in Journeys. Depending on the Journey configuration, it may store one or more Custom Events on behalf of the user. You can use Liquid syntax to display properties of these stored events, or to conditionally display parts of your message based on the events.- Event-triggered Journeys will store the event that caused the user to enter the Journey
- Any Journey using Wait Until nodes will store Custom Events when they match a condition.
- Custom Event Properties
- Example Custom Event Structure
- Using Events in Templates
journey.first_event
For Event-triggered Journeys, this will always be the event that caused the user to enter the Journey.If the Journey’s entry rule is not event-triggered, then this will be the first event matched by a Wait Until condition.
journey.last_event
The most recent Custom Event stored. If there is only one stored custom event, then
first_event and last_event will return the same thing.journey.event.most_recent_event_name
The most recent event with a given name (replace
most_recent_event_name with the name of the event you want to reference). If the same event is used multiple times, this will return the most recent instance. Example: purchase.For special characters (e.g. spaces), use hash notation if the event name contains non-alphanumeric characters. For example, if the event name is “order status”, you can reference it with
journey.event["order status"].Properties
Predefined fields saved in OneSignal.Properties are not available to substitute within In-App Messages or Live Activities.
User & Subscription properties
Follow the provided steps based on where you need to access the data.- Properties available in messages & templates
- Properties available in Journey Webhooks & Event Streams
Use the If you have tags
subscription object to access properties at the Subscription level in messages and templates. Tags can also be accessed directly via the key name. For example:first_name: Jon and level: 5 for User A and first_name: Jeff and level: 100 for User B, each will see their name and level in the message. Otherwise, they’ll see the default values.subscription.external_id
The External ID associated with the Subscription.
subscription.email
The email address of the email Subscription being sent the message.
subscription.phone_number
The phone number of the SMS Subscription being sent the message.
subscription.language
The language code of the user.
subscription.unsubscribe_token
The token used with the Unsubscribe email with token API.
liquid
Journey properties
Thejourney object is helpful for tracking the Journey name or referencing Custom Events within Templates used in Journeys.
journey.name
The name of the Journey.
JSON
Message properties
Themessage object is helpful for accessing custom_data sent from your backend or for tracking properties of the message with Event Streams.
message.id
The OneSignal message ID.
JSON
message.name
The name of the message.
JSON
message.template_id
The OneSignal template ID.
JSON
Template properties
Thetemplate object is helpful for accessing details about the Template used to send the message.
template.id
The OneSignal template ID.
JSON
template.name
The name of the template.
JSON
OneSignal properties
Theapp and org objects are helpful for accessing details about the App and Organization that sent the message.
app.id
The OneSignal App ID.
JSON
app.name
The name of the OneSignal App.
JSON
org.id
The OneSignal Organization ID.
JSON
org.name
The name of the OneSignal Organization.
JSON
API custom_data
Add personalization directly from your backend using custom_data and our Create message API.
Steps:
- Create a template
- Use Liquid Syntax with format
{{ message.custom_data.key }} - Send API request with the
custom_dataobject andtemplate_id
Example: Flat JSON
Template
API Request
Customer sees:
- “Your invoice for Widget is ready.”
- The final URL:
https://your-domain.com/invoice=463246732
Example: Array data
Template
API Request
Customer sees:
- “Your sweater is waiting for you!”
- The image:
https://.../sweater.png
Example: Bulk personalization
To personalize a single message for many users in one request:Template
API Request
Customer sees:
- “Hi John, you have 150 points. Your level is Gold.”
- “Hi Sarah, you have 200 points. Your level is Platinum.”
Tutorials
Verification, Magic Link, & OTP example tutorial
Send verification emails, magic links via SMS, One Time Passwords or custom URLs.
Abandoned cart content
Send lists of data to users like in an abandoned cart or leaderboard.
Transactional messages
Send any type of transactional message across any channel.
In-app message examples
Display personalized in-app messages based on tags.