This will be helpful for altering the default message template for the group.
Note: If the template is sent as blank, then no alert notification is sent to devices and receive message silently.
Update metadata of the group as the following property keys:
CREATE_GROUP_MESSAGE
REMOVE_MEMBER_MESSAGE
ADD_MEMBER_MESSAGE
JOIN_MEMBER_MESSAGE
GROUP_NAME_CHANGE_MESSAGE
GROUP_ICON_CHANGE_MESSAGE
GROUP_LEFT_MESSAGE
DELETED_GROUP_MESSAGE
GROUP_USER_ROLE_UPDATED_MESSAGE
ALERT
HIDE
Following place holders will be replaced:
- :adminName = admin name of the group
- :groupName = group name
- :userName = user name for which the action is performed
- :role = role of user
Difference between "Add a Member" and "Join Group":
- When the group admin adds a member, then ADD_MEMBER_MESSAGE will be displayed
- When a user searches and adds himself to the group, then JOIN_MEMBER_MESSAGE will be displayed. This is called self-join.
- Self-join works only in public/open groups, not for private groups
If you perform the group create, update, add member, remove member etc actions in the group, then these messages are used to display the action in the group chat:
{
"metadata":{
"CREATE_GROUP_MESSAGE":":adminName created group",
"ADD_MEMBER_MESSAGE":":userName joined group",
"GROUP_USER_ROLE_UPDATED_MESSAGE":":userName is :role now"
}
}
Example:1
Use below format for displaying messages in chat list without showing any explicit notification:
{
"groupName" : "GroupName",
"groupMemberList" : ["user1","user2"],
"metadata":{
"CREATE_GROUP_MESSAGE":"",
"ADD_MEMBER_MESSAGE":"",
"GROUP_NAME_CHANGE_MESSAGE" : "",
}
}
Note
-
If Alert metadata is configured to false no explicit notification send to iOS devices.
-
For Android device messages in the message list will come with metadata having key show with value false so the android explicit notification can be handled.
Example:2
-
If having any customize message for different metadata and want to add those messages in chat messages list but don't want explicit notification.
-
Basically, messages will add to device silently:
Use below sample:
{
"groupName" : "GroupName",
"groupMemberList" : ["user1","user2"],
"metadata":{
"CREATE_GROUP_MESSAGE":"Message in different language",
"ADD_MEMBER_MESSAGE":" :adminName Ne Group :groupName me add Kiya :)",
"GROUP_NAME_CHANGE_MESSAGE" : "Message in different language",
"ALERT": "false"
}
}
Note
-
If Alert metadata is configured to false no explicit notification send to iOS devices.
-
For Android device messages in message list will come with metadata having key show with value false so the android explicit notification can be handled.
Example:3
If you want to filter messages not to be displayed in chat message list, use below sample:
{
"groupName" : "GroupName",
"groupMemberList" : ["user1","user2"],
"metadata":{
"CREATE_GROUP_MESSAGE":"",
"ADD_MEMBER_MESSAGE":"",
"GROUP_NAME_CHANGE_MESSAGE" : "",
"HIDE": "true"
}
}
Note
-
In this case, Group created, add, remove and name change messages will come with metadata hide with value true in message list API call.
-
So you can filter out these messages.