Skip to Content

Java SDK

I. Preparation

1) Obtain SDK Key Information

2) Obtain Project ID

3) Apply for SMS Signature

  • Domestic SMS: The content of domestic SMS consists of the SMS signature and SMS body. You can apply for an SMS signature independently in the Domestic SMS/SMS Signature module of the SMS Service Console. For detailed application steps, refer to: How to apply for SMS Signature.
  • International SMS: The SMS signature can be left blank for international SMS.

4) Apply for SMS Template

  • Domestic SMS: The content of domestic SMS consists of the SMS signature and SMS body. The SMS body is obtained by calling the SMS template. You can apply for an SMS template independently in the Domestic SMS/SMS Signature module of the SMS Service Console. For detailed application steps, refer to: How to apply for SMS Template.
  • International SMS: You can apply for an SMS template independently 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 SDK

1) Install SDK

Refer to the UCloud Global SDK Quick Start for installing the SDK.

2) Parameter Description

  • Phone Number List (PhoneNumbers): Supports both international and domestic SMS. For international SMS, use the format (86)13812345678, where the international dialing code is prefixed to the phone number.
  • SMS Template ID (TemplateId): First-time users need to apply for a template in the UCloud Global console. After approval, pass the template ID here.
  • SMS Template Parameters (TemplateParams): Variables can be passed into the SMS template. The number of variables to be passed corresponds to the number in the template at the time of application.
  • SMS Signature (SigContent): First-time users need to apply for a signature in the UCloud Global console. After approval, pass the signature here. The first applied signature is the default signature, and when there is a default signature, this parameter can be omitted.
  1. SMS content is calculated as 1 character for each letter, Chinese character, or English punctuation mark. The length cannot exceed 600 characters.

  2. Domestic: The upper limit for a single SMS is 70 characters. If it exceeds 70 characters, it will be calculated as “each 67 characters count as 1 SMS.”

  3. The maximum number of characters for a single send is 500, where letters, Chinese characters, and English punctuation are each calculated as 1 character.

  4. The SMS content should not contain special characters (you can check with the sensitive word detection tool on the SMS package page).

III. Complete Example

Please contact technical support.