Configure SMS interaction

更新时间:
复制 MD 格式

This topic describes how to configure the SMS interaction feature.

Overview

To improve message delivery rates and timeliness, and to expand the use cases for push notifications, Mobile Push offers a hybrid notification model that combines push notifications and text messages. You can set a time period. If a user does not receive or click a push notification within that period, a text message is sent as a fallback.

The hybrid notification feature uses your Short Message Service (SMS) account to send text messages. The fees are deducted from your SMS account in real time. Fees for push notifications are settled in the Mobile Push system.

The workflow for hybrid notifications is as follows:

流程

Scope

  • This feature supports only the advanced push API of OpenAPI 2.0.

  • This feature applies only to pushes to Android and HarmonyOS.

  • Currently, only targeted pushes are supported. This includes pushes by DeviceId, Account, Alias, or Tag. Broadcast pushes are not supported.

  • When you use the hybrid notification model, you cannot set the push notification's time-to-live (TTL) separately. To prevent duplicate notifications, the system sets the push notification's TTL to the same value as the SMS trigger delay. The maximum delay is 3 days.

Procedure

Step 1. Activate Short Message Service

  1. Use your Alibaba Cloud account to activate Short Message Service.

  2. After you activate the service, go to the SMS console to set an SMS template and an SMS signature. For more information, see the SMS documentation guide.

Step 2. Authorize the Mobile Push service-linked role

  1. Log on to the EMAS console and select the Mobile Push product.

  2. On the Mobile Push product page, in the navigation pane on the left, choose Configuration Management > Application Configuration. On the Application Configuration page, select SMS Interaction.

  3. In the SMS Console Authorization area, turn on the Enable SMS Interaction switch.

  4. In the Mobile Push Service-Linked Role dialog box that appears, click Confirm.

Note

When you click Confirm, you grant Mobile Push permission to use SMS to enable the SMS interaction feature. For more information, see Introduction to the Mobile Push service-linked role.

To disable SMS interaction, on the SMS Interaction page, click Disable SMS Interaction.

Step 3. Create an SMS template and signature

Create an SMS template and an SMS signature as described in the SMS documentation. Because these require manual review, create them in advance.

Step 4. Configure SMS interaction

You can send mixed pushes that include text messages after the approval and configuration are complete.

Client configuration

Set an associated phone number

To receive text messages, you must use the software development kit (SDK) to associate a phone number with a device.

The Android SDK provides methods to bind and unbind phone numbers. The methods are described as follows:

/**
 * Binds a phone number.
 * @param phoneNumber
 * @param callback
 */
void bindPhoneNumber(String phoneNumber,CommonCallback callback);
/**
 * Unbinds a phone number.
 * @param callback
 */
void unbindPhoneNumber(CommonCallback callback);
Note
  • Multiple devices can be bound to the same phone number.

  • A single device can be bound to only one phone number. If you bind a device to different numbers multiple times, the last binding takes effect.

For information about how to configure the HarmonyOS SDK, see SMS Interaction.

Send a hybrid push notification

To send a hybrid push notification, add the SMS-related configuration parameters to the push request in OpenAPI. For more information, see the SMS-related content in the Advanced Push API document.