Send Batch Notifications via SMS
Learn how to leverage the OTPless Messaging API to send batch notifications via SMS. This guide will walk you through the process, covering both marketing and transactional use cases.
Request
Headers
clientId
: Your client ID provided by OTPless.clientSecret
: Your client secret provided by OTPless.Content-Type
: application/json
Body
channel
(String, required): The notification channel. For SMS, use"SMS"
.senderId
(String, conditional): The sender ID for the template (not required in case of countries like brazil).templateId
(String, conditional): The OTPless provided template ID. Required if dltTemplateId and dltTemplateText are not provided.dltTemplateId
(String, conditional): Template ID registered with DLT. Required if templateId is not provided.orderId
(String, optional): An order ID for tracking purposes. Will be returned in the response.dltTemplateText
(String, conditional): The template text. Use placeholders for variables as{#var#}
. Required iftemplateId
is not provided.recipients
(Array of Objects, required): An array of recipient objects.sendTo
(String, required): The phone number of the recipient.countryCode
(String, optional): Country code of the phone number. Please note if mobile number already contains country code insendTo
param then there is no need to provide country code param.bodyParams
(Array of Strings, required): An array of strings to replace placeholders in the template fortemplateId
ordltTemplateText
provided.metadata
(JsonObject, optional): A JSON object for any additional metadata. Will be attached to the delivery status webhook notification data.
You can use either
templateId
or bothdltTemplateId
anddltTemplateText
in a request, but not all three.
The
metadata
field is optional and can be used to send any additional data.
Example Request
Request
Headers
clientId
: Your client ID provided by OTPless.clientSecret
: Your client secret provided by OTPless.Content-Type
: application/json
Body
channel
(String, required): The notification channel. For SMS, use"SMS"
.senderId
(String, conditional): The sender ID for the template (not required in case of countries like brazil).templateId
(String, conditional): The OTPless provided template ID. Required if dltTemplateId and dltTemplateText are not provided.dltTemplateId
(String, conditional): Template ID registered with DLT. Required if templateId is not provided.orderId
(String, optional): An order ID for tracking purposes. Will be returned in the response.dltTemplateText
(String, conditional): The template text. Use placeholders for variables as{#var#}
. Required iftemplateId
is not provided.recipients
(Array of Objects, required): An array of recipient objects.sendTo
(String, required): The phone number of the recipient.countryCode
(String, optional): Country code of the phone number. Please note if mobile number already contains country code insendTo
param then there is no need to provide country code param.bodyParams
(Array of Strings, required): An array of strings to replace placeholders in the template fortemplateId
ordltTemplateText
provided.metadata
(JsonObject, optional): A JSON object for any additional metadata. Will be attached to the delivery status webhook notification data.
You can use either
templateId
or bothdltTemplateId
anddltTemplateText
in a request, but not all three.
The
metadata
field is optional and can be used to send any additional data.
Example Request
Request
Headers
clientId
: Your client ID provided by OTPless.clientSecret
: Your client secret provided by OTPless.Content-Type
: application/json
Body
channel
(String, required): The notification channel. For SMS, use"SMS"
.senderId
(String, conditional): The sender ID for the template (not required in case of countries like brazil).templateId
(String, conditional): The OTPless provided template ID. Required if dltTemplateId and dltTemplateText are not provided.dltTemplateId
(String, conditional): Template ID registered with DLT. Required if templateId is not provided.orderId
(String, optional): An order ID for tracking purposes. Will be returned in the response.dltTemplateText
(String, conditional): The template text. Use placeholders for variables as{#var#}
. Required iftemplateId
is not provided.recipients
(Array of Objects, required): An array of recipient objects.sendTo
(String, required): The phone number of the recipient.bodyParams
(Array of Strings, required): An array of strings to replace placeholders in the template fortemplateId
ordltTemplateText
provided.metadata
(JsonObject, optional): A JSON object for any additional metadata. Will be attached to the delivery status webhook notification data.
You can use either
templateId
or bothdltTemplateId
anddltTemplateText
in a request, but not all three.
The
metadata
field is optional and can be used to send any additional data.
Example Request
Request
Headers
clientId
: Your client ID provided by OTPless.clientSecret
: Your client secret provided by OTPless.Content-Type
: application/json
Body
channel
(String, required): The notification channel. For SMS, use"SMS"
.senderId
(String, required): The sender ID for the template.templateId
(String, conditional): The OTPless provided template ID. Required if dltTemplateId and dltTemplateText are not provided.dltTemplateId
(String, conditional): Template ID registered with DLT. Required if templateId is not provided.orderId
(String, optional): An order ID for tracking purposes. Will be returned in the response.dltTemplateText
(String, conditional): The template text. Use placeholders for variables as{#var#}
. Required iftemplateId
is not provided.recipients
(Array of Objects, required): An array of recipient objects.sendTo
(String, required): The phone number of the recipient.bodyParams
(Array of Strings, required): An array of strings to replace placeholders in the template fortemplateId
ordltTemplateText
provided.metadata
(JsonObject, optional): A JSON object for any additional metadata. Will be attached to the delivery status webhook notification data.
You can use either
templateId
or bothdltTemplateId
anddltTemplateText
in a request, but not all three.
The
metadata
field is optional and can be used to send any additional data.
Example Request
Example Response
For more details on handling delivery status and notifications, refer to our Webhook Guide.