Mobile Push and In-App Messages
Send mobile push over API

Send Mobile Push over API

Infobip provides a robust API to send Mobile push messages and get analytics. You can use this API for transactional, informational, and promotional use cases.

Send Mobile Push over API

Use the Send Push notifications (opens in a new tab) method to send Mobile push messages to one or more recipients. The unified structure of the API across all channels enables you to integrate it with your app. The mobile push parameters enable you to target either a specific mobile application user or to a segment of users.

Configure the fields as follows.

Sender

The identifier of the application profile. Use the Application code or Application ID of the application profile that you create in the Infobip web interface.

Destination

To send a Mobile push message to a single recipient, use one of the following parameter types:

  • External user ID
  • Email
  • Phone number
  • Registration

To send a Mobile push message to multiple recipients, use Multiple.

For more information, refer to the relevant sections on this page.

Target single recipient with non-personalized device

A non-personalized device is an end user's device that is not associated with any of the personalized standard attributes (External user ID, email, or phone number).

To send a Mobile push message to a non-personalized device, do the following.

  • Specify REGISTRATION as the destination type.
  • Specify the Push registration ID. This value is available by default on all installations of the mobile application.

Code sample

json
    "destinations": [
	{
	"pushRegistrationId": "DBE0B0B6-668E-491E-8EE8-2A3DB2C71CBE",
	"type": "REGISTRATION"
	}
	]

Push registration ID

The following table shows information about the Push registration ID.

Destination parameterTypeDescription
pushRegistrationIdStringThe unique identifier of a specific application instance-device combination.

This parameter can be collected over Mobile SDK.

For more information, refer to the following documentation.
Android
iOS
Huawei
Flutter
React Native
Cordova

Target single recipient with personalized device

A personalized device is an end user's device that is associated with one or more of the personalized standard attributes (External user ID, email, or phone number).

Use the following destination address types.

Destination parameterTypeDescription
externalUserIdStringExternal user ID set in the Person Profile.
phoneNumberStringMSISDN in international format. Example: 41793026727.

This value is available in the Contact information tab of the end user's Person profile in People.
emailStringEmail address of the end user.

This value is available in the Contact information tab of the end user's Person profile in People.

These address types are not available by default. You must define them either in the Mobile SDK or the People API.

Code sample

json
    "destinations": [
	{
	"externalUserId": "customer_21234",
	"type": "EXTERNAL_USER_ID"
	}
	]
Note

If multiple devices are linked to a person profile by using externalUserId, phoneNumber, or email, the push notification is delivered to all the devices by default.

To send push notifications only to the primary device, use the parameter <targetOnlyPrimaryDevices> in the <destinations> section.

Target multiple recipients by using AND operator

To send a Mobile push message to multiple recipients, do the following.

  • Specify MULTIPLE as the destination type.
  • Specify multiple values for the destination parameter by using the <and> operator.

Code sample

json
    "destinations": [
     {
        "$and": [
          {
             "externalUserId": "customer_21234"
           },                   
 
           {
             "externalUserId": "customer_21235"
           },
 
         ]
         "type": "MULTIPLE"
 
     }
]

Target multiple recipients by using device attributes

You can target multiple recipients based on the device attributes.

These destination address types are enabled by default.

NameTypeDescription
platformStringAccepted values are Android or iOS.
sdkVersionStringSDK Version that can be found on GitHub.
Mobile SDK Android releases
Mobile SDK iOS releases
Mobile SDK Huawei releases

Releases of plugins for:
Flutter
React Native
Cordova
osVersionStringOperating system version.
deviceManufacturerStringDevice manufacturer:
iOS - Apple
Android. Example: Samsung, Asus.

The value for a specific installation can be found in the Contact information tab > Mobile applications section of a person profile in People.
deviceModelStringDevice model. Example: iPhone 6, iPhone 5s (GSM+CDMA), LG-D855. For more information about iOS device models, refer to List of iOS models (opens in a new tab).

The value for a specific installation can be found in the Contact information tab > Mobile applications section of a person profile in People.
applicationVersionStringApplication version.
osLanguageStringThe language that is set on the mobile device. This parameter can be overridden by application logic.
deviceSecureBooleanIs biometric authentication or passcode set for the device.
notificationsEnabledBooleanSet to true to target only the devices in which the end user has enabled notifications for the mobile application.

The following destination address types are not available by default. You must define them over Mobile SDK.

NameTypeDescription
{custom field}StringAny field from installation custom attribute parameters.

For information about the implementation of custom attributes, refer to the following documentation.
Android SDK
iOS SDK
Huawei SDK
Flutter plugin
React Native plugin
Cordova

