docs/Channel.html
isMutedisReadOnlylastMessagemuteExpiration
_muteUnmuteChannel(action)_setChannelMetadata(value, property)acceptChannelAdminInvite()deleteChannel()demoteChannelAdmin(userId)fetchMessages(searchOptions)
getSubscribers(limit)mute()revokeChannelAdminInvite(userId)sendChannelAdminInvite(chatId, options)sendMessage(content, options)sendSeen()
setDescription(newDescription)setProfilePicture(newProfilePicture)setReactionSetting(reactionCode)setSubject(newSubject)transferChannelOwnership(newOwnerId, options)unmute()
ExtendsBase
The channel description
ID that represents the channel
Indicates if it is a Channel
Indicates if it is a Group
Indicates if the channel is muted or not
Indicates if the channel is readonly
Last message in the channel
Unix timestamp for when the mute expires
Title of the channel
Unix timestamp for when the last activity occurred
Amount of messages unread
async
Internal method to mute or unmute the channel
| Name | Type | Optional | Description |
|---|---|---|---|
action
|
string
|
|
The action: 'MUTE' or 'UNMUTE'
|
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Internal method to change the channel metadata
| Name | Type | Optional | Description |
|---|---|---|---|
value
|
(string, number, or MessageMedia)
|
|
The new value to set
| |
property
|
string
|
|
The property of a channel metadata to change
|
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Accepts a channel admin invitation and promotes the current user to a channel admin
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Deletes the channel you created
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Demotes a channel admin to a regular subscriber (can be used also for self-demotion)
| Name | Type | Optional | Description |
|---|---|---|---|
userId
|
string
|
|
The user ID to demote
|
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Loads channel messages, sorted from earliest to latest
| Name | Type | Optional | Description |
|---|---|---|---|
searchOptions
|
Object
|
|
Options for searching messages. Right now only limit and fromMe is supported
Values in searchOptions have the following properties:
| Name | Type | Optional | Description |
|---|---|---|---|
limit
|
Number
|
Yes
|
The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages
| |
fromMe
|
Boolean
|
Yes
|
Return only messages from the bot number or vise versa. To get all messages, leave the option undefined
|
|
Returns
Promise containing Array of Message
async
Gets the subscribers of the channel (only those who are in your contact list)
| Name | Type | Optional | Description |
|---|---|---|---|
limit
|
number
|
|
Optional parameter to specify the limit of subscribers to retrieve
Value can be null.
|
Returns
Promise containing Array of {contact: Contact, role: string}
Returns an array of objects that handle the subscribed contacts and their roles in the channel
async
Mutes the channel
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Revokes a channel admin invitation sent to a user by a channel owner
| Name | Type | Optional | Description |
|---|---|---|---|
userId
|
string
|
|
The user ID the invitation was sent to
|
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Sends a channel admin invitation to a user, allowing them to become an admin of the channel
| Name | Type | Optional | Description |
|---|---|---|---|
chatId
|
string
|
|
The ID of a user to send the channel admin invitation to
| |
options
|
|
| |
Returns
Promise containing boolean
Returns true if an invitation was sent successfully, false otherwise
async
Sends a message to this channel
| Name | Type | Optional | Description |
|---|---|---|---|
content
|
(string or MessageMedia)
|
| | |
options
|
|
|
Value can be null.
|
Returns
Promise containing Message
Message that was just sent
async
Sets the channel as seen
Returns
Promise containing boolean
async
Updates the channel description
| Name | Type | Optional | Description |
|---|---|---|---|
newDescription
|
string
|
| |
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Updates the channel profile picture
| Name | Type | Optional | Description |
|---|---|---|---|
newProfilePicture
|
|
| |
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Updates available reactions to use in the channel
Valid values for passing to the method are: 0 for NONE reactions to be avaliable 1 for BASIC reactions to be available: 👍, ❤️, 😂, 😮, 😢, 🙏 2 for ALL reactions to be available
| Name | Type | Optional | Description |
|---|---|---|---|
reactionCode
|
number
|
| |
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Updates the channel subject
| Name | Type | Optional | Description |
|---|---|---|---|
newSubject
|
string
|
| |
Returns
Promise containing boolean
Returns true if the subject was properly updated. This can return false if the user does not have the necessary permissions.
async
Transfers a channel ownership to another user. Note: the user you are transferring the channel ownership to must be a channel admin.
| Name | Type | Optional | Description |
|---|---|---|---|
newOwnerId
|
string
|
| | |
options
|
TransferChannelOwnershipOptions
|
| |
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise
async
Unmutes the channel
Returns
Promise containing boolean
Returns true if the operation completed successfully, false otherwise