JAVA code of interface SMS (show verification code)

Keywords: Java SDK

The biggest function of the website is the verification of the SMS verification code interface of the software. In order to provide users with a good security experience, the enterprise sets the authentication code as the gateway of the website or software. When applying for membership or account number, the text of obtaining the verification code will appear. When clicked, they will receive a text message verification code. If you enter a verification code, the application will succeed. Through this fast and concise way, the security of users can be improved to the maximum extent.

therefore kewail Xiaobian will share the Java SMS interface code and provide it to the technical apes

package com.kewail.sdk.sms.v2;

import java.util.ArrayList;
import java.util.List;


public class SmsSDKDemoV2 {
  public static void main(String[] args) {
    try {
        // key address of SMS sending interface, [log in to the background page of kewail to get]
        // key address of SMS sending interface, [log in to the background page of kewail to get]
        String accesskey = "xxx";
        String secretkey = "xxx";

        //type:0 general SMS 1 marketing SMS
        int type=0;
        //country code
        String nationcode="86";
        //Phone number
        String phoneNumber = "xxx";
        //SMS signature ID [(log in to kewail background page to obtain)
        String signId="5aa7ef278475af0e19b05f5b";
        //Template ID [(obtained by logging into kewal background page]
        String templateId="5a9599a56fcafe461546b953";
        //For the variable value of the SMS template, replace the variable {0}, {1} in the SMS template with the value in the parameter. If there is no variable in the SMS template, fill in null
        List<String> params=new ArrayList<String>();
        //There are multiple variable parameters in the template, and corresponding values can be added.
        //Custom fields, users can use according to their own needs
        String ext="";

         //Initialize single engine
        SmsSingleSender singleSender = new SmsSingleSender(accesskey, secretkey);
        SmsSingleSenderResult singleSenderResult;
         //For ordinary single issue, please note that it must be included by the [] symbol in front and placed at the head or tail.
        singleSenderResult = singleSender.send(type, nationcode, phoneNumber, signId, templateId, params, ext);

        //Voice verification code sending
        //SmsVoiceVerifyCodeSender smsVoiceVerifyCodeSender = new SmsVoiceVerifyCodeSender(accesskey,secretkey);
        //SmsVoiceVerifyCodeSenderResult smsVoiceVerifyCodeSenderResult = smsVoiceVerifyCodeSender.send("86",phoneNumber, "444144",2,"");

    } catch (Exception e) {


More, welcome to pay attention to cloud service Kewail Technology
Official website: Click to enter
Kewail background: Click to access

Posted by conquest on Tue, 05 Nov 2019 07:38:05 -0800