In this post, we are going to discuss how we can send announcements to a select set of users in a broadcast group based on their tenant attributes.
Setting up tenant attributes
In this previous post, we have discussed what tenant attributes are. There are two ways of setting up tenant attributes:
- The tenant admin has the option of setting up the Tenant User List (TUL) while uploading the user details for the first time.
- Alternatively, each user can also update their details by using the KASClient APIs as discussed in this post.
In this post, we will discuss how we can send announcements in a public group to a specific set of users based on tenant attribute filters. In scenarios where Kaizala is used by government to reach out to citizens, situations may arise when it might want to send it out to a specific set of citizens. An example might be to send out a flood alert to government offices of coastal districts, or issue specific instructions to the police officials of a state regarding local law and order maintenance. Another common example is in the healthcare industry where the management needs to send an important announcement to only the doctors of a ward in a hospital. Similar examples can exist in banking sector as well as in airlines, thereby making targeted messaging a very powerful scenario.
Important Note: Note that targeted announcements cannot be used in flat groups as every communication is visible to all members. It can only be used in broadcast groups.
Tenant Attribute Filters
A binary expression (of type KASClient.BinaryExpression) has the attribute (KASClient.Attribute) on the left hand side and attribute value (KASClient.Value) on the right, bound together by a relationship which is known as an operator (KASClient.Operator). It depicts a relationship between an attribute and its value. The relationship can be comparisons like equals, greater than, less than, contains etc.
A binary expression can also be combination of other binary expressions as shown below:
A Tenant Attribute Filter is a binary expression depicting one or more different binary expression rules. Tenant attribute filter is the final expression which is passed as a parameter with the request and determines the set of people who receive the request.
Binary expressions and attribute filters are explained in the below diagram:
What is an announcement?
An announcement is a request response card where there is no option for a receiver to submit a response. So, at the end of the day, an announcement is a request that is submitted by the admin and shows up in the chat pallet of the subscribers for viewing. So, we can use a submitFormRequest API to create an announcement directed to all subscribers in a broadcast group:
Submitting an announcement with attribute filters:
On the other hand, to submit an announcement with attribute filters, (meaning that the announcement request will only reach subscribers with the particular set of attribute values provided in the filter), we use the submitFormRequestWithAttributeFilter API as follows:
The API accepts the form (which has the properties like description, images, audio and documents) along with msgfilter which is of type KASClient.TenantAttributeFilter created from a binary attribute:
Once submitted, the announcement shows up in the pallet of users whose tenant attributes matches the attribute filter. We have kept a text property in the summary view which says the set of users for whom the announcement is sent to thereby marking it important.
We have created an announcement card which an admin can use to direct announcements to a specific set of users in the group. He can either send the announcement to everyone or configure tenant attributes and send the announcement.
The attribute values will be matched with the data present in the tenant and thereby available to only those subscribers for whom the tenant attributes match the rules set by the admin. The possible attribute values are being picked from settings file and the details are matched with those in the portal.
The announcement is received by the intended set of users – this helps communicate selectively in large broadcast groups, without the need to create separate groups for separate sets of users, thereby improving manageability. You can download the card from here.