Skip to content

ChatEndpoint

ChatEndpoint contains methods that facilitate communication with a channel's chatroom.

Methods

Authentication Required async sendMessage(chatroomId, message)

Sends a message into the specified chatroom.

ParameterTypeRequiredDefaultDescription
chatroomIdstring | numbertrueThe chatroom where you want to send your message
messagestringtrueThe message to be sent
replyToChatMessageReferencefalseInformation about the original message to reply to

Returns

Promise<SendMessageResponse>


Authentication Required async deleteMessage(chatroomId, messageId)

Deletes a message in the specified chatroom by ID.

ParameterTypeRequiredDefaultDescription
chatroomIdstring | numbertrueThe chatroom where you want to delete the message
messageIdstringtrueThe ID of the message you want to delete

Returns

Promise<GenericApiResponse<null>>


Authentication Required async pinMessage(channel, messageId)

Pins a message in the specified channel by ID.

ParameterTypeRequiredDefaultDescription
chatroomstringtrueThe channel where you want to pin the message
messageIdstringtrueThe ID of the message you want to pin

Returns

Promise<GenericApiResponse<null>>


Authentication Required async banUser(channel, target, duration)

Ban a user from the specified channel.

ParameterTypeRequiredDefaultDescription
channelstringtrueThe channel where you want to ban the user
targetstringtrueThe username of the user you want to ban
durationnumberfalseDuration in minutes for how long the ban should last. If not provided, the ban is considered permanent

Returns

Promise<GenericApiResponse<null>>


Authentication Required async unbanUser(channel, target)

Unban a user from the specified channel.

ParameterTypeRequiredDefaultDescription
channelstringtrueThe channel from which you want to unban the user
targetstringtrueThe username of the user you want to unban

Returns

Promise<GenericApiResponse<null>>