After you use the API operations of Chat App Message Service to send messages, you can configure Simple Message Queue (SMQ, formerly MNS) queues or HTTP URLs to receive the receipts of mobile terminated (MT) messages and mobile originated (MO) messages sent from users.
Usage notes
If a network error occurs or the response times out during message receipt delivery, message receipts may be repeatedly pushed or fail to be received.
Destinations of message receipts
You can configure SMQ queues or HTTP URLs to receive message receipts based on your business requirements.
The idempotence of message receipts cannot be guaranteed. We recommend that you take appropriate measures to ensure the correctness and consistency of your data after you receive a message receipt.
SMQ queues
You can configure SMQ queues to receive message receipts from a specific region. SMQ queues support all types of message receipts in cloud communications. After you enable SMQ to subscribe to a specific message type in the CAMS console, SMQ automatically generates a message queue of the specified type. You can use SDKs to pull message receipts by message type and queue name.
HTTP URLs
You can configure an HTTP URL to receive message receipts. CAMS pushes message receipts to the HTTP URL by using the HTTP POST method. After you configure an HTTP callback URL in the CAMS console, CAMS uses HTTP POST requests to send MT message receipts and MO messages to the callback URL. You can retrieve the MT message receipts or MO messages from the URL.
Types of message receipts
After you configure SMQ queues or HTTP URLs, you must select the types of message receipts that you want to receive. Different types of message receipts are used in different scenarios. The following table describes the types of message receipts.
Type | Description | SMQ queue | HTTP URL |
MO message | MO messages are messages that end users send to enterprises. You can call the ChatAppInbound operation to subscribe to MO messages. This way, you can obtain the content of the messages sent from end users. | ||
MT message receipt | MT messages are messages that end users receive. You can call the ChatAppStatus operation to subscribe to the receipts of MT messages and query the delivery status of each MT message. This way, you can check whether messages are sent to end users and obtain the related information. | ||
Message containing information about the template review status | After you call the CreateChatappTemplate operation to create a message template, you can call the ChatAppAudit operation to subscribe to messages that contain information about the template review status. |
Configure message receipts
To subscribe to message receipts, enable the message receipt feature in the Chat App Message Service.
Log on to the CAMS console.
In the left-side navigation pane, click Channel management. On the Channel management page, find the channel that you want to manage and click the channel ID or click Management in the Operation column.
On the Data panel page, click an option in the left-side navigation pane based on the channel type. Click Number management for an WhatsApp channel, Service ID management for a Viber channel, Public Homepage for a Messenger channel, or Professional Account for an Instagram channel.
On the page that appears, specify the types of messages to which you want to subscribe.
Number management page for a WhatsApp channel
After your mobile number passes verification, click Channel Webhook Settings and select the messages to which you want to subscribe.
Turn on HTTP protocol and enter a callback URL. Example: http://push.example.com/contextpath/receive.do.
Turn on Message queue monitoring.
Public Homepage page for a Messenger channel, Professional Account page for an Instagram channel, or Service ID management page for a Viber channel
After the homepage, professional account, or service ID is connected, click Set up Webhook and select the messages to which you want to subscribe.
Turn on HTTP protocol and enter callback URLs for MT message receipts and MO messages. Example: http://push.example.com/contextpath/receive.do.
Turn on Message queue monitoring.
Download SMQ SDK for Java
You can download and install SMQ SDK for Java to pull messages in SMQ queues.
Download URL: SMQ SDK for Java