Skip to main content
Use this function to send templates in bulk to your customers. The API will handle delivery to recipients from a column-based file. Sending templates in bulk allows you to send a predefined template with different values related to each customer, so you can select dynamic information from a source such as a file, to automate and send your campaign easily.

Template guidelines

The source file must be created following these specifications:

File format

Only files with the .CSV extension are supported. The first row of the file must define the column names (header). Follow these rules for the header:
  • Avoid blank spaces in column names.
  • Do not use special characters or punctuation marks (e.g., !, $, %, &, *, etc.).
  • Use only letters, numbers, and underscores (_) if necessary.
Correct: phone_number, customer_name, order_amount Incorrect: phone number, customer-name!, order#amount

First column

The first column must contain each recipient’s identifier: a phone number or a BSUID. For phone numbers, it is mandatory to include the international code without the + symbol (for example, for a number in Ecuador, write PHONE_NUMBER).
BSUID cannot be used to send AUTHENTICATION (OTP) templates; that recipient must be sent as a phone number. If a row with a BSUID targets an AUTHENTICATION template, that row is skipped from the send without affecting the rest of the file.

Remaining columns

The other columns will be used for the dynamic values of the parameters (template personalization).

Example

If your template contains the following content:
The CSV file would be:
The CSV file must be encoded in UTF-8.

Send HSM from file


File upload options

There are two ways to provide the CSV file with recipient information:
  1. Using a public URL: You can provide the URL to the CSV file that is publicly available. In this case, the request body must be in JSON format.
  2. Uploading the file: Alternatively, you can attach the CSV file directly to the request. In this case, the request body must be in multipart/form-data format.

Body parameters


Request examples

By file upload method

By template type

Each example uses a CSV file published at fileUrl whose columns match the ones listed in params.
Template: Hi {{1}}, your order {{2}} is on its way.

By scenario

These examples show the JSON request body. Send it to the same endpoint with the Content-Type: application/json header.
Each button whose payload.type is edge takes the recipient to the workflow set in skillId. The action text must match the button text in the template.
The URL suffix is taken from the CSV column set in payload.param. For example, if the template defines the URL https://requests.example.com/{{1}}, each recipient gets their own link.
For templates with a variable in the text header, set the CSV column in headerParameters.
With actions.setSkill, the recipient’s reply is routed to the specified workflow.
Use {column_name} as the value to take the data from that CSV column. setMemoryParams saves the values in the user memory, and crmParams saves them in CRM fields.
Use date to schedule the campaign for a date and time in UTC.

Send responses


params structure

Each element in the params array is an object that contains:
  • param: Parameter number in the template (1, 2, 3…).
  • column: Name of the column in the CSV file from which values will be extracted.
headerParameters uses the same structure, but accepts only one element.

buttonParameters structure

Each element in the array configures one template button. Quick reply (QUICK_REPLY):
  • payload.type: Button target. edge triggers a workflow and flow triggers a flow.
  • payload.action: Button text. Must match the text defined in the template.
  • payload.skillId: ID of the workflow to trigger. Required when payload.type is edge.
  • payload.flowId: ID of the flow to trigger. Required when payload.type is flow.
  • payload.cardIndex: Position of the card the button belongs to, starting at 0. Carousels only.
To get the skillId of a workflow, hover over the workflow name in Brain Studio. A tooltip will appear showing the corresponding ID.
Dynamic URL (URL):
  • param: Number of the URL parameter in the template.
  • payload.param: CSV column with the value that completes the URL.

cards structure

Each carousel card is an object with:
  • mediaUrl: Public URL of the card image or video.
  • params: Card body parameters, with the same structure as params. Use an empty array if the card has no parameters.
  • buttonParameters: Card buttons. Each payload must include cardIndex.

actions structure