Mobile Push: instructions for developers
This documentation is a comprehensive guide for configuring and managing mobile push-related events in the Meiro system.
Prerequisites for Mobile Push To work with mobile push, ensure that the following prerequisites are met:
|
1. Custom data payload
In addition to standard push notification content, you have the option to send a custom data payload together with the mobile push content, giving you more flexibility and customization options. For example, you may want to specify:
- a unique URI with the attribute placeholder in the value
- some required category within a list of values
- a current timestamp once it’s created or sent
To implement the custom data payload, configure a schema on the MP channel settings, which defines the structure of the custom data payload. The schema is configured using JSON format and should include definitions for each custom data field, specifying its title, default value (if applicable), enum, and type.
The custom data payload is rendered as a form that is dynamically adjusted based on the schema configuration, allowing for effective visualization and customization of the payload.
After configuring the custom data payload, it is stored and sent together with the current data object for mobile push campaigns.
Remember: You can personalize fields using the LiquidJS template language. For instance, apply this language inside the default value to dynamically prepopulate the known values for each profile.
Example of custom data schema
To provide a comprehensive illustration of implementing a custom data payload schema, let's delve into an example with various data types and configurations:
{
"type": "object",
"properties": {
"category": {
"type": "string",
"title": "Category",
"default": "ESSENTIAL",
"enum": ["ESSENTIAL", "BOOKING_INSPIRATIONAL", "INSPIRATIONAL"]
},
"createdAt": {
"type": "string",
"title": "Created At",
"format": "date-time"
},
"requireUserConfirmation": {
"type": "boolean",
"title": "Require user confirmation",
"default": true
},
"bookingUri": {
"type": "string",
"title": "Booking",
"description": "Booking ID"
}
},
"required": ["category", "requireUserConfirmation", "bookingUri"]
}
In this example:
-
Category is defined as a string representing the notification category. Enumerated values such as "ESSENTIAL," "BOOKING_INSPIRATIONAL," and "INSPIRATIONAL" are allowed. If no value is provided, the default is set to "ESSENTIAL."
-
CreatedAt is a
datetime
string that serves to order notifications in the in-app notification center. -
Require User Confirmation is a
boolean
flag that determines whether user confirmation is necessary for displaying the notification within the application. By default, it's set to true. -
Booking URI is a string specifying where we’ll have to use
bookingId
from the attribute value.
Remember: When creating a custom data schema, avoid using any reserved words, including action
, url
, from
, notification
, message_id
, message_type
, or any word starting with google
or gcm
in custom key-value pairs. For further guidance, refer to the comprehensive documentation available here.
Any custom data you wish to send can also be included within the data
object. Remember, all values must be strings, and nested objects are not supported. For example:
{
"data": {
"action": "browser",
"url": "https://www.example.com",
"message_id": "593ebbb4-8a1c-4ale-blOd-16cdf2413cdb",
"category": "ESSENTIAL",
"createdAt": "2024-08-15T12:00:00Z",
"requireUserConfirmation": "true",
"bookingURI": "https://example.com/booking"
}
}
2. Implementing Deep Links in Mobile Apps
Deep linking lets you send users directly to specific pages or content within your mobile app, enhancing the user experience and increasing engagement.
Here are key issues you need to consider in implementation:
- To implement deep links, you need to set them up in the mobile app. Register the app's deep links to target specific screens or content within your app that you wish to make accessible through deep linking. For further details, refer to the provided article.
- Once you've added the deep link to the mobile push data and your users interact with the push notification, the app will automatically redirect them to the registered deep link and open the specified screen.
Remember: after configuring the deep links, test them to ensure they are working as expected.
To enable deep linking, include the relevant URL within the action
object of the FCM message. This URL will direct users to specific pages or content within the app when they interact with the notification. Here’s an example:
{
"data": {
"action": "deeplink",
"url": "yourapp://specific_page"
"message_id": "593ebbb4-8a1c-4ale-blOd-16cdf2413cdb",
}
}