DEV Community

Cover image for How to Use a Local SMS Service Provider Other than Twilio With Customer.io
Adebola
Adebola

Posted on

How to Use a Local SMS Service Provider Other than Twilio With Customer.io

If you’re running a Business in Africa, you know that every cent counts.

While I love Twilio, and I’m always impressed by their delivery rates, the truth is that at $0.1982 per SMS, it’s expensive to use for early-stage startups whose revenues aren’t based in USD.

I’m a big fan of customer.io and the power it packs and as such it’s something we use a lot at Moni for automating our Marketing campaigns and running in-app and push notifications. I still think that African Startups pay too much for tools — especially startups whose revenues aren’t based in USD, but this is a topic for another day.

Customer.io has a direct integration with Twilio and it’s easy to set up that integration. If that’s something you’re interested in, follow the customer.io docs here.

In this tutorial, we’ll be using a local Nigerian SMS Service provider Sleengshort to send SMS’ to users on our platform. You can follow along with this tutorial without a Sleengshort account. Simply make sure that you have the following;

  1. A registered sender ID with your SMS provider

  2. An API Gateway you can connect to, to trigger the SMS

  3. A customer.io account and basic knowledge of customer.io

Let’s get into it.

First, log in to your Sleengshort account to get your Sender ID and API Keys. You can find both from your Sleengshort Dashboard by going to Settings > Sender ID and Settings > API Keys.

In the Settings > API Keys section, create a new API Key by clicking Add new Key. Give it a name e.g customer.io. Feel free to leave the callback URL and Route/bind options blank. To learn more about both, you can refer to the sleengshort docs here. Once your API keys and sender ID are set up, head over to customer.io. We’ll be using the customer.io Webhooks feature for this integration. To learn more, customer.io has some great documentation here.

Within Customer.io, head to Campaigns > Create Campaign > Give the Campaign a name. I believe these steps would also work for a broadcast. Setup your Campaign with your triggers > Settings > Goal & Exit. The real magic begins in the workflow section. You should end up on a screen like below

Click, hold, and drag the send and receive data block on the left into the large Drag your first block here section. Your screen should look like below;

You can now make changes to the Webhook 1 section by clicking it. Click Add request in the slider that pops up.

The Add request button will bring you to the screen below. The screenshot below already contains the URL to the Sleengshort APIs.

You also need to add the headers. The headers will contain the authorization keys Sleengshort’s APIs expect to receive. Click the Add header button and add the following fields.

Name -> X-Api-Key

Value -> your_api_key_from_sleensghort_starting_with_APPKEY

Sleengshort and Customer.io

Once done, use the fields above in the editor. I’ve also repeated them below.

{
"sender_id" : "Your Sender ID",
"recipients" : {{customer.phone_number}},
"msg" : "Hello {{customer["First Name"]}}, welcome to our Company",
"type": 0
}
Enter fullscreen mode Exit fullscreen mode

Make sure that each key and value is wrapped in a double quote " " to avoid errors in your messages sent. Also, use the + button next to each field that your users in your segment already have to add the recipient’s phone number and to add details like the customer’s name and other custom fields to the “msg” field. Click the send test button at the top to test that everything works fine. Make sure the test message is being delivered to a phone number you have access to.

If you get anything other than a 200 and ok response, you’ll need to make sure that you have setup everything correctly as show from the beginning of this tutorial.

Finally, click done and review your workflow before starting the campaign. Engineering teams can easily set up this workflow for their marketing teams. In the future, if the marketing team needs to start another campaign, they can simply duplicate the webhook settings by clicking the copy from workflow button and searching for the previous campaign that contains the webhooks setting.

And that’s how you save your company thousands of every month on Marketing SMS by using a local SMS provider other than Twilio!

Top comments (0)