All Products
Search
Document Center

Short Message Service:Use the SMS API or SDKs

Last Updated:May 23, 2025

This topic describes how to use OpenAPI Explorer or SMS SDKs to use Short Message Service (SMS).

Background information

When calling API operations, you can refer to API overview for usage instructions. If you receive an error after sending a request, you can check the error codes in the API documentation.

Usage notes

Before you use the SMS service, take note of the following information:

  • Make sure that your account is an enterprise account.

  • Make sure that you have bound a credit card or PayPal account to your Alibaba Cloud account.

  • Make sure that you have purchased a resource package before you use the service.

  • The SMS signatures and message templates of the messages that are intended for the Chinese mainland must be approved before they can be used.

Preparations

  1. Create an Alibaba Cloud account and complete real-name verification.

    • To get started with Alibaba Cloud, first create an account. Next, complete the enterprise verification. For a more detailed guide, you can watch the video tutorial that provides step-by-step instructions.

    • If you already have an Alibaba Cloud account that passed real-name verification, proceed to the next step to activate SMS.

  2. Activate Alibaba Cloud SMS.

    Log on to the SMS console, select I have read and agreed on Alibaba Cloud International Website Product Terms of Service, and then click Activate Now. For a more detailed guide, you can watch the video tutorial that provides step-by-step instructions.

  1. Create an AccessKey pair.

    Alibaba Cloud AccessKey pairs are security tokens used to access cloud resources by calling API operations. You can log on to the Alibaba Cloud Management Console by using your Alibaba Cloud account or as a RAM user. You must create an AccessKey pair before you call SMS API operations.

OpenAPI Explorer examples

If you prefer interactive interfaces or are new to Alibaba Cloud services, OpenAPI Explorer can help you debug API operations and obtain SDK sample requests.

Send messages to international regions, Hong Kong (China), Macao (China), and Taiwan (China):

  • Call the SendMessageToGlobe operation to send messages to international regions, Hong Kong (China), Macao (China), and Taiwan (China).

  • Call the BatchSendMessageToGlobe operation to send batch messages to international regions, Hong Kong (China), Macao (China), and Taiwan (China).

  • Call the QueryMessage operation to query the message sending status.

Send messages to the Chinese mainland:

  1. In the console, create an SMS signature and create an SMS template. Wait for the signature and template to be approved.

  2. Call the SendMessageWithTemplate operation to send messages to the Chinese mainland.

    Call the QueryMessage operation to query the message sending status.

Message receipts

After you send messages, you can configure a Message Service (MNS) queue or an HTTP URL to receive message receipts and MO messages. This way, you can deploy your services based on the delivery status of messages.

For more information, see Introduction to message receipts and configuration process.

SDK examples

This method is suitable for SDK coding scenarios. To use the upgraded Java SDK, you must have Java 8 or later installed. Taking the SendMessageToGlobe operation as an example, you can call SMS API operations by using Alibaba Cloud SDKs. For more information, see Java SDK examples.

Note

For SMS SDKs in other programming languages, see SDK Reference.