All Products
Document Center


Last Updated: Nov 26, 2019

Input parameters

Name Type O/M Description
To String Mandatory The format of a phone number: Country Code + Phone Number
From String Optional Sender ID supported, please refer to (Regulation of Sender ID
Message String Mandatory This is the text sending to the target phone number.

Output parameters

Name Type Example Description
MessageId String 10080303003003 The ID generated by Alibaba Cloud, to uniquely identify the serial number of SMS sending request.
To String 6531177810 The format of a phone number: Country Code + Phone Number
From String Alicloud Sender ID supported,please refer to (Regulation of Sender ID)
ResponseCode String OK This code indicates whether the SMS Send request is accepted by Alibaba Platform or has not been accepted.“OK” indicates the request is accepted.Other codes indicate different errors. The details please go to the StatusCode list.
ResponseDescription String The SMS Send Request was accepted The description of different Status Code.
Segments String 1 The number of parts into which Alibaba Cloud split.
NumberDetail String Detailed information of the number
└Country String Hongkong, China Number Country
└Region String HongKong Number Region
└Carrier String CMI Number Carrier/Network

Developer integration process

1.Core-sdk import

Option 1,Install with Pip

  1. pip install aliyun-python-sdk-core

Option 2,Core-sdk download: Python API SDK

2.Writing a sample program

When calling the interface, please note:

  • When creating “AcsClient”, the third parameter (regionId) must be “ap-southeast-1”, please do not modify it.
  • domain must be “”, please do not modify it.
  • version must be 2018-05-01, please do not modify it.
  1. #!/usr/bin/env python
  2. #coding=utf-8
  3. import os
  4. from aliyunsdkcore.client import AcsClient
  5. from aliyunsdkcore.request import CommonRequest
  6. client = AcsClient('<accessKeyId>', '<accessSecret>', 'ap-southeast-1')
  7. request = CommonRequest()
  8. request.set_accept_format('json')
  9. request.set_domain('')
  10. request.set_method('POST')
  11. request.set_version('2018-05-01')
  12. request.set_action_name('SendMessageToGlobe')
  13. request.add_query_param('To', '6281398007451')
  14. request.add_query_param('From', '1234')
  15. request.add_query_param('Message', 'Have a test.')
  16. response = client.do_action(request)
  17. # python2: print(response)
  18. print(str(response, encoding = 'utf-8'))