To send a Mobile push message to multiple recipients, do the following.

  • Specify MULTIPLE as the destination type.
  • Specify multiple values for the destination parameter by using the <and> and <or> operators.

In the following example, all iOS devices are targeted.

Code sample

json
    "destinations": [
     {
        "$or": [
          {
             "platform": "iOS"
           },                   
 
 
         ]
         "type": "MULTIPLE"
 
 
     }
]

Advanced targeting

To create the required user segmentation and send them Mobile push messages, do the following.

  • Specify MULTIPLE as the destination type.
  • Use the <and> and <or> operators.

Example 1

In the following example, all iOS devices of the recipient with a specific phone number are targeted.

Code sample
json
"destinations": [
     {
        "$and": [
          {
             "platform": "iOS"
           }, 
          {
             "phoneNumber": "441134960001"
           },                                  
 
         ]
         "type": "MULTIPLE"
 
     }
]

Example 2

In the following example, the following recipients are targeted. The recipients must fulfil both criteria.

  • The custom device attribute, Device type, is either Personal or Business.
  • Target device has iOS.
Code sample
json
"destinations": [
     {
        "$and": [
          {
             "platform": "iOS"
           }, 
          {
             "DeviceType": "personal"
           }, 
 
           ]
        "$or": [
           {
            "DeviceType": "business"
           }, 
           ]
         "type": "MULTIPLE"
 
     }
]

Mirror push notifications within the application

You can use Send push API to show the notification within the application for the following scenarios:​

  • Show a push notification as well as show the notification within the app. Example: To support transactional information to end users who are using the application and cannot see push notifications. ​
  • Show the notification only within the application without showing a push notification. The notification is not displayed in the Notification center. To use this option, enable Silent push notification type.

Message formats

You can show the notification within the application in the following formats:

  • Modal: A type of notification that pops up on a screen and overlaps a part of the screen. Use this feature for scenarios when you want to get the full attention of the end user and ask them to do something.
  • Banner: Small notifications that are temporarily displayed over the content of the mobile app. They are displayed either on the top or the bottom of the screen of the mobile device and then close automatically after a few seconds. Use banners when you need to inform an end-user about something without stopping them from what they are doing in the app.

Supported SDK versions

The following SDK versions support showing the message inside the app.

SDKSupported version for Modal pop-upSupported version for Banner
SDK for Androidsince 1.13.0since 2.0.0
SDK for iOSsince 3.6.0since 5.0.0
SDK for Huaweisince 1.0.0since 1.0.0
FlutterAll versionsAll versions
React NativeAll versionsAll versions
Plugin for Cordovasince 0.7.0since 1.0.0

Notification parameters

To send notifications within the app, add the following parameters in notificationOptions.

ParameterDescription
showMirroredPushEnables the message to be displayed within the app.
mirroredPushStyleDefine whether the notification is displayed within the application as a banner or as a modal pop-up.
mirroredPushExpirationPeriodSpecify the maximum period during which the flow delivers the notification within the app.
mirroredPushExpirationTimeUnitSet the time unit for the expiration period to show the notification within the app. Choose either minutes or hours​.
Buttons: If the mirroredPushStyle is set to MODAL, you can also define buttons.
mirroredPushDismissTitleSpecify the text for the Dismiss button ​
mirroredPushOpenTitleSpecify the text for the Open button
onTapButtonActionSpecify the action to perform when the end user taps the Primary button in the notification within the app.​

Get Stats over API

Use the bulk push message statistics method (opens in a new tab) to retrieve statistics for sent bulk push messages.

NOTE

To get a detailed delivery report for each message sent in your bulk request, refer to the Push sent message reports (opens in a new tab) on the Infobip API Developer Hub.

Query parameters

ParameterTypeDescription
bulkIdstringThe ID that uniquely identifies the sent request.

Response format

ParameterTypeDescription
totalSentintTotal number of sent messages.
deliveredintTotal number of delivered messages.
seenintTotal number of seen messages.
errorserrorMessages not delivered to users.
deliverydeliveryDelivery information about the bulk sending of messages.

Errors

ParameterTypeDescription
registrationintMessages not delivered due to errors with non-valid registrations due to user uninstalling the app.
expiredintMessages undelivered due to expired validity period. Indicates users who have disabled notifications on a specific Push application.
cloudintMessages not delivered due to errors on APNS or FCM clouds. Happens due to transient errors on cloud services.

Delivery

ParameterTypeDescription
ratedoubleDelivery rate. The ratio between total delivered and total sent messages in a specific bulk sending process.

Send Push over OMNI API

