Huawei Cloud SMS: Preserve Leading Zeros in Template Parameters

Published: · Updated:
Share

If a six-digit Huawei Cloud SMS code loses its initial zero, check the type of templateParas first. Huawei's FAQ identifies template variables not supplied as strings as a cause of this symptom.

Huawei Cloud SMS: Preserve Leading Zeros in Template Parameters — article key points

Preserve characters before serialization

A code is not an arithmetic value. Converting “012345” to an integer and back produces “12345”; changing the outer parameter type afterward cannot restore the lost character.

Ordinary-send examples use a serialized JSON string containing string values, illustrated here by ["012345"]. Batch-send examples use string arrays in their corresponding fields. Follow the specific endpoint and language example rather than swapping these outer structures.

Use fictional samples to compare generated, submitted and received values. Do not blindly prefix every five-digit received value with zero. This concerns Huawei Cloud messaging parameters, separate from HUAWEI ID security-phone changes.

References: Huawei Cloud SMS: Preserve Leading Zeros in Template Parameters — official documentation.

Need help?

Click here and start chatting with us!