SendBatch

SendBatch API is used to create a batch (bulk) send in the system.

The typical steps to send a batch are as follows:

1. Create a template via REST API or through the admin panel (or use existing Template ID parameters). Please use template->create APIs to create a template.

2. Use this API to send data and a template to match. The system will merge the data (many rows in a single file) with the template and create content to send. The matched template could be an Email, an SMS or a Mobile Push template. 

Please note that if the template given is an Email, that data will be merged with an Email template and MIME content will be produced. If it is an SMS template, the merged data will be a text message.

Body Params
string

A user can be authorized to multiple accounts. If a user which used to access this api method, has access to multiple accounts, this parameter must be set. Otherwise, you dont need to set this parameter.

string
required

External id to define the template to be used for the batch. When you create a template, you can assign this unique id to the template. If you don't, the system will assign a new public id for the template

string
required

It is required to keep track of batch. In other word, it is the id of your bulk batch and you must set it. A typical example for batch-id is your send id or your campaign id

string
Defaults to 0

The size of your batch file(in batchFile parameter) may be huge like 10GB!. This parameter helps you seperate your batches into parts. So you can send your batches in part like 0,1,2,3. For instance, you can seperate a batchFile with 10M rows into 10 parts (each 1M rows) and send in different calls.

Please use this parameter if there are multiple batch files for same delivery. Default value: “0”

string

batchFile parameter contains a line-by-line file with data in it. This file can be CSV or JSON.

fileHeaderMap defines the header line for that file which defines the columns in batchFile parameter. For instance,

Message-ID;To;Name;Surname

is a typical header for this field. Message-ID and To columns are special columns in fileHeaderMap. Message-ID assigns a unique id for each of your messages. To defines the recipient. In fact, To is the only required parameter in the header.

Important System-Wide Columns

*Please note that the column names are case-sensitive!

To: (Required) The recipient of the message. For email batches, this column defines email address. For mobile text(SMS) messages, this column defines is mobile number to send the message to.

Message-ID: We strongly suggest you to include Message-ID header in your data. Since we may be creating millions of messages (each line in batchFile stream defines another message) you may need to assign a unique id for each message. Message-ID is used for this purpose. This is strongly recommended but an optional parameter.

Cc: This column is used to add addresses for Cc in the email templates

Bcc: This column is used to add addresses for Bcc in the email templates.

User-Defined Columns

You may add your own columns specially for 3 reasons:

  1. To render some variables on the templates line Name, Surname, etc
  2. To execute some logic on the template. For instance, you put Gender column and based on gender, you can change your template colors, parts etc.
  3. Columns starting with X-: This columns are outputted to reports. For instance, you can add X-Member-Id and this column will be outputted in every report you will get back from the system.
string
Defaults to ;

The delimeter used to seperate the columns in batchFile stream data. The default value is ';' and this parameter is used for CSV formatted batchFiles

No need to set it for JSON formatted data.

string
enum

The schedule for the batch. If you want to send your batch now, you should not set this field.

If you set it please set the variable like in the example.

Allowed:
string
enum

It is used to determine beginning of available hours for delivery. Multiple values may be set with -(dash) Format: hhmm-hhmm E.g. 1200-1530

If you set multiple values, finishTimes must be set.

For instance the setting

startTimes:0930-1330 finishTimes:1230-1830

allows the system to send the campaign between 0930-1230 and 1330-1830.

Allowed:
string
enum

It is used to determine end of available hours for delivery. Multiple values may be set with -(dash) Format: hhmm-hhmm E.g. 1200-1530

Please read startTime for more examples.

Allowed:
string

This parameter lets you adjust the speed of delivery. Unit is message per minute. This is an optional parameter. If you do not set it, the system uses its default settings in the configuration which is fast sending.

boolean
Defaults to false

This field is used in mobile text(SMS) messages to define OTP messaging. For example, For SMS, value of ‘TRUE’ refers to OTP. Default value: False

file
required

The data file for the batch. You can send JSON or CSV formatted text files with this field. Please do not send any other files.

Each line in batchFile defines another message. For example a typical CSV formatted example:

fileHeaderMap

Message-ID;To;Name;Surname

batchFile

1000001;[email protected];James;Bond

1000002;[email protected];Shila;Stones

1000003;[email protected];Arnold;Ronaldo

1000004;[email protected];Ren;Dong

This batchFile body above will create 4 messages in the system.

If the file type is CSV, the header line of this file is in fileHeaderMap field and the delimiter to seperate the columns is in delimiter field.

For JSON files, no need to give fileHeaderMap or delimiter fields.

Headers
string
required

c

string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

401

Please login again to get new token.

403

Please login again to get new token.

Language
URL
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
SUCCESS 1
SUCCESS 2
BAD REQUEST 1
BAD REQUEST 2
BAD REQUEST 3
SERVER ERROR 1