1. Introduction about Batch structure

  1. All phone numbers should include the country prefix in E.164 format
  2. All phone numbers should have contact_number as the header
  3. All other variables can be included in the CSV file in separate coloumns

example_batch_file.csv
contact_number,first_name,last_name
+11231237890,Bruce,Wayne
+91012345678,Bruce,Lee
+00021000000,Satoshi,Nakamoto
+44999999007,James,Bond

2. How to Export a CSV file from Excel or Google Sheets for Batch

In Excel, when you type a + at the beginning of a cell, Excel interprets it as a formula. To ensure the plus sign + is retained when entering phone numbers with country codes,
please add an apostrophe (') before the plus sign.

Download an example CSV file


3. Step by step tutorial to use Batch APIs

i. Create a batch for agent

Once the CSV file is ready, upload it using the Create Batch API

curl --location 'https://api.bolna.ai/batches' \
--header 'Authorization: Bearer <api_key>' \
--form 'agent_id="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"' \
--form 'file=@"/my-first-batch.csv"'

ii. Scheduling the batch

After receiving your batch_id, you can schedule a batch using Schedule Batch API

The scheduled date and time should be in ISO 8601 format with time zone.

curl --location 'https://api.bolna.ai/batches/abcdefghijklmnopqrstuvwxyz012345/schedule' \
--header 'Authorization: Bearer <api_key>' \
--form 'scheduled_at="2024-03-20T04:05:00+00:00"'

iii. Retrieving batch status

Check the status of the batch using Get Batch API

curl --location 'https://api.bolna.ai/batches/abcdefghijklmnopqrstuvwxyz012345' \
--header 'Authorization: Bearer <api_key>'

iv. Retrieving all batch executions

Once the batch has run, you can check all executions by the agent using List Batch Executions API

curl --location 'https://api.bolna.ai/batches/abcdefghijklmnopqrstuvwxyz012345/executions' \
--header 'Authorization: Bearer <api_key>'

4. Example Batch Application using the above flow with APIs