All Products
Search
Document Center

Short Message Service:Use the Alibaba Cloud SMS API or SDKs

Last Updated:Apr 07, 2023

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

Background information

Before you call an API operation, you can read related instructions in List of operations by function. If an error code is returned after you send a request, you can view the description of the error code in Error codes.

Usage notes

Before you use the Alibaba Cloud 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 plan. For more information, visit the SMS buy page.

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

Before you begin

  1. Create an Alibaba Cloud account and complete account verification.

  • To get started with Alibaba Cloud, first create an account by visiting the registration page. Next, complete the account verification process by visiting the account verification page. 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 account verification, proceed to the next step.

  1. 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 more information, watch the video tutorial.

  1. Obtain 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. For more information, see Obtain an AccessKey pair.

OpenAPI Explorer

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 countries and regions outside the Chinese mainland

  • Call the SendMessageToGlobe operation to send messages to countries and regions outside the Chinese mainland

  • Call the BatchSendMessageToGlobe operation to send messages in batches to countries and regions outside the Chinese mainland.

  • Call the QueryMessage operation to query the delivery status of a message.

Send messages to the Chinese mainland

  1. Use the Alibaba Cloud SMS console to submit a signature and a message template for approval.

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

    Call the QueryMessage operation to query the delivery status of a message.

Delivery receipts

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

For more information, see Configure delivery receipts.

Alibaba Cloud SDK for Java

To use the Java SDK in your application, you need to ensure that Java 8 or a later version is installed on your system. You can download and install the latest version of the Java SDK by following the instructions provided in Install Alibaba Cloud SDK for Java. For the sample Java SDK code for calling the SendMessageToGlobe operation, see Java SDK.

Note

If you are using a programming language other than Java, you can find information about SMS SDKs for other languages in Alibaba Cloud SMS SDK overview.