Discoverable Group Channels (Backend Work):
- Each discoverable group channel will carry the following custom attributes:
topic: string
org_uuid: string
description: string
locked: string
imageUrl: string
groupChat: bool
discoverableGroup: bool
- For unlocked group chats, mobile clients can add themselves as a member to the channel when 'Join Group' is pressed.
- For unlocked group chats, mobile clients can remove themselves as a member from the channel when 'Leave Group' is pressed.
- If channel members limit is reached, the mobile client must throw a client-side "max limit reached" error when joining. Maximum member count for a group is 250.
- Mobile client shouldn't change custom_attributes on a channel.
- Mobile client shouldn't delete a channel.
- To get a list of all discoverable channels in a organization, run the following query (cherry pick whatever field you are interested in). Note that you are only able to call
discoverableGroupChats
on organizations the current user is accepted into.
{
organization(uuid: "34f6ffef-ffaa-4964-8112-14580071bff5") {
discoverableGroupChats {
edges {
node {
organization {
name
}
sid
imageUrl
channelType
dateCreated
dateUpdated
customAttributes
membersCount
locked
topic
description
pendingRequestToJoin
sampleMembers {
edges {
node {
name
profilePhoto {
url(size: 40)
}
}
}
}
}
}
}
}
}
locked
tells you whether the channel is locked or not. pendingRequestToJoin
returns true
in case there is an existing req-to-join-channel entry for current user for that channel.
- To get the list of joined channels for the current user pass an array of channel SIDs to
joinedGroupChannels
field: (joined group channels returns an array ofTwilioDiscoverableGroupChannel
objects).joinedGroupChannels
can only be called for the currently logged in user.
{
me {
joinedGroupChannels(sids: ["CH8011bb5a82d64b9ab6a11c4527fd0c52"]) {
sid
topic
...
}
}
}
- If the channel is
locked
, the client needs to callcreateNotificationRequestToJoinGroupChat
mutation to request to join that channel. Simply pass channelSID as an input to mutation. Example:
mutation {
createNotificationRequestToJoinGroupChat(input: {
clientMutationId: "aaa",
channelSID: "CH6a4623aafe62499785627f52f2564ac2"
}) {
me {
name
}
}
}
- To cancel an already issued request-to-join-channel entry, call
destroyNotificationRequestToJoinGroupChat
mutation and pass a channelSID. Example:
mutation {
destroyNotificationRequestToJoinGroupChat(input: {
clientMutationId: "aaa",
channelSID: "CH6a4623aafe62499785627f52f2564ac2"
}) {
me {
name
}
}
}
Upon receiving this mutation, backend will look for an existing channel-join-request for that (logged-in-user, channelSID) pair.
Both createNotificationRequestToJoinGroupChat
and destroyNotificationRequestToJoinGroupChat
mutations return the current user as a response payload.