Bongolive Bulk SMS api use case.

Justine Peterson Mahinyila
4 min readJan 8, 2020

--

Image Credit:Bongolive.co.tz

Hello again, Recently i discovered the power that lies in bulk sms marketing after approaching a number of telecoms and seeing how difficult it was to work with them i decide to look for another option bulk sms service providers, which lead me to the discovery of Bongolive.co.tz, and i must say this guys are the best in bulk sms.

Now to cut the blah blahs shot, in this blog post i am going to share with you step by step how you can use their bulk sms api to send sms to large number of people using javascript’s nodejs engine.

And let’s get started with the following few steps…

Step 1:Registrations to bongolive.co.tz

1. Create a free ‘Broadcaster’ account on www.bongolive.co.tz

2. On completing your registration you will get a confirmation email. Click on the link or paste the link into your browser to validate the account.

3. Log into your account with your username & password on www.bongolive.co.tz

4. Request credits for your account by visiting the ‘Purchase SMS’ tab. Follow the onscreen instructions to arrange for payment of the credits.

5. Click on the ‘Broadcast SMS’ then click on ‘Manage Sender Names’ to request any ‘Sender Names’ that you would like to use.

6. Visit the ‘Profile’ tab and get your API key.

7. Once you have credits in your account and you have an API key. You can start sending messages using the connection options and parameters as i am going to show you bellow.

step 2:Building the nodejs api

I have chosen nodejs for a number of reasons most being personal reasons but you can use any programming language/technology of your choice just checkout the there documentations for instructions on how to go about it.

  1. If you do not have nodejs installed in your systems go ahead and install it by following the instructions on the nodejs.org site per your operating system
  2. Open terminal and create a directory where you want your appliaction to reside by typing the commands

mkdir bongo-live-sms

then navigate to directory

cd bongo-live-sms

from the directory initialize nodejs application by typing

npm init -y

and a package.json file will be created at the root of your bongo-live-sms directory,which looks similar to this:-

{"name": "bongo-live-sms","version": "1.0.0","description": "","main": "index.js","scripts": {"test": "echo \"Error: no test specified\" && exit 1"},"keywords": [],"author": "","license": "ISC"}

Inside the the our bongo-live-sms folder create a file called index.js

touch index.js

3.Now it is the time to create our actual app ,since we will be using a express to create our server we must install express through the terminal with the following command

sudo npm install express 

Now lets create an express server copy the following code and paste it to our index.js i will explain each and every

//remember the express package we installed now we are going to //require it with the bellow line of code
const express = require("express");
//the we initialize our app with express
const app = express();
//test route
app.get("/",(req, res) => {
res.send('Hello from bongo-live-sms-server')
});
//initalizing port variable
const port = 4000 || process.env.PORT;
//setting up our app server to the port
const listener = app.listen(port, function () {
console.log("Your app is listening on port " + listener.address().port);
});

Now run the server by typing the following command to terminal

node index.js 

Go to the address localhost:4000 and see if the browser prints Hello from bongo-live-sms-server

If that is the case then our server is perfectly connected and running…yeee :)

Step2: Building the actual thing…

Now lets go and create our bongo-live-sms and send an sms to our client contact.

Copy the following get request route code and paste it to bellow our test route above,

app.get("/sendsms", async (req, res) => {      const options = {

method: "GET",
url: "http://www.bongolive.co.tz/api/sendSMS.php?",
qs: {
sendername: +255xxxxxxxxx,
username: "your bongolive user name",
password: "your bongolive password",
apikey: "your bongolive api key",
destnum: +255xxxxxxxxx,
message: "Your message",
senddate: "",
format: "json"
}
request(options, function(error, response, body) {if (error) throw new Error(error);
res.send(response.body);
});
});
});

Go to the browser and run localhost:4000/sendsms , observe your destination phone within few seconds you will see a your message being delivered…and yeee! :) we made it….

Yeah so our purpose to send an sms to one user has been possible and successful there are other business scenarios that you would want to work on regarding bulk sms one being how do you send sms to a bulk number, this will be covered in the next blog post. Thank you for reading.

--

--

Justine Peterson Mahinyila
Justine Peterson Mahinyila

Written by Justine Peterson Mahinyila

My mission is to improve people’s lives and solve problems using technology in Africa

No responses yet