Send transactional push notifications to end users
Transactional messages are communications that contain important, personalized information that are not promotional in nature. Example: Payment details, appointment reminders, and account updates.
Mobile push is an important channel to deliver these transactional messages. It ensures that end users receive timely updates, alerts, and confirmations directly on their devices. Because the notifications are displayed instantly, push notifications are effective for such critical communications.
It is important to set up transactional push notifications correctly to make sure that they are sent only to authorized devices. This tutorial explains how to implement push notifications in your mobile application, including SDK setup and API integration. It also includes setting up failover and getting delivery reports, and provides best practices for finance organizations.
Products and channels
Prerequisites
-
Infobip account. If you do not have an account, sign up (opens in a new tab) for a free account. For more information, see Create an account.
-
The following products enabled in your Infobip account:
-
Moments: Required for Mobile push and In-app messages. When you enable Moments, Mobile push and In-app messages is automatically available.
To enable Moments, follow the instructions in the Moments documentation.
-
Mobile push: Automatically available when Moments is enabled.
-
SMS: Use as a failover channel.
-
Process overview
-
Set up the mobile application profile and the application code.
-
Integrate with Mobile SDK. Follow all the steps in the quick start guides for the relevant platforms.
-
Install the mobile application on a device and launch the application.
The Mobile SDK initializes, obtains a push token, and creates an anonymous profile in People.
-
Create a broadcast to test sending and delivery of push notifications to the profile that was created.
-
Set up mobile user identification.
-
Send the Push notification over API.
-
Get delivery reports to check whether the Push notification has been delivered to the end user.
-
Configure failover to SMS for cases where the Push notification is not delivered.
Implementation steps
Set up the mobile application profile
The most important entity for mobile application communication is the application profile. It contains the configuration and settings of your mobile application for all supported operating systems. So, start by creating the application profile.
To test use cases before integrating Mobile SDK in your application, use Infobip's Demo app.
To create the application profile, do the following:
- Go to Channels and numbers > Channels > Mobile applications.
- Select Create app profile > Create custom app profile.
- Create a mobile application profile.
- Select an application profile type - Sandbox or Production.
- To enable push notifications for the profile, enter the credentials for each of the selected environments - iOS, Android, and Huawei.
- Get the application code.
For more information, refer to the Create and enable a mobile application profile documentation.
Integrate with Mobile SDK
Implement the SDK
After you get the application code, you can start integration with Mobile SDK. Use the following quick start guides to implement the SDK on either mobile platforms or for cross-platform plugins:
- iOS guide (opens in a new tab)
- Android guide (opens in a new tab)
- Huawei guide (opens in a new tab)
- React Native guide (opens in a new tab)
- Flutter guide (opens in a new tab)
- Cordova guide (opens in a new tab)
Follow all the steps in these guides to make sure that the setup is correct and to get push notifications on mobile devices.
Install and launch the mobile application
After successfully integrating Mobile SDK, you need to install the mobile application on a device and launch it. The Mobile SDK initializes, obtains a push token, and creates an anonymous profile in People.
The Mobile SDK in People does the following:
- When an end user logs into the mobile application, their device information and push notification token are linked with their profile. The profile changes from Anonymous to Customer.
- If the end user logs out from the mobile application, the device information and push notification token are removed from their profile. The profile changes from Customer to Anonymous.
For more information about mobile audience profiling and the mobile user life cycle on the Infobip platform, refer to the Track mobile users lifecycle documentation.
Create a broadcast to test push notifications
Create a broadcast to send push notifications to the profile created by the Mobile SDK.
The push notifications are delivered using the end users' unique customer ID or contact information such as email or phone number. This ensures that the notifications are sent to the correct end user and on the correct device.
Set up mobile user identification
Next, you need to set up mobile user identification.
The following guides show the schema to implement personalization for mobile apps with authorization. They also show how to target the primary device of an authorized user who has multiple devices associated with their profile.
- iOS (opens in a new tab)
- Android (opens in a new tab)
- Huawei (opens in a new tab)
- ReactNative (opens in a new tab)
- Flutter (opens in a new tab)
- Cordova (opens in a new tab)
The schema is recommended for banking and financial apps but is also applicable to other mobile apps with authorization.
Send the Push notification over API
After you set up the mobile SDK with user identification, you can integrate it with the API.
- Create an API key with the following scope: mobile-app-messaging:send.
- In the Send push notifications (opens in a new tab) API, configure the following parameters:
- sender: Application code of your application profile.
- destinations: Set the type as
EXTERNAL_USER_ID
. Use theExternalUserID
of the end user whom you want to target. - targetOnlyPrimaryDevices: Set this parameter to
true
to target only devices that are set as primary. If there are no devices marked as primary for the end user with the assignedExternalUserID
, the push notification is not sent. If you set targetOnlyPrimaryDevices tofalse
or do not set this parameter, the push notification is sent to all devices associated with a customer profile. - content: Configure the message content.
- validityPeriod: By default, the validity period for push notifications is 48 hours. For time-sensitive push notifications, if you want to use failover to another channel, configure the validity period between 40 seconds and 2 minutes.
- showMirroredPush (Optional): If the end user has the application open, mirror the push notification in the app.
- inboxTopic (Optional): Save the push notification messages in the application Inbox.
The API configuration should be as shown in the following example:
{
"messages": [
{
"sender": "F5E6B95AFBEDEC426344318E1BD3D42E",
"destinations": [
{
"externalUserId": "external-user-id",
"type": "EXTERNAL_USER_ID",
"targetOnlyPrimaryDevice": true
}
],
"content": {
"title": "Payment Received!",
"text": "You've received a payment of $[amount]. Check your balance in the app",
"type": "TEXT"
},
"options": {
"validityPeriod": {
"amount": 50,
"timeUnit": "SECONDS"
}
}
}
]
}
Set up failover to another channel
In some cases, mobile push notifications might not be delivered because of device connectivity issues or notification settings on the end user's device. To ensure delivery, use a different channel as a failover. SMS is a reliable option because it is less dependent on internet connectivity and has higher delivery rates.
To set up failover, do the following:
- Get the delivery status of the push notification.
- If the status is not DELIVERED or Expired, use the failover option.
Get the status of the push notification
You can get the delivery status in one of the following ways:
Set up a webhook for sent messages
Do the following:
- To set up a webhook in the API request, add the
webhooks
object to the Send Push notifications (opens in a new tab) API. Configure the API as follows:- Add the
url
for the delivery report. - Set the
notify
parameter totrue
.
- Add the
- Set up your callback server to identify whether the delivery status for the push message is EXPIRED. Use the Receive Push delivery reports (opens in a new tab) API.
Create a subscription for the Delivery event
Do the following:
- Create a subscription to receive the DELIVERY event for the Mobile push channel over either the Infobip web interface (opens in a new tab) or API (opens in a new tab).
- Set up your callback server to identify whether the delivery status for the push message is either not delivered or not delivered at the required time.
Get delivery reports over API call
If you are unable to receive real-time delivery reports to your endpoint, use the Get Push delivery reports (opens in a new tab) API to determine if the message was delivered at the required time.
Use the messageId
parameter to specify the message for which you want the delivery report.
Send the message over SMS
If the status of the message is not DELIVERED or Expired, use the Send SMS (opens in a new tab) API to send the same message content to the phone number associated with the mobile application user.
The API configuration should be as shown in the following example:
{
"messages": [
{
"sender": "InfoSMS",
"destinations": [
{
"to": "41793026727"
}
],
"content": {
"text": "You've received a payment of $[amount]. Check your balance in the app"
}
}
]
}