The OMNI API enables automatic fallback to another channel according to the defined order.

To send push with OMNI API you need to:

  • Create an OMNI scenario
  • Send a message with OMNI scenario
  • Get delivery reports (optional)

Create OMNI Scenario

To create an OMNI scenario, you need to define the OMNI steps which will be sequentially executed.

To send push notifications with the scenario, you should use push (“channel”: “PUSH”) and APPLICATION CODE as the sender (“from”: “APPLICATION CODE”) generated during the setup of the mobile application.

Find more information on how to create the OMNI scenario in the Create Mobile Application Profile article in the Documentation Hub. Refer to the Infobip API Developer Hub for more information on how to create an OMNI scenario (opens in a new tab).

Most common OMNI scenario is push with SMS as a fallback channel. The following code snippet demonstrates how to create such a scenario.

json
    {
      "name" : "push + SMS scenario",
      "flow": [
        {
          "from": "APPLICATION CODE",
          "channel": "PUSH"
        },
        {
          "from": "YOUR_REGISTERED_SMS_SENDER",
          "channel": "SMS"
        }
      ],
      "default": true
    }

Send Messages With OMNI Scenario

Once you've created the OMNI scenario (identified by the key parameter), you can send your OMNI messages through defined communication channels.

NOTE

To be able to send push messages using Infobip web interface, you need to have at least one mobile application profile registered on the platform. Refer to the Create Mobile Application Profile for detailed instructions.

If you want to send one or multiple messages to different channels, you need to use the advanced OMNI message method (opens in a new tab).

You can use different options for processing push notifications when you receive them.

NameRequiredDefault valueTypeDescription
vibrationEnabledNotruebooleanNotification vibration (Android only).
soundEnabledNotruebooleanThe sound when notification arrives on a device.
soundNameNo-string The name of the custom sound played when a notification arrives on a device. The file should be in the app; max 30 seconds long. The file extension is required for iOS and optional for Android. For custom sound to be played soundEnabled shouldn’t be false (e.g., notification_sound.wav). Check Android and iOS usage details.
badgeNointegerBadge counter (iOS only).
contentUrl NostringURL of the image displayed in the notification. Rich push notifications are available on devices with iOS 10 and Android 4.1.+. Supported on iOS since Mobile SDK version 2.5.8. Supported on Android since Mobile SDK version 1.6.4.
categoryNostringCategory id for actionable notification. Supported on Android since Mobile SDK version 1.6.16. Supported on iOS since Mobile SDK version 2.6.9. Predefined category ids: mm_accept_decline - Accept & Decline button actions.
inAppStyleNostringPossible values: MODAL, BANNER. Set to MODAL to use in application dialog for actionable messages, or BANNER to show a standard banner view. MODAL is supported on iOS from 3.6.0, on Android from 1.13.0, on Cordova from 0.7.0, and React Native from 1.0.0. BANNER is supported from iOS 5.0.0, Android 2.0.0, Cordova 1.0.0, and React Native 1.0.0.
isSilent Noboolean Set to true to send a silent push message. Such messages are not displayed on the device lock screen and in the notification center. Silent messages can be used to deliver custom data to your mobile application or to show the notification within the app.
title NoApplication name set within mobile projectstringTitle of the notification. The title is visible to the end user. Requires iOS 10+ or Android 4.1+ (may depend on Android custom firmware)
webViewUrlNostringURL to open external web page within the mobile application (web view).
inboxTopicNostringA case sensitive topic name to save a message to an inbox. If the topic name does not exist for a specified account, message sending will be rejected.

The code snippet demonstrates how to send a push notification with options with OMNI API.

json
    {
      "scenarioKey": "key",
      "destinations": [
        {
          "to": {
            "phoneNumber": "phone number"
          }
        }
      ],
      "push": {
        "text": "This PUSH message will pop up on your mobile device.",
        "customPayload": {
          "contentUrl": "https://someurl.com/content",
          "deepLink": "myApp://some/link"
        },
        "notificationOptions": {
          "vibrationEnabled": true,
          "soundEnabled": true,
          "soundName": "sound.wav",
          "badge": 1,
          "contentUrl": "http://www.mydomain.com/images/image1.jpg",
          "category": "mm_accept_decline",
          "inAppStyle": "MODAL",
          "title": "This is some title"
        },
        "targetOnlyPrimaryDevices": true,
        "includeNotificationsDisabledDevices": true
      },
      "sms": {
        "text": "This is the SMS failover message"
      }
    }

Get Delivery Report

You can check the status of messages sent and get delivery reports with the OMNI reports (opens in a new tab) method.

Need assistance

Explore Infobip Tutorials

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use