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

Send Mobile Push over API

Send Mobile Push over API

Mobile Push API offers a wide range of possibilities when it comes to destination targeting options. Below you will find the available fields and examples of how they can be used.

To send a single Push notification to one or multiple recipients, use this method (opens in a new tab). When sending a large number of messages or targeting different user segments with different messages to optimize data traffic and increase performance, use this method (opens in a new tab).

PUSH SDK

Learn how to properly implement destination address type parameters in the Android (opens in a new tab), iOS, (opens in a new tab)and Huawei (opens in a new tab) SDK documentation, or for the React Native (opens in a new tab), Flutter, (opens in a new tab)and Cordova (opens in a new tab)plugins.

Destination address types enabled by default:

Name

Type

Description

pushRegistrationIdstringPush Registration Id is a unique ID which identifies application instance and specific device.
platformstringPossible values are Android or iOS.
sdkVersionstring

SDK Version which can be found on GitHub:
Mobile SDK iOS releases

Mobile SDK Android releasesMobile SDK Huawei releasesReleases of plugins for:React NativeFlutterCordova
osVersionstringOS version.
deviceManufacturerstring

Device manufacturer:
iOS - Apple
Android - for example, Samsung, Asus, etc
Value for a particular subscriber can be found in subscriber details on the https://portal.infobip.com/people (opens in a new tab).

deviceModelstring

Device model, for example, iPhone 6, iPhone 5s (GSM+CDMA), LG-D855.
Value for a particular subscriber can be found in subscriber details on the https://portal.infobip.com/people (opens in a new tab).
List of iOS models

applicationVersionstringApplication version.
pushRegistrationEnabledbooleanIs the device allowed to receive push notifications? Set to 'true' to only target users who have push registration enabled. For more details refer to the following SDK wikis:
notificationsEnabledbooleanSet to true to only target devices where notifications for the mobile application are turned on by the user.
geofencingEnabledbooleanIs Geofencing SDK set and tracking locations allowed by the user.
deviceSecurebooleanIs Touch-Id or passcode set for the device?

The following destination address types are not available by default. They should be defined by User Data in SDK.

NameTypeDescription
externalUserIdstringExternal user ID set in User Profile. Learn more about external user id in the following SDK documentation:
phoneNumberstringMSISDN in international format (Example: 41793026727).
emailstringEmail of the user if it is provided in User Profile.
{custom field}stringAny field from installation custom attribute parameters. Learn more about custom attributes in the following SDK documentation:
COMBINING DIFFERENT ADDRESS TYPES IN A SINGLE REQUEST

You can use a single address type or even combine two or more to achieve the desired user segmentation. Use the API request example above and replace only the “to” field with one of the examples below to take advantage of various segmentation options.

Single Recipient Destination Address Type

Use this method to target the recipient’s device associated with the single Push registration ID.

json
 
    "to": {
        "pushRegistrationId": "69827EDB-A806-4AF6-A7F6-98298EAA4F14"
    }
 

With this type of targeting, you can achieve the following:

  • target all iOS or Android devices
  • target a particular device
  • target all devices of a particular external user id
  • target all devices linked to a phone number
  • target all devices linked to an email
  • target all devices associated with any custom data parameter like tag, subscription or other

In the following example, we are targeting all iOS devices.

json
 
    "to": {
        "platform": "iOS"
    }
 

With this example, all devices that have been associated with the phone number 41793026727 will be targeted.

json
 
    "to": {
        "phoneNumber": "41793026727"
    }
 

To send a single Push notification to one or multiple recipients, use this method. (opens in a new tab)

Multiple Recipient Destinations of the Single Address Type (IN)

Combining two or more different parameters of the same destination address type can be done as shown in the example below. In this example, the message will be delivered to both iOS and Android users.

json
 
     "to": {
        "platform": ["iOS", "Android"]
     }
 

By using this method you can target all of the user devices according to email address.

json
 
     "to": {
        "email": ["[email protected]", "[email protected]"]
     }
 

Multiple Destination Address Types (AND)

You can use this method to target a recipient segment by using two or more different address type filters. The message will be delivered only to those recipients who satisfy all filter conditions. In other words, if the recipient’s device matches address type 1 AND address type 2, the message will be sent.

In the following example, all iOS devices of the recipient with a specific external ID will be targeted.

json
 
    "to": {
        "platform": "iOS",
        "externalUserId": "customer_21234"
    }
 

Multiple Destination Address Types (OR)

In some cases, you may want to segment your recipients by including different filters over multiple destination address types. By using this method, the recipient will receive the message if he satisfies at least one condition. In other words, if the recipient matches address type 1 OR address type 2, a message will be sent.

In the following example, recipients whose favorite pizza is Capricciosa or whose favorite pasta is Napolitana will be targeted.

json
 
    "to": {
        "$or": [
            {"FavoritePizza": "Capricciosa"},
            {"FavoritePasta": "Napolitana"}
        ]
    }
 

Advanced Targeting Example

The combination of different targeting methods is also supported.

In the following example, we are targeting Android devices of the recipients who have a specific user ID or at least one of the listed emails.

json
 
    "to": {
        "$or": [
            {"externalUserId": "my-ext_id-1"},
            {"email": ["[email protected]", "[email protected]"]}
        ],
        "platform": "Android"
    }
 

Mirror push notifications within the app

You can use Mobile push API to show the notification within the app 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 app and cannot see push notifications. ​
  • Show the notification only within the app 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 app in the following formats:

  • Pop-up: 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 iOSsince 3.6.0since 5.0.0
SDK for Androidsince 1.13.0since 2.0.0
SDK for Huaweisince 1.0.0since 1.0.0
Plugin for Cordovasince 0.7.0since 1.0.0
React NativeAll versionsAll versions
FlutterAll versionsAll versions

Notification parameters

To send notifications within the app, use the Send single Push notification (opens in a new tab) and Send multiple Push notifications (opens in a new tab) requests.

Add the following parameters in notificationOptions.

ParameterDescription
showInAppEnables the message to be displayed within the app.
inAppStyleDefine whether the notification is displayed within the app as a banner or as a modal pop-up.
inAppExpirationPeriodSpecify the maximum period during which the flow delivers the notification within the app.
inAppExpirationTimeUnitSet the time unit for the expiration period to show the notification within the app. Choose either minutes or hours​.
Buttons: If the inAppStyle is set to Modal, you can also define buttons.
inAppDismissTitleSpecify the text for the Dismiss button ​
inAppOpenTitleSpecify the text for the Open button
primaryButtonActionSpecify 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

Parameter 

Type 

Description 

bulkIdstringThe ID that uniquely identifies the sent request.

Response format

Parameter 

Type 

Description 

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

Parameter 

Type 

Description 

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

Parameter 

Type 

Description 

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.

Name

Required 

Default value

Type

Description

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.
badgeNo integerBadge counter (iOS only).
contentUrl No stringURL 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.
categoryNo stringCategory 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.
inAppStyleNo stringPossible values: MODALBANNER. Set to MODAL to use in app 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.0BANNER is supported from iOS 5.0.0, Android 2.0.0, Cordova 1.0.0, and React Native 1.0.0.
isSilent No boolean 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)
webViewUrlNo stringURL to open external web page within the mobile app (web view).
inboxTopicNo stringA 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