Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
SDK now supports querying channels based on provided channel IDs. The ChannelRepository
class includes a getChannels
method that takes an array of channel IDs as input and returns a live collection of channels. This live collection will contain all the channels that are being queried in the first page. This live collection will not support pagination.
Any update to the channels present in this live collection will be automatically notified to the user. Furthermore,
This live collection will only contain valid channels. In case of invalid channels (such as user gets banned etc.) the list may exclude those channels.
If any channel id is invalid, live collection will throw error.
💡 The maximum number of channel that can be queried is 100.
Limitations:
If the channel is not public and user leaves the channel, the channel will still remain in the live collection until user refresh or resets the live collection.
ChannelRepository
offers a function to create a new channel. This function provides support for creating three distinct types of channels, including Community
, Live
, and Conversation
. Each channel type has its own unique characteristics and capabilities as we explained earlier, and the create channel function allows users to easily create and customize channels to suit their specific needs.
The SDK offers two standard ways for creating channels. The first method involves specifying a specific channel ID during the channel creation process. The second method allows for the automatic generation of a unique channel ID. The create channel API is designed to ensure that the channel being created is a new channel, and in the event that the requested channel already exists, it will return a conflict error (400900). The channel ID parameter in the channel creation function may be left undefined, in which case the SDK will automatically generate a unique channel ID to avoid any conflicts with existing IDs.
This function on the SDK allows you to create a new #community-channel. The displayName
parameter is a required field, and it represents the public display name of the channel.
Here is a brief explanation of the function parameters:
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
isPublic
- Specify visibility for the community channel that public or private community.
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
Similar to community channel creation function, the function allows you to create a new #live-channel. The displayName
parameter is a required field, and it represents the public display name of the channel.
Here is a brief explanation of the function parameters:
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
Version 6
Beta (v0.0.1)
The #conversation channel creation function can also be utilized to create channels of the Conversation type. However, it should be noted that the channel ID for these channels will always be generated by the SDK. This ensures that the channel ID is unique and avoids any potential conflicts with existing channels
Here is a brief explanation of the function parameters:
userId
: The userId of the user that you'd like to chat with.
displayName
: The public display name of the channel.
avatarFileId
: The image fileId that represents the image of the channel.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the channels.
Conversation channel is unique based on its membership. When creating conversation, the system will check if a channel with the same membership already exists. If such channel already exists, the system will return the existing channel instead of creating a new one.
Version 6
Beta (v0.0.1)
#broadcast channel can only be created from Amity Social Cloud Console. We recommend to see instructions in #create-channel on how to create a Broadcast channel.
The getChannels
function is a powerful function that allows you to search for and retrieve channels that match specific criteria. With this function, you can quickly and easily find the channels you need.
The function accepts several parameters that allow you to customize your search. The keyword
parameter is a string that specifies the search query, allowing you to search for channels based on their displayName
.
Once you have made your query, the function returns a of channels that match your query criteria. You can use this collection to display the search results in your app, or to further filter the results as needed.
You can query channels with the following criteria:
keyword
: Specify keyword that should be in channel displayName
includeDeleted
: Specify whether to search for channels that has been closed. Possible values are:
null
(default) - Show both channel is active and closed.
false
- Search for channels that is still open
tags
: Search for channels with the specific tags. If more than 1 tags are specified in the query, system will search for channels that contain any of those tags.
excludeTags
: Search for channels without the specific tags. If more than 1 tags are specified in the query, system will search for channels that does not contain any one of those tags.
filter
: Membership status of the user. Possible values are:
all
(default) - Search for channels
member
- Search for channels that the user is a member of
notMember
- Search for channels that the user is not a member of
flagged
- Search for channels that the user flagged
types
: type of channel to search for - conversation
, broadcast
, live
or community
userId
: Search for channels that is created by a given User ID
If you use a UITableView
or UICollectionView
to display channel list data, the ideal location to reload table data is directly in the observe block of the live collection that you are displaying.
Version 6
Beta(v0.0.1)
The joinChannel
function allows users to join a channel, making them a member of the channel. This function takes one parameter, channelId
, which is the ID of the channel that the user wishes to join.
Once the user joins the channel, they will be able to participate in conversations and receive updates about the channel's activity. It is important to note that this function is idempotent, which means that it can be called multiple times without causing any issues. If the user has already joined the channel, a successful result will still be returned.
Version 6
Beta (v0.0.1)
The leaveChannel
function is used to disengage a user from a channel by removing them from the list of members. This function takes the channelId
parameter, which specifies the ID of the channel that the user wishes to leave. Once the user has left the channel, they will no longer receive any messages or updates from the channel.
Version 6
Beta (v0.0.1)
When a user joins a channel, they are able to observe and chat with other users in that channel. They are also automatically considered a member of that channel. The Chat SDK provides the ability to view which users are currently in the channel as well as invite other users to join the channel.
Each channel is identified by a unique channelId
, which is any string that uniquely identifies the channel and is immutable through its lifetime. When creating channels, you can specify your own channelId
, or leave it to Amity's Chat SDK to automatically generate one for you.
It's important to note that, createChannel
guarantees that the requested channel is a new channel (except for conversation
type), whereas joinChannel
will attempt to join an existing channel. If there is a requirement to create a new channel, then use of createChannel
then call joinChannel
. Lastly calling getChannel
only gives you back the channel LiveObject, but it won't make the current user join said channel.
You can observe the channel to determine changes in the membership status. If the user is banned from the channel, you would want to show the particular UI and move from the chat screen.
For example, in the event of a channel-ban, it's possible to implement the appropriate user interface, navigating the user to be redirected away from the chat screen.
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
Our channels enable developers to implement different types of chat messaging capabilities into their applications easily
In this section, we will cover the concept of channels in Amity Chat SDK and how to use them to enable different types of chat messaging capabilities in your application.
Please be aware that there is some incompatibility between SDK version 5 and version 6 regarding the Subchannel feature.
Applications using SDK version 5 cannot view messages sent to subchannels by SDK version 6.
Channels can be sorted by 'Last Activity', which means that if messages are sent to SDK version 5 in subchannels, it moves the channel to the top of the collection. However, while the order will be updated to the top, the SDK version 5 will not display the message.
The concept of "channel and subchannel" is central to understanding how communication is structured in a chat SDK. Channels are the primary containers that hold subchannels, while subchannels are subdivisions within a channel that represent individual topics or chat threads.
The relationship between a channel and its subchannels is hierarchical. A channel serves as a parent container for multiple subchannels, each of which represents a separate conversation or topic. Messages and interactions occur within subchannels, not the main channel itself. This organization allows for easier navigation and management of different conversations within a single channel.
The differences between channels and subchannels are as follows:
Function: Channels act as containers for subchannels, while subchannels are where actual conversations and interactions take place.
Hierarchy: Channels serve as parent containers, whereas subchannels are subdivisions within a channel.
Messages: Channels do not contain any messages directly; instead, all messages are stored within subchannels.
Management: Users can create, update, delete, and query subchannels within a channel, managing each subchannel individually.
Moderation: Moderation actions, such as banning, unbanning, muting, and unmuting users, can be performed at the channel level rather than the subchannel level. This approach ensures that moderation decisions apply to all subchannels within the main channel, providing consistent management across different conversations or topics.
By default, when a channel is created, a corresponding default subchannel is also automatically generated.
Amity's Chat SDK has several channel types with different use cases. Each type is designed to match a particular use-case for chat channels.
The community channel is the default channel type and can be discovered by all users and admins. It acts as a public chat channel that showcases all of the features that our SDK's have to offer.
All users in the network can search for community channel
All users in the network can join the community without an invitation
Support @mention user
Support @mention all users in the channel
Appear on ASC Console for administrator to monitor
Team collaboration
Online gaming
Celebrity fan club
Live streaming
Any type of public chat
Live channels offer the ability for users and admins to create channels with exclusive membership. The live channel is identical to our Community channel in features with the caveat that users will not be able to discover the channel when querying for all channels unless they are already a member of it. However, users and admins can still invite other users to join the channel.
Can only be searched by member
Users can join if they know channel ID
Support @mention user
Support @mention channel users (mention all users)
Appear on the ASC console for administrator to monitor
Chat channel for a one-time Live event
Conversation channels is designed for 1-on-1 messaging and private small group chat. Unlike the other channel types, a Conversation channel can be created simply by knowing the userId of the user we want to converse with. Users can start conversations with any other user and only they will be able to see their conversation.
Each channel has its own list of members, and no two channels can have the exact same member list. If someone tries to create a new channel with the same set of members as an existing channel, the system will return the existing channel. For example creating a new channel with User A and User B will always result in the same channel no matter how many time the create command is called. This is useful when trying to establish a private chat channel between 2 or more users as we want to make sure the user can continue using the existing channel that contains previous messages history.
Channel is always unique with the same set of membership.
Support up to 10 members per conversation channel
Users can not join, leave, be added or removed from the channel once it's created
Users can not ban / unban other users in the channel
Does not appear on the ASC console for administrator to monitor
Does not support @mention user & @mention all
1:1 Chat Channel
Private Group Chat
Customer Support Chat
Channel types can be created through SDK i.e
Community
,Live
andConversation
. Creation ofPrivate
andStandard
type has been removed. Creation ofBroadcast
channel type is not supported through the SDK. But for query,getChannels:
method supports all channel types includingBroadcast
,Private
andStandard
.
The Broadcast channel is heavily adopted by corporate users who constantly promote or advertise their products, or make the announcement to drive awareness. Unlike other channel types, broadcast channels only allow admin users to send messages from Console, and everyone else in the channel will be under read-only mode.
Broadcast message can only be sent out via ASC console
The administrator can choose to send to any community OR live channel (but not to the conversation channel).
Support @mention user
Support @mention channel users (mention all users)
Typical use cases:
Marketing & Advertising
Organizational Announcements
The updateChannel
function allows users to modify the properties of a channel. This function is useful in cases where a channel's details need to be updated, such as changing the channel's display name or avatar.
The function takes a channelId
parameter as a required input, which specifies the channel to be modified. Additionally, users can pass in any number of optional parameters to update the channel's properties. These optional parameters include:
displayName
: The new display name for the channel.
avatarFileId
: A new avatar image for the channel - Used to store ID of image file that represents avatar of the channel. To obtain file ID to set as channel avatar please see section
tags
: Arbitrary strings that can be used for define and query for the channels
metadata
: Additional metadata to be associated with the channel.
metadata
is implemented with last writer wins semantics: multiple mutations by independent users to the metadata object will result in a single stored value. No locking, merging, or other coordination is performed across multiple writes on the data.
Version 6
Beta (v0.0.1)
Amity Chat SDK allows you to easily create full-featured in-app Chat experience
iOS Android Web TypeScript React Native Ionic Flutter
The Amity Chat SDK provides a powerful set of pre-built features to enable in-app social experiences and fuel user engagement. With support for a range of platforms and programming languages, the SDK is a flexible and scalable solution for building messaging apps. We hope this documentation page has provided you with the information you need to get started with the SDK. If you have any questions or feedback, please feel free to contact us via our support center.
We provide a range of pre-built features that enable in-app social experiences and fuel user engagement. Here are some of the main features of the SDK:
Start a new conversation channel with up to 300,000 concurrent participants (actual maximum may varies from selected plan, see for more detail)
View read counts for every message
Moderate conversations with user banning, muting, and rate limiting
Assign moderators and admins via a role-based permission system
Filter out inappropriate content with automated spam filtering and URL whitelists
Manage connection state and handle offline data automatically
Support multi-device and multi-platform for every user
Powerful messaging capabilities for native and web apps
Moderation tools for filtering out inappropriate content
Role-based permission system for assigning moderators and admins
Real-time syncing of messages across all users in a channel
Support for text, image, audio, video, file, and custom messages
Support up to 300,000 concurrent participants in a channel
Channel is a virtual chat room or a group that enables users to send and receive messages in real-time. Channels allow developers to implement different types of chat messaging capabilities into their applications easily, such as private messaging, group chats, and chat rooms.
If you're new to the Amity Chat SDK, the following resources can help you get started:
Messaging is a crucial feature for any chat application, and with Amity Chat SDK, developers can enable real-time communication between users within a chat channel with ease.
The Amity Chat SDK supports several channel types, each designed to match a particular use-case for chat channels. Here's a table showing what features each channel type offers:
Moderation is an essential feature for building a community that encourages user participation and engagement. With Amity Chat SDK, developers can use the moderation feature to assign moderators and admins via a role-based permission system, filter out inappropriate content with automated spam filtering and URL whitelists, and manage user bans.
The Amity Chat SDK supports several message types, including:
Chat experience is more fun when you can express yourself! With Amity Chat SDK, developers can use Reactions feature to allow users to react to messages using emojis, stickers, or thumbs up. This feature can help users express their emotions and opinions, making communication more engaging and interactive.
Text Message
Image Message
File Message
Audio Message
Video Message
Custom Message
In addition to these message types, the SDK also supports message reactions, which can be used to enable users to react to messages in a channel.
Our channels enable developers to implement different types of chat messaging capabilities into their applications easily.
This page highlights the steps you will need to follow to begin integrating chat messaging into your products.
Moderation is an important feature for building a safe community that encourages user participation and engagement.
Interactions are more fun when you can express yourself! Let users react using emojis, stickers, or thumbs up to messages.
For further information about channel realtime events process, please visit .
Channel Object is a Live Object and you can observe real-time changes in Channel Properties. Please see to on how to listen to real-time changes.
Channel Type | Discoverable by | Message Sending Privileges | Moderation Access | Channel Creation |
---|
Channel Type | Discoverable by | Message sending privileges | Moderation access | Channel Creation | Realtime Events Retrieval |
Community | All users and admins | Joined members and admins | All Moderation tools | SDK, Console | Automatic |
Private Community | Joined members and admins | Joined members and admins | All Moderation tools | SDK, Console | Automatic |
Live | Joined members and admins | Joined members and admins | All Moderation tools | SDK, Console | Subscription needed |
Broadcast | All users and admins | Admins | Admin Moderation tools | Console | Subscription needed |
Conversation | Joined members | Joined members | No Moderation tools | SDK | Automatic |
Name | Data Type | Description |
|
| ID of the channel |
|
| ID of the default subchannel that's generated upon channel creation |
|
| Is channel distinct? |
|
| Additional properties to support custom fields |
|
| Type of channel |
|
| Tags used for searching |
|
| Is this channel muted? |
|
| This channel has limited sending rate? |
|
| Number of messages within rate limit |
|
| Channel name for displaying |
|
| Number of members in channel |
|
| Number of messages in channel |
|
| Number of unread messages in channel |
|
| Date/time of user's last activity related to the channel (e.g. add/remove member) |
|
| Date/time the channel was created |
|
| Date/time the channel was last updated |
|
| Avatar file ID |
|
| Public / Private community channel |
Community | All members and admins | Members and admins | All Moderation tools | SDK, Console |
Live | Only joined and invited members and admins | Members and admins | All Moderation tools | SDK, Console |
Broadcast | All members and admins | Admins | Admin Moderation tools (ASC Console) | Console |
Conservation | All members and admins | Members | No moderation tools | SDK |
This function enables users to obtain the current user's total count of unread messages and their mention status across all channels and sub-channels. To retrieve this value, utilize the CoreClient and follow the code pattern below.
Please note that the TypeScript SDK does not yet support retrieving mention status information with this function.
The SDK provides a simple way for clients to retrieve the unread count for a sub channel. To view the unread count for a sub channel, we can get it from a sub channel object. This count represents the number of messages that you have not yet read in that sub channel.
To check if a sub channel supports the Unread Count feature, you can use the following code:
When you send a message to someone, it's important to know whether that message has been delivered to the recipient's device or not. This is where the "Mark message delivered" function comes in.
By calling this function, you can update the status of a message to "delivered", which indicates that the message has been successfully delivered to the recipient's device. This can be useful for ensuring that important messages have been received by the intended recipient.
The parameters for this function are:
subchannelId
: The ID of the subchannel where the message is located.
messageId
: The ID of the message you want to mark as delivered.
In a chat application, it is often necessary to track which users have read a message. The Get Message's Read User function allows developers to retrieve a list of users who have read a particular message. This function can be useful for a variety of purposes, such as displaying read receipts or tracking user engagement with a particular message.
To use this function, you can call the getMessageReadUsers
method, this will return a collection of users who have read the message.
It is also important for users to know whether their messages have been successfully delivered to the intended recipients. The "Get message's delivered user" function allows users to query the list of users who have marked a particular message as delivered. This feature can be useful in scenarios where users need to know whether their messages have reached their intended recipients, such as in a customer service application or a team collaboration tool.
The function takes a message ID as a parameter, and returns a collection of user objects who have marked the message as delivered. By observing the live collection, users can receive real-time updates as new users mark the message as delivered.
To ensure that the message read count is up to date for a subchannel, users need to start reading the sub channel. When a user opens a subchannel, the chat system updates the read count for all messages in that channel, based on the user's reading status. This feature is designed to provide accurate read counts for sub channels, ensuring that users have a clear understanding of which messages have been read and which are still unread
Active reading of a subchannel and letting the chat system know that reading status can update the message read count in that sub channel. The system will update the read count for all messages in the sub channel that the user has not yet read.
To maintain an accurate message read count, users should stop reading a sub channel when they have finished reading it. The chat system updates the read count based on the user's reading status, so if a user leaves a sub channel, they should stop reading to avoid reading new messages.
stopReading
will be called automatically if the internet connection drops or is disconected. It lasts for one minute. This means that if an internet connection drops after one minute, stopReading
will be automatically called, and after it is re-established, startReading
will be called again.
Messages preview is partial data of the message that offers a brief summary of incoming messages through channel and subchannel objects. It allows users to quickly assess partial message content without opening the entire message.
Message Preview is an on demand feature. Please submit your request to Amity Help Center to enable this feature. It will take approximately 5 business days to process your request.
Message previews play a crucial role in enhancing user experience in messaging platforms. By offering a brief glimpse of incoming messages through channel and subchannel objects, users can assess the urgency, context, and relevance of messages without needing to open the entire conversation. This feature is particularly beneficial in various scenarios:
Notifications: When a user receives a push notification or a message alert, a message preview can be shown, allowing the user to decide whether to engage immediately or defer it to a later time.
Chat List: In a list of ongoing conversations, each chat item can display the latest message as a preview. This helps users quickly identify and prioritize which chat to respond to first.
Data Economy: In scenarios where users have limited bandwidth or are on metered connections, previews allow them to decide if they want to download or load the complete message or any associated media.
Integrating message previews into applications can significantly boost user engagement and satisfaction. By offering users an efficient way to manage their interactions, apps can optimize response times and streamline communication workflows.
Name | Data Type | Description | Attributes |
---|---|---|---|
Within our SDK, clients can effortlessly obtain message previews using a channel object attribute.
Our SDK offers clients a straightforward approach to access message previews for subchannels through dedicated subchannel object attributes.
The SDK provides a simple way for clients to retrieve the unread count for a channel. To view the unread count for a channel, we can get it from a channel object. This count represents the number of messages that you have not yet read in that channel.
To check if a channel supports the Unread Count feature, you can use the following code:
To get the mention status of the current user in a channel, developers can use the following code.
To get the mention status of the current user in a sub channel, developers can use the following code.
Channel Moderation is an essential feature for creating a safe and engaging chat community. With Amity Chat SDK, developers can use moderation to manage chat channels effectively and ensure that the chat community remains safe and welcoming. Moderation features such as user banning and muting can help prevent inappropriate content and maintain a positive chat environment.
define varying levels of access and permissions that can be assigned to users within a chat channel. Each role is defined by a set of permissions that determine what actions a user can perform within the channel.
Roles can be assigned to users based on factors such as their level of participation in the chat community or their specific responsibilities within the channel. For example, a moderator might have the ability to remove inappropriate messages or ban users from the channel, while a regular user might only have the ability to send and receive messages.
You can use ChannelRepository
class to add / remove users from a role
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
The channel creator is automatically assigned as the channel moderator.
The previous/last moderator is not allowed to leave a community and an error is displayed.
The channel moderator can promote a user/member to moderator.
The channel moderator can demote a moderator to a user/member.
This applies only to Live and Community channels’. This does not apply to Conversation Channel.
You can check your permission in channel by sending Permission
enums to CoreClient.hasPermission(amityPermission)
.
Supported ✅ (please wait while we prepare a real example!)
The functionality isn't currently supported by this SDK.
Supported ✅ (please wait while we prepare a real example!)
AmityChannelMembership
provides methods to add and remove members, as well as removing yourself as a member of the channel (leaving the channel).
channelId
: The ID of the channel to which you want to add or remove members.
userIds
: An array of user IDs to be added to the channel or removed from the channel.
Version 6
Add Channel Members
Remove Channel Members
Beta (v0.0.1)
Add Channel Members
Remove Channel Members
The functionality isn't currently supported by this SDK.
ChannelRepository
class also provides various methods to moderate the users present in channel. You can ban/unban users, assign roles or remove it from user.
For the banMembers
function, the following parameters are required:
channelId
: The ID of the channel from which the members are being banned.
userIds
: An array of user IDs to be banned from the channel.
For the unbanMembers
function, the following parameters are required:
channelId
: The ID of the channel from which the members are being unbanned.
userIds
: An array of user IDs to be unbanned from the channel.
Version 6
Ban members
Unban members
Beta (v0.0.1)
Ban members
Unban members
Supported ✅ (please wait while we prepare a real example!)
Messaging is an essential component of any chat application, and the SDK provides robust messaging features. The SDK optimizes the messaging flow for users by instantly displaying sent messages, even before they have been delivered to the server. To ensure the user's smooth messaging experience, the SDK provides the syncState
property in the message model to monitor the message delivery status.
Amity supports the sending and receiving of five types of messages:
SDK (Android & iOS) now supports resynchronization of message if the internet connection is not available or interrupted at the time the user sends a message. To support resynchronization, we enhanced the internal architecture on how the messages are queued, processed and synced with server.
When you create a message, SDK first creates the message locally. This locally created message will be reflected immediately in the related live collection that user is observing at the moment. Then the SDK starts syncing this message with server. User can check the syncState
property of the message model inside live collection to reflect the current state of the message.
Once a message is created locally, SDK adds the message to the queue and starts the process of syncing this message with server. After the message is synced with server, the syncState
of the message changes to synced
. Here is the table showing various state of the message and its corresponding syncState
value per platforms.
The messages are synced in the order they get added to the queue in FIFO (First In First Out) order. SDK will maintain causal ordering of the message of similar types.
SDK maintains causal ordering for similar type of messages i.e (Text, Custom) & (Image/File/Audio/Video). Let’s look at the example to understand this:
If user creates messages in this order from left to right: [Text1 → Image1 → Image2 → Text2 → Text3 → Image3]
The ordering of text messages are maintained i.e Text 2 will be synced after Text 1 & so on
[Text1 → Text2 → Text3]
The ordering of Media messages are respected i.e Image2 will be synced after Image 1 and so on.
[Image1 → Image2 → Image3]
The ordering of all messages mixed might not be respected. Ex: If image1 takes longer time to upload, the ordering can be:
[Text1 → Text2 → Text3 → Image1 → Image2 → Image3]
SDK automatically determines the internet connection availability on user device and waits for the stable connection before sending the request to sync with server. Once the connection is available, SDK syncs the message with the server maintaining the causal ordering as described above.
If the network connection is interrupted during the request or server returns error for the request, depending upon the interruption state & error returned, SDK will automatically retry syncing the message after some interval (~ 5 seconds). SDK will retry syncing up to maximum 3 times and if the message still cannot be synced, SDK will mark the message as failed and notify the user through callback of createMessage api. The syncState
of the message would change to failed
/ error
.
The message syncing can fail for many reasons. User should handle the error thrown from create message api and decide what to do for failed messages. Once the status of the message is failed, SDK will not attempt to retry syncing that message anymore. The failed messages will not be automatically removed from the live collection. It’s up to the user to decide if they should resend the same message or delete the failed message so that it disappears from the live collection. The syncState
of the failed message would be failed
/ error
.
You can use existing softDeleteMessage()
method in AmityMessageRepository
class to delete specific failed message.
If you do not care about any failed messages, SDK also provides deleteFailedMessages() method in AmityMessageRepository class to allow deletion of all failed messages.
This message syncing process is only maintained per active session per device. If user logs out or if user current session is destroyed, all the active syncing process is terminated.
When the SDK is initialized again (i.e client instance is initialized), all the messages which were in syncing
state from the previous session would be changed to failed
state. User can choose to delete particular failed message (using softDeleteMessage()
method) or delete all failed messages (using deleteAllFailedMessages()
method).
The ability to search for and query members within a chat channel is an essential feature for creating a seamless and engaging user experience. With Amity Chat SDK, developers can use the query member feature to allow users to search for and retrieve member information within a channel. We will discuss how to use the query member feature of Amity Chat SDK to enable users to search and retrieve member information within a chat channel.
For the specified channel, the list of users will be sorted by as a lastCreated
default parameter. Users can also choose to sort by lastCreated
or firstCreated
.
All participation related methods in a channel fall under a separate ChannelParticipation
class.
All participation related methods in a channel fall under a separate ChannelParticipation
class.
You can get a list of all members, or add memberships
, roles
, search
parameters to get certain members of the channel.
Version 6
Beta (v0.0.1)
Messages are JSON content containers that can have up to 20,000 characters or can weigh up to 100KB for custom messages. They will be synchronized among all channel users in real-time. If a message requires larger binary data (such as when sending files), we recommend to upload the data to another cloud storage service, such as AWS S3, and store the URL to the content in the message data.
In addition to the JSON message type, the SDK also provides support for common text and image message types. These additional types are built on top of the standard JSON message layer.
The message payload is always the same regardless of which Development Kit the user is using. Users also have a choice on what type of message they want to send.
Video messages allow users to share videos within a chat or social platform. This could be anything from a quick clip to a longer, more detailed video. With the Amity SDK, developers can easily integrate video message functionality into their apps, allowing users to record, upload, and share videos in real-time.
To send a video message, you must pass a valid local file URL instance instead. You can also specify an optional caption as part of the message. This caption is accessible via the data property in the message model under the caption
or text
key. You can add up to 1,000 characters of text per message. When a video is uploaded, it is automatically resized to the maximum size of 480p.
For further information regarding a video information please refer to page.
The maximum file size of the video is 1 GB.
The thumbnail for the video message is created automatically.
Here is a brief explanation of the function parameters:
text/caption
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
attachment
: The local video path that the user wants to send on the device
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Version 6
Version 5 (Maintained)
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
In a chat application, it's essential to send text messages to each other in real-time, allowing for quick and easy communication. Users can also view previous messages sent and received within the chat, allowing them to reference past conversations as needed.
The sendTextMessage
function is a feature provided by the Amity chat SDK that enables users to send plain text messages in a . This function requires two parameters: text
and subchannelId
.
Here is a brief explanation of the function parameters:
text
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
metaData
: Additional properties to support custom fields.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Version 6
Version 5 (Maintained)
When creating a message, we can also pass the parentId
to make it appear under a parent.
Version 6
Beta (v0.0.1)
The limit for sending text messages is 10,000 characters per text message. Messages exceeding that limit will return an error and will not be sent.
A file message is a type of message that allows users to share files with each other within a chat or messaging app. This can include documents, images, videos, and other types of files. To send a file message, the user simply selects the file they want to share and sends it through the app.
When a user receives a file message, they can view or download the file directly within the app. This makes it easy for users to share important files and collaborate with each other without having to switch between different applications or email clients.
A File message can include any of the following:
Image
Audio
File
Custom
To send a file message, you must provide a valid local file URL
instance of the selected file and file name for the file. The default file name is file
. The SDK will check the size of the data whether it is exceeding the limit or not before sending it to the server. If the size of the data is more than the limit, the callback will return an Error
object with the error information that you can parse and then show an error message.
Here is a brief explanation of the function parameters:
text/caption
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
attachment
: The local file path that the user wants to send on the device
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload a file.
Create a message with the uploaded file ID.
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload a file.
Create a message with the uploaded file ID.
Version 6
Beta (v0.0.1)
Message State | iOS | Android |
---|
Refer to for sample code on how to upload videos and check its progress.
Refer to for the sample code on how to upload a file to get fileId.
Refer to for the sample code on how to upload a file to get fileId.
messageId
string
The id of this message
Content
channelId
string
The name of the channel this message was created in
Content
userId
string
The name of the user this message was created by
Content
type
string
The message type
enum*: text custom image file
data
Object
The message data (any text will be stored in text key)
text: Text message
isDeleted
boolean
The message has been marked as deleted
Content
createdAt
date
The date/time the message was created at
Content
updatedAt
date
The date/time the message was updated at
Content
When message is created locally and waiting in queue for syncing to server | syncing | created |
When message is being synced to server | syncing | syncing |
When message attachment is being uploaded to server | syncing | uploading |
When message is synced successfully with the server | synced | synced |
When message syncing failed | error | error |
Name | Data Type | Description | Attributes |
|
| The id of this message | Content |
|
| The | Content |
|
| The number of messages with | Content |
|
| The name of the channel this message was created in | Content |
|
| The name of the user this message was created by | Content |
|
| The message type | enum*: |
|
| The message tags | Content |
|
| The message data (any text will be stored in |
|
|
| The message has been marked as deleted | Content |
|
| The date/time the message was created at | Content |
|
| The date/time the message was updated at | Content |
|
| The date/time the message was edited at | Content |
|
| The number of users that have flagged this message | Content |
|
| The reaction data (stored as a reactionName and counter key/value pair) | Example: { |
|
| The total number of reactions on this message | Content |
|
| A list of user's reactions on this message | Content |
Moderation is an important feature for building a safe community that encourages user participation and engagement.
Amity’s customer-centric nature ensures that security needs are kept at the forefront of the work we do. Our purpose has been to continuously develop features that are safe and ready to use. We power our moderators with tools to control and impose permissions that make their applications a safer place, for all users. We put the utmost importance on giving power to our clients to implement protocols that keep their applications healthy, safe and compliant.
The channel creator is automatically assigned as the channel moderator.
The previous/last moderator is not allowed to leave a community and an error is displayed.
The channel moderator can promote a user/member to moderator.
The channel moderator can demote a moderator to a user/member.
This applies only to Live and Community channels’. This does not apply to Conversation Channel.
ChannelModeration
class provides various methods to moderate the users present in channel. You can ban/unban users, assign roles or remove them from a user.
The getMessages
function is a powerful feature of the chat or messaging SDK that allows users to retrieve messages from a specific subchannel based on various criteria. This function provides flexibility in fetching messages that meet specific requirements. This function returns a #live-collection of messages.
Filter parameters
subChannelId
: This parameter specifies the ID of the subchannel from which you want to retrieve messages.
includingTags[]
(optional): This parameter allows you to filter messages based on specific tags. You can provide an array of tags, and the function will return only the messages that have at least one of the specified tags.
excludingTags[]
(optional): Conversely, this parameter allows you to exclude messages that have certain tags. You can specify an array of tags, and the function will exclude messages with any of the specified tags from the result.
includeDeleted
(optional): This parameter determines whether to include deleted messages in the result. If set to true
, the function will include both active and deleted messages. If set to false
, only active messages will be returned.
type
(optional): You can filter messages according to their type
if no type
is passed, any message will match
if an AmityMessage.DataType
is passed, query for all messages with the specific type
AmityMessage.DataType.TEXT
for text messages
AmityMessage.DataType.IMAGE
for image messages
AmityMessage.DataType.FILE
for file messages
AmityMessage.DataType.AUDIO
for audio messages
AmityMessage.DataType.VIDEO
for video messages
AmityMessage.DataType.CUSTOM
for custom messages
Sorting
In the getMessages
function, the sorting option allows you to specify how the returned messages should be ordered. There are two available sorting options:
firstCreated
: When you set the sorting option to firstCreated
, the messages will be ordered in ascending order based on their creation time. This means that the oldest messages will appear first in the returned collection, while the newest messages will be at the end.
lastCreated
: On the other hand, when you choose the lastCreated
sorting option, the messages will be ordered in descending order based on their creation time. This means that the newest messages will appear first in the returned collection, while the oldest messages will be at the end.
By utilizing the getMessages
function with these parameters and sorting option, you can retrieve messages from a specific subchannel while applying additional filters based on tags and including or excluding deleted messages. This provides a flexible and efficient way to fetch and manage messages within your chat or messaging application.
Version 6
Version 5 (Maintained)
Version 6
Version 5 (Maintained)
Version 6
Beta (v0.0.1)
.
Querying threaded messages allows users to retrieve the replied (children) messages associated with a specific message thread. When a message serves as the root of a thread, you can use the parentId
parameter in a message query to fetch its child messages.
To query threaded messages, you can add the following parameters to your message query:
parentId
: This parameter specifies the ID of the parent message. By providing the parentId
, you are indicating that you want to retrieve the child messages associated with that specific parent message.
filterByParentId
: This flag enables the filtering of messages based on their parent ID. By setting this flag, the query will only return messages that have the specified parentId
.
By including the parentId
parameter and setting the filterByParentId
flag in your message query, you can retrieve the child messages of a particular message thread. This functionality allows for structured and organized conversations within your chat or messaging application, enabling users to navigate and explore threaded discussions with ease.
Version 6
Version 5 (Maintained)
Version 6
Version 6 and Beta (v0.0.1)
Supported ✅ (please wait while we prepare a real example!)
To locate a specific message within a chatroom, you can use the index of the message in the collection if known. However, there may be cases where the desired message, such as a reply to a much older message, is not in the current collection. In such instances, it's essential to perform a message query. The SDK offers an additional parameter for message queries called aroundMessageId
, which retrieves the target message along with its preceding and following messages.
Using a message query with aroundMessageId
generates a new live collection. The application's decision to perform data swapping depends on the query's result. Typically, data swapping should not be executed in case of a business error, such as using an invalid target messageId
or a messageId
associated with a deleted message for aroundMessageId
. Upon a successful query, the application can proceed with the source swap, locate the index of the target message, and scroll to that specific position.
In cases where there is a business error but no existing source (e.g., entering a chatroom via push notification), the application can recover by querying for the latest message using a message query without aroundMessageId
.
After swapping the source, most, if not all, of the messages from the previous source will likely no longer be available in the new one. To enable users to navigate back to the message they jumped from, they can scroll through the pages manually. However, the application can also facilitate this by caching the messageId
of the message they jumped from and offering a floating button as a shortcut to navigate back. This functionality can be achieved by leveraging a message query and using the cached messageId
as the value for aroundMessageId
.
This feature is available exclusively from version 6.18.0 onwards
Image message is a type of message that includes an image file. It allows users to share visual information with others in a chat. Image messages can be used in a variety of ways, such as sharing photos with friends, sending documents, or any other visual content that needs to be shared quickly and easily. With image messages, users can easily convey information to others in a chat, making it a powerful tool for communication.
When calling this function, you can provide the local image path on the device and the ID of the subchannel where the message will be sent. The SDK will create an image message with the specified image and send it to the subchannel.
For further information regarding a video information please refer to Image Handling page.
Here is a brief explanation of the function parameters:
text/caption
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
attachment
: The local image path that the user wants to send on the device
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Version 6
To send an image in original size, set optional isFullImage()
to true.
Version 5 (Maintained)
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload an image.
Create a message with the uploaded image ID.
Refer to #upload-images for the sample code on how to upload a file to get fileId.
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload an image.
Create a message with the uploaded image ID.
Refer to #upload-images for the sample code on how to upload a file to get fileId.
Version 6
Beta (v0.0.1)
To send an image in original size, set optional isFullImage()
to true.
The SDK will resize and process the image object before sending it to the server. When an image is uploaded, it is automatically resized into multiple sizing options.
The size of the image is determined by its longest dimension (in pixels) with the aspect ratios being unchanged. The maximum file size of an image cannot exceed 1 GB. Amity will automatically optimize the image and when queried, will return the image in small, medium and large sizes.
If the image is marked as isFull
on upload, the original size of the image can also be returned. Note that this can drastically reduce the speed of message sending, depending on the original image size. If the fullImage
is set to false
, then the uploaded image size will be up to 1500x1500 pixel.
You can also pass an optional caption as part of the message. This caption will be accessible under the data
property in the message model, under the caption
key. You can add up to 1,000 characters of text caption per message.
Supported image formats are JPG, PNG and HEIC and cannot exceed 1GB in size
If you'd like to display content on your app that cannot be represented by the available text, image, video, and file message types, you can create your own custom message type. Custom message type allows you to include the necessary data for rendering, such as additional metadata and custom data formatting. This is useful if you want to present specific types of content to your users.
Here is a brief explanation of the function parameters:
data
: A free-form JSON object that can be customized based on your use cases.
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Version 6
Version 5
Version 6
Beta (v0.0.1)
In addition to creating top-level messages, Amity Chat SDK also allows you to reply to existing messages. To reply to a message, you'll need to specify the parent message's parentMessageId
as one of the parameters. This allows the SDK to associate the new message as a reply to the parent comment.
Similar to creating a top-level message, you can use the SDK's optimistic creation feature to create a reply message.
Version 6
Version 5 (Maintained)
Version 6
Version 5 (Maintained)
Version 6
Beta (v0.0.1)
Mentions allow users to tag other users in messages. It's a powerful tool for fostering engagement and collaboration within your social application. With mentions, users can easily notify specific individuals or groups to new content or important updates. In the SDK, mentions can be implemented in a range of ways, depending on your application's needs and user experience. For more information about mentions, please refer to Mentions. We only support the ability to mention in only these channel types:
Community
Live
You can easily mention users when creating a message by including their user IDs in the mention user parameter as well as defining metadata for mention rendering. For further explanation, please refer to #mention-users. We offer two types of mentions that can be included in a message:
When using this type of mention, up to 30 channel members can be notified through push notifications. Each individual member mentioned in the message will receive a notification.
Version 6
Version 5 (Maintained)
Version 6
Beta (v0.0.1)
By specifying the channel ID in the mention channel parameter when creating a message, push notifications will be sent to all members of that channel when this type of mention is used.
Version 6
Version 5 (Maintained)
Version 6
Beta (v0.0.1)
We provide developers with an efficient method for updating messages with mentions of specific users, you can easily add mentions to their post updates and but it will not notify the relevant users.
To remove mentions you can provide an empty JSON object for the metadata parameter, and an empty list for the mention users parameter. By doing so, You can easily remove mentions from the post content, while ensuring that the overall structure of the post remains intact.
Version 6
Beta (v0.0.1)
The functionality isn't currently supported by this SDK.
To render mentions in a supported feature, please refer to #render-mentions, specifically the section on handling mentions. This documentation provides detailed information on how to represent mentions in your application, including information on metadata structure, custom mention objects, and rendering support.
When a member is mentioned(mention type could be channel as well) in a text message and the message is not read, then hasMention
property is "true" in Channel
class. Every time the hasMention
property is true, this means that the member has an unread message with mention(message could be created or updated as well).
AmityMessageRepository
class provides APIs for you to perform actions on messages you've sent or received. These actions include editing and deleting an existing message, as well as marking a message as being read by you. You can only perform edit and delete operations on messages you've sent.
You can only perform edit and delete operations on your own messages. When editing a message, the message's editedAtDate
will be set to the current time. This allows you to provide UI to the user to inform the user of specific messages that have been edited, if needed. An optional completion block can be provided to notify you of operation success.
Currently, the Chat SDK has only 2 editable data types, TEXT
and CUSTOM
To edit the message, you need to pass the following parameters:
messageId
(String
) - ID of the message to edit/update
data
(String
) - new message
Version 6
Beta (v0.0.1)
The delete message functionality allows users to remove a message from a chat or messaging application. This feature provides flexibility and control, allowing users to delete messages they no longer wish to be visible to other participants in the conversation.
By utilizing the delete message function, users can remove a specific message from the chat history. This can be useful in various scenarios, such as correcting mistakes, removing sensitive or inappropriate content, or simply managing the flow of the conversation. Once the message is deleted, it may still be shown as a deleted message with timestamp which depends on the Query and Filter Messages condition.
The delete message function typically requires the messageId
as a parameter, which uniquely identifies the message to be deleted. Once the message is deleted, it will no longer be visible to other users in the chat or messaging context.
For deleting a message, you need to pass the ID of the message to delete.
Version 6
Beta (v0.0.1)
To view the content of a message using the Amity Chat SDK, developers can utilize a message object. The message content can then be used to display to the user in a chat interface, or to perform other operations on the message data as needed. This allows developers to build chat applications that support messaging using the Amity Chat SDK and provides a foundation for building more advanced chat applications that require more complex message handling and processing. The Amity Chat SDK provides several methods for viewing messages in a chat channel. Here's how to use these methods in your app:
To get a single message by its ID, use the getting message function of the Amity Chat SDK. This method returns a message live object, which you can use to display the message in your app. Here's an example:
You can use the getMessage
method to get a single comment. You need to pass the messageId
of the requested message as the parameter.
The method returns a liveobject
instance of a message model. It will throw an error if the passed messageId
is not valid.
Version 6 and Beta
Supported ✅ (please wait while we prepare a real example!)
You can also use a query to get messages that match specific criteria. The querying and filtering messages function of the Amity Chat SDK enables you to retrieve messages based on different parameters such as a specific user, a date range, or a keyword search. please refer to the page - Query and Filter Messages
This is the most basic type of message, and is useful for sending simple messages such as chat messages, system notifications, or status updates. Each text message has a character limit of 20,000 characters, making it suitable for sending concise messages.
v6.0.0 and Beta
Sending visual content such as photos, graphics, or images in a channel is facilitated by this type of message. The maximum size for an image is 1 GB, and the image will be automatically transformed into four different sizes for versatile usage which are:
Small
Medium
Large
Full
This allows for flexible usage and easy integration into various chat applications. For more information about an image, please refer to the page - Image Handling.
Version 6
In TypeScript SDK, viewing a file, image, and audio message have the same steps and sample code. You can query all file types with
observeFile
.
Beta (v0.0.1)
This is a message that contains a file attachment, such as a PDF, a Word document, or any other type of file. This is a useful type of message for sharing files within a channel, such as a document or a photo. The maximum size for a file is 1 GB. For more information about a file, please refer to the page - File Handling
In iOS SDK, AmityFileRepository
provides downloadFile:
and downloadFileAsData:
method to download the file from URL. The same method can be used to download the audio.
This is a useful type of message for sharing video content within a chat conversation, such as a short clip or a longer video. The maximum size for a video is 1 GB, and the video will be automatically transcoded into different resolutions for versatile usage which are
1080p
720p
480p
360p
original
Once you uploaded a video the videos undergo transcoding from their original resolution. You can quickly access the original size of the video right after you make the video message. However, it takes time for the transcoded resolutions to be ready. This allows for flexible usage and easy integration into various chat application. For more information about a video, please refer to the page - Video Handling.
Supported ✅ (please wait while we prepare a real example!)
In addition to the built-in message types such as text, image, file, audio, and video, the Amity Chat SDK also provides support for "custom messages". Custom messages allow users to design their own JSON structure that can be used to represent any kind of data, essentially providing the freedom to create their own message types.
This can be useful for a variety of use cases. For example, a developer building a chat application for a sports team could use custom messages to create a "score update" message type that contains data such as the score of a game, the time remaining, and other relevant information. Similarly, a developer building a chat application for an e-commerce platform could use custom messages to create a "product update" message type that contains information such as product details, availability, pricing, and other relevant data.
The possibilities for custom messages are endless, and can be tailored to the specific needs of any application. Custom messages can be sent and received using the Amity Chat SDK, and can be queried and displayed in a chat channel just like any other message type.
Supported ✅ (please wait while we prepare a real example!)
For custom messages, the data is in the data property.
The Chat SDK product also includes a flag method that allows users to flag messages in their app. Once a message is flagged, an indicator will appear in the Admin console, where an administrator can review and validate the flag. If the content is found to be in violation of your app's policies, it can be deleted from the app. On the other hand, if the content is not found to be in violation, the flag can be revoked.
The flag method provides an essential tool for managing user-generated content in your app, ensuring that inappropriate messages can be quickly identified and removed. By integrating this method into your app's user interface, you can empower your users to take an active role in promoting a safe and respectful community.
To use the function you simply need to identify the messageId
that you'd like to flag.
Another useful feature is the unflag method, which enables users to revoke a previously flagged message. If a user flags a message by mistake or if the message is found not to violate your app's policies after review, the unflag method can be used to remove the flag from the message. It ensures that users have control over the content they flag and the ability to reverse their flag if necessary.
Similar to the flag function, you simply need to identify the messageId
that you'd like to unflag.
The isFlaggedByMe
method allows users to check whether they have previously flagged a particular message. This method provides a convenient way for users to keep track of the content they have flagged and to ensure that they are staying up-to-date with their moderation activities.
By using the isFlaggedByMe method, your app's users can quickly determine whether they have already flagged a particular message and avoid duplicating their efforts.
This method is useful when there is a large number of messages going through the channel, which can make the message stream hard to follow. Setting a rate limit enables the SDK to queue up messages once the number of message in a specified window
exceeds the defined limit
, allowing a slower stream of messages to be published to the user at the expense of adding more latency (because newer messages will be sent to the queue first and not delivered until all previously queued messages are delivered).
There is an internal limit of 1000 messages that can be queued by the rate limit service, if more than 1000 messages are queued up, the system may skip publishing the older messages in order to make room for newer messages. We believe this is the preferred behavior for users, as users will most likely want to see newer messages in a real-time conversation instead of waiting for a significant amount of time for old messages to be published to them first.
Note that the SDK permanently stores all messages it receives in the system before the rate limit comes into effect: in the case of a large spike of incoming messages, even if a message did not get published to a user in real-time, that user can still scroll up to see message history and see that past message.
The functionality isn't currently supported by this SDK.
Supported ✅ (please wait while we prepare a real example!)
The functionality isn't currently supported by this SDK.
The above method enables a rate limit of 5 messages every 60 seconds: once there are more than 5 messages sent, from any user, within 60 seconds, those messages will be queued on the server and not published to other channel members until 60 seconds have passed. The rate limit will last as long as the period specified in the method call: in the example above the rate limit will be active for 10 minutes (600 seconds).
If you would like to have a permanent rate limit, call the method above with a period of -1 seconds.
In order to disable the rate limit, simply call removeRateLimitWithCompletion:
The functionality isn't currently supported by this SDK.
Supported ✅ (please wait while we prepare a real example!)
The functionality isn't currently supported by this SDK.
Amity uses roles and permissions to provide users the ability to fully customize moderation experience on the platform. To learn more about Amity SDKs default roles and permissions, refer to page.
Creator of the channel can add and remove the role of user via AmityChannelModeration
.
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
Supported ✅ (please wait while we prepare a real example!)
The channel creator is automatically assigned as the channel moderator.
The previous/last moderator is not allowed to leave a community and an error is displayed.
The channel moderator can promote a user/member to moderator.
The channel moderator can demote a moderator to a user/member.
This applies only to Live and Community channels’. This does not apply to Conversation Channel.
You can check your permission in channel by sending AmityPermission enums to AmityCoreClient.hasPermission(amityPermission)
.
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
When a user is banned in a channel, they are removed from a channel and no longer able to participate or observe messages in that channel.
Moderators can ban and unban users. When a user is banned in a channel, they are forcibly removed from the channel and may no longer participate or observe messages in that channel. All their previous messages in the channel will also be automatically deleted.
A user that has been banned from a channel can not rejoin the channel until they have been unbanned.
As well as the banning and unbanning of users, admins also have the ability to global ban a user. When a user is globally banned, they can no longer access Amity's network and will be forcibly removed from all their existing channels. All the globally banned user's messages will also be deleted.
The globally banned user can not access Amity's network again until they have been globally unbanned.
When a user is banned, it can take up to 30 seconds before the user is disconnected from the network.
Banning members is a more heavy-handed moderation method. When a user is banned, all its messages are retroactively deleted, it will be removed from the channel, and it will not be allowed to join the channel again until he is explicitly unbanned.
Version 6
Beta (v0.0.1)
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
This feature does not work with Broadcast
and Conversation
channels. Calling banMembers()
or unbanMembers()
on these channels will result in an error.
The function allows users to retrieve information about a specific channel using the channelId
parameter. This function returns a #live-object of the AmityChannel
class, which contains information such as the channel's display name, tags, avatar, and other metadata.
This function is useful for a variety of purposes, such as displaying information about a channel to users or retrieving channel details before joining the channel.
Version 6 and Beta (v0.0.1)
Subchannels are the part of a channel. They are separate topics or chat thread inside a channel. Messages can be sent & received in subchannel. By default, a channel itself would also generate a main subchannel once it's created. You can create, update, delete & query subchannels inside a channel. For the sturcture and relationship of channels and subchannels, please visit #channel-and-subchannel-structure.
Limitations:
Sub-channel creation is supported for Conversation
and Community
channel types.
Users can create up to 300 sub-channels per channel.
In the concept of channels and subchannels, a channel is a primary container that can hold multiple subchannels. When you create a subchannel, it will serve as a thread where users can send messages and participate in discussions related to a specific thread. The subchannel creation function requires two parameters: channelId
and displayName
.
channelId
: specifies the unique identifier of the parent channel where the subchannel will be created. This allows the SDK to link the subchannel to the correct parent channel, and organize it within the correct hierarchy.
displayName
: Specifies the public name or label of the subchannel that will be visible to users.
We don't support this feature in JS SDK.
Version 6
Beta (v0.0.1)
When you update a subchannel's properties, the changes will be reflected for all users who are members of that subchannel. Please note that the updateSubChannel
function only updates the properties of the subchannel itself, and does not affect any messages or other content that has been sent within the subchannel.
The function requires two parameters: subchannelId
and displayName
.
subhannelId
: This is the unique identifier of the subchannel that you'd like to update.
displayName
: This is the updated public name or label of the subchannel that will be visible to users.
We don't support this feature in JS SDK.
Version 6
Beta (v0.0.1)
The subchannelId
parameter specifies the ID of the subchannel that you'd like to delete. The hardDelete
parameter is a boolean value that determines whether to perform a hard delete or a soft delete.
A soft delete will mark the subchannel as deleted but keep its data in the system. A hard delete will immediately and permanently delete the subchannel and all its data from the system.
We don't support this feature in JS SDK.
Version 6
Beta (v0.0.1)
To get a subchannel, you can use the getSubchannel
method provided by the SubchannelRepository
. This method accepts a subchannelId
parameter and returns a #live-object of the AmitySubchannel
class.
The AmitySubchannel
class represents a subchannel in a channel. It contains information about the subchannel, such as its ID, display name, avatar, creation time, and more.
By using a #live-object combines with #real-time-events, you can observe any changes made to the subchannel in real-time. This is particularly useful in cases where multiple users may be interacting with the same subchannel and you need to keep the UI up-to-date with the latest data.
We don't support this feature in JS SDK.
Version 6 and Beta(v0.0.1)
The getSubChannels
function allows you to retrieve a list of subchannels within a specific channel. It accepts the channelId
parameter to specify which channel to retrieve subchannels from.
The function returns a #live-collection, which allows you to observe changes to the collection in real-time.
We don't support this feature in JS SDK.
Version 6 and Beta(v0.0.1)
The unread count feature in chat channels and subchannels allows you to keep track of new messages and stay up-to-date with ongoing conversations. By providing a simple indicator of unread messages, users can quickly prioritize which channels require their attention. This topic provides instructions for managing unread messages in a chat channel and sub-channel.
Note: we only support unread count on community, conversation, and broadcast channels. We do not support this feature in live channels. Mention unread in channels and subchannels aren't supported as well.
To enable the unread message count feature on the device, the user must start unread count syncing. This ensures that the user, as well as all channels and subchannels, have an up-to-date message unread count. To disable this feature, users simply stop the unread count syncing, which will stop updating the message unread count from their device.
To start unread count syncing, you can use the following code:
To stop unread count syncing, you can use the following code:
Clearing all unread counts in a channel is a useful feature that allows users to easily keep track of their message history. To accomplish this, the SDK provides a convenient method to mark all messages within a channel as read, effectively clearing the unread count. This method can be called by invoking the markAsRead()
function on the ChannelRepository
class with the appropriate channelId
parameter.
Once called, the function will iterate through all messages in subchannels within the specified channel and mark each as read. This process will clear the unread count.
Please note that clearing unread counts in a channel only applies to the specified channel and does not affect any other channels or subchannels. Additionally, clearing unread counts does not delete any messages or modify their content in any way. It simply updates their status to reflect that they have been read by the user.
For Android, iOS, JS SDK version 6.5.0 and below and TS SDK version v0.0.1-beta.42.3
The ChannelRepository
object exposes a totalUnreadCount
property that reflects the number of messages that the current user has yet to read. This count is the sum of all the unreadCount
channels properties where the user is already a member.
Version 6
The ChannelRepository
provides getTotalDefaultSubChannelUnreadCount()
method.
The ChannelRepository
provides getTotalUnreadCount()
method. It's giving the flowable of the number of messages that the current user has yet to read. This count is the sum of all the unreadCount
channels properties where the user is a member of.
To check whether the current user has been mentioned on one of the unread messages:
Version 6
The Channel
object exposes a unreadCount
property that reflects the number of messages that the current user has yet to read. This count is the sum of all the unreadCount
channels properties where the user is already a member. It also provides hasMention which is a boolean presenting having a mention for current user in channel.
The startReading()
and stopReading()
methods let the server know that the current user is reading a channel. After the startReading()
and stopReading()
methods are called, the unreadCount
is reset to 0.
You can call both methods as much you'd like, the SDK takes care of multi-device management: therefore a user can read multiple channels, from one or multiple devices at the same time. In case of an abrupt disconnection (whether because the app was killed, or the internet went down, etc.), the SDK backend will automatically call the stopReading
on the user's behalf.
The searchMembers
function in the AmityChannelParticipation
class is used to search for members in a channel when mentioning. It takes the following parameters:
The function returns a of ChannelMember
objects. You can filter search results with more than one option, such as filtering by muted and banned users. The role filter, which takes the role enum as an argument.
If no keyword is supplied, the list of users will be organized alphabetically by display name. When a keyword is provided, the list will be arranged based on search rank.
It takes the following parameters:
displayName/keywords
: This parameter takes in the display name or user ID of the member being searched.
roles
: This parameter is used to filter search results by roles:
member
- Standard member
mute
- Muted member
ban
- Banned member
Supported ✅ (please wait while we prepare a real example!)
An audio message is a type of message that allows users to send and receive audio recordings in a chat or messaging application. Audio messages can be used to convey emotions, tone, or detailed information in a way that is not always possible with text messages or other types of media. They are a convenient and intuitive way to communicate with other users in real-time.
With the Amity Chat SDK, you can easily send and receive audio messages within your chat or messaging application. Simply provide the local path of the audio file to the sendAudioMessage
method.
Here is a brief explanation of the function parameters:
text/caption
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
attachment
: The local audio path that the user wants to send on the device
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Version 6
Version 5 (Maintained)
Sending audio messages uses the same steps as sending a file message. Refer to File Message page for more details.
Supported audio formats are MP3, WAV and cannot exceed 1GB in size
Interactions are more fun when you can express yourself! Let users react using emojis, stickers, or thumbs up to messages.
The Social SDK product also provides functionality for adding and removing reactions on messages. Users can add any number of reactions to a particular message, allowing them to engage with the content in a more expressive and nuanced way. Additionally, users can also remove reactions that they have added to a message, providing greater control and flexibility over their engagement with the content.
The addReaction
function allows users to add a reaction to a message. The function takes the name of the reaction as a parameter, with a maximum length of 100 characters. The reaction name is case-sensitive, which means that "like" and "Like" are treated as two different reactions.
You can add reactions to a given reference through the addReaction
method.
referenecId
- ID of the message.
reactionName
- name of the reaction that you will remove. Reaction name is case sensitive, i.e "like" & "Like" are two different reactions.
Version 6
Beta
Similarly, the removeReaction
function allows users to remove a previously added reaction from a reference. This provides users with greater control over their engagement with the content and allows them to change their mind or update their reaction to the message over time.
You can remove a reaction from a reference by calling removeReaction
.
reactionName
- name of the reaction that you will remove. Reaction name is case sensitive, i.e "like" & "Like" are two different reactions.
referenecId
- ID of the message.
Version 6
Beta (v0.0.1)
To further facilitate the management of reactions in your app, the Chat SDK product includes a getReactions
method that allows you to retrieve information about a specific reaction or all reactions on a message.
Using this method, you can fetch detailed information about a particular reaction, including the user who made the reaction, the timestamp of the reaction, and any additional metadata associated with the reaction. This can be useful for analyzing the sentiment of the community and gaining insights into the types of content that are resonating with your users.
To query getReactions
you'll need to simply provide referenceType
and referenceId
to query specific type of reactions. For further information regarding reaction reference types, please see - #create-comment.
Supported ✅ (please wait while we prepare a real example!)
Version 6 and Beta(v0.0.1)
Moderators can mute and unmute users. When a user is muted, they cannot send messages in a channel. However, muted users will still be allowed to observe messages in a channel. The status of being muted is indefinite but is only applied at the channel level. The mute and unmute operations can be done viaChannel
object.
When a user is muted, they cannot send messages in a channel and all the messages sent by that user to that channel will be rejected. This method is useful for preventing certain members from sending inappropriate messages, but still allowing them to participate in the conversation in a read-only manner. The timeout property allows you to make the timeout temporary, or permanent until unset by passing in -1
.
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
This feature is not applicable in Broadcast
and Conversation
channel. Calling muteMembers()
or unmuteMembers()
on these channels will result in an error.