SMS authentication receipt message
After you send SMS verification codes using the SMS Authentication Service API operation, you can configure the Message Service (MNS) consumer pattern or the HTTP batch push pattern to receive status reports.
Introduction to receipt messages
There are two patterns for receiving receipt messages: the Message Service (MNS) consumer pattern and the HTTP batch push pattern. Choose the pattern that suits your needs.
Message Service (MNS) consumer pattern
The Message Service (MNS) consumer pattern uses a queue model to receive receipt messages for SMS verification codes in a specified region. Message Service can send all business messages from Alibaba Cloud Communications. When you enable Message Service in the Phone Number Verification Service console and subscribe to a specific message type (MessageType), the system automatically creates a separate message queue and queue name (QueueName) for that type. You can then use this queue name (QueueName) and message type (MessageType) to retrieve SMS status reports from the queue by making SDK calls from your backend.
HTTP batch push pattern
The HTTP batch push pattern sends messages to a specified web URL using HTTP POST requests. After you set an HTTP callback URL (callback_url) in the Phone Number Verification Service console, the system pushes business messages, such as SMS status reports, to that URL when they are generated. You can receive these messages directly at the URL.
Receipt message types
Name |
Description |
Message Service (MNS) consumer pattern |
HTTP batch push pattern |
DypnsSmsVerifyReport (Receive SMS verification send status reports) |
After enabling DypnsSmsVerifyReport receipts, you can receive status reports for SMS verification codes that you send by calling the SendSmsVerifyCode operation. |
Configure receipt messages
Due to system caching, messages are not pushed immediately after you enable receipts. Please wait 15 minutes for the setting to take effect.
Network issues, such as abnormalities or response timeouts, can cause duplicate message pushes or failures to retrieve receipt messages. If you fail to retrieve a receipt message, check your network connection and retry later.
Receipt messages do not guarantee idempotence. If your processing logic requires idempotence, you must implement it based on your scenario.
Configuration steps
Log on to the Phone Number Verification Service console.
In the navigation pane on the left, choose . On the Status Report Receiving tab, enable the desired pattern.
Message Service (MNS) consumer pattern
Enable the Message Service (MNS) consumer pattern.
Select a region.
The region must be the same as the one you select when you call the API operation.
Click OK. The configuration is complete.
HTTP batch push pattern
NoteThe response timeout period for the HTTP batch push pattern is 700 ms.
Turn on the switch for HTTP Batch Push Mode.
Enter the URL to receive receipt messages.
NoteBefore you enter the receiving URL, you can click Test and provide a test URL to verify that it can receive receipt messages. Your server-side URL must return a response that strictly follows the JSON format specified in the response information.
Example: http://push.example.com/contextpath/receive.do.
Click OK. The configuration is complete.