Sends a message including an OTP code to the given phone number
client.otpvalidation.sendCode(OtpvalidationSendCodeParams { message, phoneNumber, xCorrelator } params, RequestOptionsoptions?): OtpvalidationSendCodeResponse { authenticationId }
POST/otpvalidation/send-code
Sends an SMS with the desired message and an OTP code to the received phone number.
Sends a message including an OTP code to the given phone number
import Camara from 'camara-sdk';
const client = new Camara({
bearerToken: process.env['CAMARA_BEARER_TOKEN'], // This is the default and can be omitted
});
const response = await client.otpvalidation.sendCode({
message: '{{code}} is your short code to authenticate with Cool App via SMS',
phoneNumber: '+346661113334',
});
console.log(response.authenticationId);{
"authenticationId": "ea0840f3-3663-4149-bd10-c7c6b8912105"
}{
"status": 400,
"code": "INVALID_ARGUMENT",
"message": "Client specified an invalid argument, request body or query param."
}{
"status": 401,
"code": "UNAUTHENTICATED",
"message": "Request not authenticated due to missing, invalid, or expired credentials."
}{
"status": 403,
"code": "PERMISSION_DENIED",
"message": "Client does not have sufficient permissions to perform this action"
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.MAX_OTP_CODES_EXCEEDED",
"message": "Too many OTPs have been requested for this MSISDN. Try later."
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.PHONE_NUMBER_NOT_ALLOWED",
"message": "Phone_number can't receive an SMS due to business reasons in the operator."
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.PHONE_NUMBER_BLOCKED",
"message": "Phone_number is blocked to receive SMS due to any blocking business reason in the operator."
}{
"status": 404,
"code": "NOT_FOUND",
"message": "The specified resource is not found."
}{
"status": 429,
"code": "QUOTA_EXCEEDED",
"message": "Out of resource quota."
}{
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit reached."
}Returns Examples
{
"authenticationId": "ea0840f3-3663-4149-bd10-c7c6b8912105"
}{
"status": 400,
"code": "INVALID_ARGUMENT",
"message": "Client specified an invalid argument, request body or query param."
}{
"status": 401,
"code": "UNAUTHENTICATED",
"message": "Request not authenticated due to missing, invalid, or expired credentials."
}{
"status": 403,
"code": "PERMISSION_DENIED",
"message": "Client does not have sufficient permissions to perform this action"
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.MAX_OTP_CODES_EXCEEDED",
"message": "Too many OTPs have been requested for this MSISDN. Try later."
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.PHONE_NUMBER_NOT_ALLOWED",
"message": "Phone_number can't receive an SMS due to business reasons in the operator."
}{
"status": 403,
"code": "ONE_TIME_PASSWORD_SMS.PHONE_NUMBER_BLOCKED",
"message": "Phone_number is blocked to receive SMS due to any blocking business reason in the operator."
}{
"status": 404,
"code": "NOT_FOUND",
"message": "The specified resource is not found."
}{
"status": 429,
"code": "QUOTA_EXCEEDED",
"message": "Out of resource quota."
}{
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit reached."
}