Kaizala: Developer Blog

Kaizala

Move SMS notifications to Kaizala

A lot of organizations / companies send SMS to their clients / employees to keep them notified. One common ask among Kaizala enthusiasts is how to cut use Kaizala instead. In this post, I will demonstrate how this could be achieved.

In Kaizala, all communication via APIs happens within the context of a group (API endpoint cannot initiate a 1:1 conversation). Broadly, there are 2 types of groups –

  • Hierarchical group – which can either be part of a hierarchy / be standalone. But all contents posted in this group will be visible to all members of the group.
  • Managed Hub and Spoke group / Public group – where there are 3 kinds of users who can be part of the group: administrators, members and subscribers. Contents posted by admins / members would by default be visible to all subscribers. But, there is a provision to send a content directed to particular subscriber(s).

To send a notification to a particular user, we could leverage #2 above where we could send a text message / action directed to the user. Below are the steps involved:

  • Create a Hub and Spoke group / managed public group from Kaizala management portal at https://manage.kaiza.la/PublicGroups/PublicGroups
  • Add the users you want to notify as subscribers to the group. There are 2 ways of doing this
    1. On the group page, you could click on Manage Subscribers and select Add Subscribers from the menu. Upload a csv with the subscriber phone numbers.
    2. Generate invite link and have users join the group by clicking the link

Kaizala API

Below is the API payload / contract to be used:

Method POST
URL {{endpoint-url}}/v1/groups/{{public-group-id}}/messages
Request Headers
accessToken {{access-token}}
Content-Type application/json
Request Body {
Message:”Message to subscriber here”,
subscribers:[ “{{mobile-number}}” ],
sendToAllSubscribers:false
}

Notes:

  • Elements in curly / squiggly brackets need to be replaced
    • endpoint-url is present in the response to generate accessToken call.
    • public-group-id is the group id of the Public Group you have created (screenshot below to help you with how to get group id).
    • access-token is required for authentication. If you are not familiar, please refer to the previous blog Getting started with Kaizala APIs.
    • mobile-number is the number of the subscriber to whom the message is targeted.
  • Make sure the sendToAllSubscribers field is set to false.
  • The subscribers field is an array, so you can input a comma separated list of numbers to which the message is intended.
  • If the subscribers array has a number that is not a subscriber, the request would fail.

To get the group id, go to your group on https://manage.kaiza.la and select the identifier at the end of the URL as shown in the animation below.

GIF showing how to select the group ID

Kaizala Flow Connector

In case you were using Microsoft Flow, you could use the Kaizala Flow connector, select the Show Advanced Options and enter the subscriber number in the Subscribers field. (Microsoft Flow is an online workflow service – you could read the blog Automating business process using Kaizala Flow connector)

Send text message to group dialog box

Thank you for reading. Hope that was helpful. Please let me know what you think by adding a comment.

filter-icon