Go SDK
I. Preparation
1) Obtain SDK Key Information
- Obtain the SDK key information, that is, the public key (PublicKey) and private key (PrivateKey), which can be obtained from API Product/API Key . For detailed steps, refer to: How to Obtain Public Key and Private Key.
2) Obtain Project ID
- This is the Project ID of the currently used project under the current account, which can be obtained from Resource Dashboard . For detailed steps, refer to: How to Obtain Project ID.
3) Apply for SMS Signature
- International SMS: SMS signature can be omitted for international SMS.
4) Apply for SMS Template
- International SMS: You can apply for an SMS template in the International SMS/SMS Signature module of the SMS Service Console . For detailed application steps, refer to: How to Apply for SMS Template.
II. Configure the SDK
1) Install the SDK
Refer to Surfercloud SDK Quick Start to install the SDK.
2) Parameter Description
- Phone Numbers (PhoneNumbers): Supports both international SMS. For international SMS, use the format
(86)13812345678, with the international dialing code prefixed to the phone number. - SMS Template ID (TemplateId): First-time users need to apply for a template in the Surfercloud console, and after approval, pass the template ID here.
- SMS Template Parameter List (TemplateParams): Variables can be passed into the SMS template. If there are several variables in the template applied, the same number must be passed in.
- SMS Signature (SigContent): First-time users need to apply for a signature in the Surfercloud console, and after approval, pass the signature here. The first applied signature will be the default signature, and if there is a default signature, this parameter can be omitted.
3) Related Limitations
-
SMS content is calculated based on 1 character for all letters, Chinese characters, and Chinese and English punctuation marks, and the content length must not exceed 600 characters.
-
The maximum number of characters for a single send is 500. Letters, Chinese characters, Chinese, and English punctuation marks are all calculated as 1 character;
-
SMS content must not contain special characters (you can check through the sensitive word detection tool in the SMS package page).
VI. Complete Example
Please contact technical support.
For other APIs such as Get SMS Receipt, please refer to the Code Examples in UAPI .