Help Center/ Message & SMS/ FAQs/ Secondary Development/ Why a Preset 6-Digit Verification Code Becomes a 5-Digit Verification Code After Being Sent?
Updated on 2022-09-01 GMT+08:00

Why a Preset 6-Digit Verification Code Becomes a 5-Digit Verification Code After Being Sent?

[Symptom]

The Message&SMS service calls an API to send a 6-digit verification code. If the verification code starts with zero, the first zero is deleted and a 5-digit verification code is sent.

Cause Analysis

The variable templateParas in the template for the SMS Sending API is not set to a character string.

[Solution]

Set templateParas to a character string. Set templateParas based on code examples provided in the following table, or see examples in code examples.

Programming Language

Code Example - SMS Sending API

Code Example - Batch SMS Sending API

Java

String templateParas = "[\"369751\"]";

String[] templateParas1 = {"123456"};

String[] templateParas2 = {"234567"};

PHP

$TEMPLATE_PARAS = '["369751"]';

$TEMPLATE_PARAS_1 = ['123456'];

$TEMPLATE_PARAS_2 = ['234567'];

Python

TEMPLATE_PARAM='["369751"]'

TEMPLATE_PARAM_1 = ["123456"]

TEMPLATE_PARAM_2 = ["234567"]

C#

string templateParas = "[\"369751\"]";

string[] templateParas_1 = {"123456"};

string[] templateParas_2 = {"234567"};

Node.js

var templateParas = '["369751"]';

var templateParas1 = ['123456'];

var templateParas2 = ['234567'];