All Products
Search
Document Center

Node.js

Last Updated: Nov 26, 2019

Input parameters

Name Type O/M Example Description
MessageId String Mandatory 10080303003003 The ID generated by Alibaba Cloud to uniquely identify the serial number of SMS sending request.

Output parameters

Name Type Example Description
ResponseCode String OK The returned status code that indicates whether the call is successful. A value of OK indicates that the call is successful. Other values indicate that the call has failed. For more information, see Status codes.
ResponseDescription String The SMS Send Request was accepted The description of the returned status code.
To String 6581177810 The phone number of the SMS message recipient.
Status Number 1 The status of the SMS message. Valid values: 1 (Success), 0 (Fail).
ErrorCode String DELIVERED The returned error code.
ErrorDescription String success The returned error message.
Message String Hello! The content of the SMS message.
SendDate String Mon, 24 Dec 2018 16:58:22 +0800 The time and date when the SMS message was sent.
ReceiveDate String Mon, 24 Dec 2018 16:58:22 +0800 The time and date when the SMS message was received.
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 npm/yarn

  1. npm install @alicloud/pop-core

Option 2,Core-sdk download: Node.js API SDK

2.Writing a sample program

When calling the interface, please note:

  1. const Core = require('@alicloud/pop-core');
  2. var client = new Core({
  3. accessKeyId: '<accessKeyId>',
  4. accessKeySecret: '<accessSecret>',
  5. endpoint: 'https://sms-intl.ap-southeast-1.aliyuncs.com',
  6. apiVersion: '2018-05-01'
  7. });
  8. var params = {
  9. "RegionId": "ap-southeast-1",
  10. "MessageId": "140101545641902498"
  11. }
  12. var requestOption = {
  13. method: 'POST'
  14. };
  15. client.request('QueryMessage', params, requestOption).then((result) => {
  16. console.log(result);
  17. }, (ex) => {
  18. console.log(ex);
  19. })