How to Schedule a Campaign via Termii API
By: Termii Inc.
Tags: Api Integration, Messaging, API, Sms Marketing, Developer

Introduction

Termii helps businesses easily engage — connect and verify their customers anywhere, across channels like SMS, voice, email, and WhatsApp.

Termii provides APIs to make communication with your customers seamless and effective.

Have you always desired to send a campaign via API (Application Programming Interface) to enable a more dynamic and automating power? This detailed guide covers how to schedule an SMS campaign via Termii’s Campaign API.

Authentication

Termii API uses API keys to authenticate HTTP requests by our users. Every API call you make is authenticated by including your API key in the body of the HTTP request.

You can view and manage your API key on your Termii dashboard. If you do not have one yet, kindly visit accounts.termii.com to register.

Scheduling a Campaign via API

You can schedule a campaign using the following steps:

Create a Phonebook Upload contacts to the Phonebook Send a campaign to Phonebook

Create a phonebook

First, you need to create a phonebook you want to send a campaign towards. If the phonebook already exists on your dashboard, skip to the next step. Otherwise, please, continue reading.

Termii provides a Phonebook API to help create a phonebook.

Endpoint: https://termii.com/api/phonebooks

Request Type: POST

Body parameters:

A code sample in node js

Response after calling the phonebook create an endpoint

You can visit our documentation page to view code samples in other languages.

Upload contacts to phonebook

Once your phonebook has been created, the next step is to upload contacts to your phonebook. If you already have contacts uploaded in the phonebook you can skip to the next step or continue reading to know how contacts can be uploaded via the API.

Termii provides a Contact API to help upload contacts to your phonebook. To start uploading, get the ID of the phonebook you want to upload your contacts. You can simply do that by making a ‘GET’ request which returns all the phonebooks with their respective IDs:

Endpoint: https://termii.com/api/phonebooks?api_key=YourAPIKey

Request Type: GET

Sample of the response after making the request

Once the ID of the phonebook has been gotten, we begin uploading the contacts to the phonebook.

Endpoint: https://termii.com/api/phonebooks/{phonebook id} /contacts

Request Type: POST

Body parameters:

A code sample in node js

Response after calling the contact upload endpoint

You can visit our documentation page to view code samples in other languages.

Send a Campaign to a Phonebook

Now that you are done uploading contacts to your phonebook, the final step is to send a campaign.

There are two (2) types of campaigns that can be sent:

Regular campaigns

Scheduled campaigns

Regular Campaigns are sent immediately, while Scheduled Campaigns are sent at a later date or scheduled time.

Termii provides an API to help send your campaigns to a phonebook.

Endpoint: https://termii.com/api/sms/campaigns/send

Request Type: POST

Body parameters:

A code sample in Node.js

Response after calling the send campaign endpoint

You may further visit our documentation page for more information on how to use our APIs to communicate seamlessly with your customers.