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
- 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.
- 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 } |
Note:
- 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 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.
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 more at Automating business process using Kaizala Flow connector)
Thank you for reading. Hope that was helpful. Please let me know what you think by adding a comment.
Can we get notified in any way of all messages being sent (not only to groups but also to individuals?
LikeLike
Webhooks / APIs could be used only in the context of groups. But you could send a message / action directed to a particular user (subscriber) in a Hub and Spoke group.
LikeLike
can we do something with the access token so that after 24 hours it automatically get updated in the client side
actually what i am doing currently through api i am sending an action card to individual in a group by hitting api in another response card with the help of access token but after 24 hours it get invalid so what is the solution of this??
LikeLike
Request you to kindly mail the scenario you have implemented along with the ask to kaizaladev@microsoft.com
LikeLike