All Products
Search
Document Center

Create a message – Template push

Last Updated: Aug 18, 2021

Template push is mainly used to push messages to multiple targets for multiple times. Before automating or widely using the template function, you can verify and test template functions by creating a message for template push in the console.

Note:
  • Since manual operations are required, we recommend you push messages through the console in the scenarios requiring low-frequency message push, such system verification, operation support, and temporary emergency requirement.
  • The messages are pushed immediately after they are created. You cannot delete or modify them.

The following sections describe how to create a template push message in the console.

Prerequisites

  • To push messages to iOS devices, you should have integrated MPS iOS SDK (see Access iOS SDK) and configured the iOS push certificate on the Push configuration page in mPaaS console. For more information, see Configure iOS push certificate.
  • To push messages through the Android vendor channels (also known as third-party channels), you should have integrated MPS Android SDK (see Access Android SDK), accessed relevant vendor channels (see Access vendor push channels) and completed corresponding push channel setting on the Third-party channels page in mPaaS console. For more information, see Channel configuration.
  • Before creating a template push task, you need to prepare a template. For how to create a template, see Create a message template.

Procedure

Log in to the mPaaS console, select the App, and perform the following steps to create a message:

  1. In the left-side navigation pane, choose Message Push Service to enter the Message list tab on the right side of the page.
  2. Click the Create a message button, and in the pop-up dialog box, select the Template push tab.
  3. On the template push tab page, configure the basic information of the message. The configuration items are as follows:

    Parameter Required Description
    Target ID type Yes Select a message sending mode. Options:
    • UserId: Enables you to push messages based on the user dimension. You need to call the bind API to bind the user ID and the device ID. For more information about the bind API, see API reference.
    • DeviceId: Enables you to push messages based on the device ID.
    Push platform Yes When you push messages based on the device ID, you need to select a push platform to specify the type of the target device. Options:
    • Android: The target device is an Android mobile phone.
      • When the Android message push channel is MPS self-built channel or you use Badge message (with the extension parameter badge configured), the self-built channel is used to push messages.
      • In other scenarios, when you access the three-party push platform (Xiaomi, Huawei, OPPO, vivo, and FCM) and the target device is the model of the corresponding vendor, use the three-party channel to push the message, otherwise, use the self-built channel to push the message.
    • iOS: The target device is an iPhone. Use the vendor channel to push the message.
    Customer message ID Yes Customer message ID is automatically generated by the system to uniquely identify the message in the client’s system. It can be customized and a maximum of 64 characters are allowed.
    Target ID Yes Enter the user ID and device ID.
    • You need to enter the correct ID based on the selected target ID type, otherwise it will lead to a push failure.
    • When the target ID type is DeviceId, the target ID is device ID (enter Ad-token for Android devices and Device Token for iOS devices). The corresponding mobile phone operating system should be consistent with the selected Push platform, otherwise it will lead to a push failure.
    • If there is any space in the device ID obtained from sources such as logs, you need to delete the space.
    Template Yes Choose a message template from templates listed on the Message template page.
    Android message channel Yes The system provides different options according to the display type of the selected message template (only for the Android push platform):
    • When the display type is Show message (on notification bar): Both options (Default channel and MPS self-built channel) are selectable.
    • When the display type is Silent push: MPS self-built channel is selected by default, and you cannot modify it.
    The description of each option is as follows:
    • Default channel: MPS uses vendor channels to push messages. When your App is not connected to the vendor channel, or it is connected to the vendor channel but the target device is not manufactured by the third party, the system uses an MPS self-built channel to push messages.
    • MPS self-built channel: MPS uses a self-built channel to push messages.
    For Android devices, this parameter specifies whether to push messages through an MPS self-built channel or vendor channel. For iOS devices, you do not need to set this parameter (iOS push belongs to vendor channel push).
    Display type Yes The system automatically selects the display type corresponding to the selected template and you cannot modify it.
    • Show message (notification bar): Indicates that the message will be displayed in the notification bar.
    • Silent push: Indicates that the message will not be displayed in any form on the target device.
    For Android devices, you need to perform different operations according to the push channel that you have selected:
    • MPS self-built channel: This parameter is sent to the client as a reference field. You need to parse the message body and get the content of this field, then control the display of the message.
    • Vendor channel: This parameter is sent to the target device as a field. The device vendor’s system will then parse the content of this field, and control the display of the message. You do not need to perform any other operations.
    For iOS devices, the display of messages is controlled by the device vendor’s system. You do not need to perform any other operations.
    Operate upon click Yes The system makes an automatic selection according to the configuration in the selected template and you cannot modify it.
    Template placeholder Yes Enter variable values in the template. The system provides configuration options for placeholders in the selected template.

    The preview area is on the right side of the Create a message window. To preview the message display effects for different platforms respectively, click Notification, iOS message body and Android message body.

  4. (Optional) Configure the advanced information on demand. In the Advanced information area, complete the following configurations:

    • Valid period: Specify the valid period of the message in seconds. It is 180 seconds by default. To ensure the message arrival rate, when a message fails to be sent because the device is offline or the user is logged out, MPS will resend it after the device is connected or a user binding request is initiated within the validity period of the message.
    • Extension parameters: Turn the switch on, click Add parameter, set the key/value, and left click on any area of the page to complete setting. The extension parameters are passed to the client together with the message body for your use.
      Extension parameters include the following three types:
      • System extension parameters
        These extension parameters are occupied by the system, and cannot be modified. System extension parameters include:
        • notifyType
        • action
        • silent
        • pushType
        • templateCode
        • channel
        • taskId
      • System extension parameters with some significance
        These extension parameters are occupied by the system and have some significance. You can configure values of these extension parameters.
        For more information about these parameters, see the following table.
        Parameter Description
        sound The custom ringtone of the message. The value of this parameter is the path of the ringtone. This parameter is only valid for Xiaomi phones and iPhones.
        badge Badge number. Its value is a specific number. This extension parameter will be passed to the client together with the message body.
        • For Android devices, you need to implement the badge logic by yourself.
        • For iOS devices, iOS system automatically implements the badge logic. When a message is pushed to the target mobile phone, the number that you specified in value appears in the badge of the App icon.
        mutable-content The APNs custom push identifier. If a pushed message carries this parameter, it indicates that the UNNotificationServiceExtension of iOS10 is supported, otherwise it is a normal push. Value is set to 1.
        badge_add_num Accumulative badge number, only available in Huawei channel.
        badge_class Activity class corresponding to the desktop App icon in Huawei channel.
        big_text Big text style, the value is fixed to 1, and other values are invalid. This parameter is only valid for Xiaomi and Huawei phones.
      • User-defined extension parameters
        All other parameters than system extension parameters and system extension parameters with some significance are user-defined extension parameters. User-defined extension parameters are passed to the client together with the message body for your use.
  5. Click Submit, and the message will be pushed to the target ID.

Relevant operations