Rocket.Chat
App · 23 actions
Read public channels and messages, manage channels, post replies and react to messages in Rocket.Chat.
Actions
| Action | What it does |
|---|---|
| Archive channel | Archive a channel. |
| Create channel | Create a public channel. |
| Delete channel | Delete a channel. |
| Delete message | Delete a chat message. |
| Get channel | Get the information about the channel. |
| Get channel history | Get the history of a channel. |
| Get message | Get a single chat message. |
| Get user | Get information about a user, limited to the details the caller is allowed to view. |
| Join channel | Join a public channel. |
| Leave channel | Leave a public channel. |
| List channel members | List all channel users. |
| List joined channels | List all the channels the authenticated user has joined. |
| List public channels | List all the channels in the workspace. |
| List thread messages | Get thread messages. |
| List users | Get workspace users and the information the caller is allowed to view. |
| Post message | Send messages to channels or users on your workspace. |
| React to message | React or unreact to a chat message. |
| Rename channel | Change the name of a channel. |
| Set channel announcement | Set an announcement for the channel. |
| Set channel description | Set the description for a channel. |
| Set channel topic | Set the topic for a channel. |
| Unarchive channel | Unarchive a channel. |
| Update message | Update a specific message. |
Archive channel
Archive a channel.
Inputs
- Room
room_idtextRequired - The channel ID that you want to archive.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true
},
"has_more": false,
"next_cursor": null
}Create channel
Create a public channel.
Inputs
- Name
nametextRequired - The name of the channel.
- Members
memberslist - An array of the users to be added to the channel when it is created.
- Read only
read_onlytrue/false - Set if the channel is read only or not. It is `false` by default.
- Exclude self
exclude_selftrue/false - If set to true, the user calling the endpoint is not automatically added as a member of the channel. The default `value` is false.
- Custom fields
custom_fieldsobject - If you have defined custom fields for your workspace, you can provide them in this object parameter. For details, see the Custom Fields document.
- Extra data
extra_dataobject - Additional channel settings applied at creation. For more information, see Channels .
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": {
"_id": "example",
"_updatedAt": "example",
"customFields": {},
"default": false,
"fname": "example",
"msgs": 0,
"name": "example",
"ro": false,
"sysMes": false,
"t": "example",
"ts": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
},
"usersCount": 0
},
"success": true
},
"has_more": false,
"next_cursor": null
}Delete channel
Delete a channel.
Inputs
- Room
room_idtextRequired - Enter the room ID. This parameter is required if no `roomName` is provided.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true
},
"has_more": false,
"next_cursor": null
}Delete message
Delete a chat message.
Inputs
- Room
room_idtextRequired - The room ID. Required when deleting by `msgId`.
- Msg ID
msg_idtextRequired - The ID of the message to delete. Required together with `roomId`.
- As user
as_usertrue/false - Should the message be deleted as the user who sent it? It is `false` by default.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"_id": "example",
"message": {
"_id": "example",
"rid": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
}
},
"success": true,
"ts": "example"
},
"has_more": false,
"next_cursor": null
}Get channel
Get the information about the channel.
Inputs
- Room
room_idtextRequired - The room ID. It is required if the `roomName` is not provided.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": {
"_id": "example",
"_updatedAt": "example",
"broadcast": false,
"customFields": {},
"default": false,
"encrypted": false,
"fname": "example",
"lastMessage": {
"_id": "example",
"_updatedAt": "example",
"channels": [],
"md": [],
"mentions": [],
"msg": "example",
"rid": "example",
"ts": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
},
"urls": []
},
"lm": "example",
"msgs": 0,
"name": "example",
"ro": false,
"sysMes": false,
"t": "example",
"topic": "example",
"ts": "example",
"u": {
"_id": "example",
"username": "example"
},
"usersCount": 0
},
"success": true
},
"has_more": false,
"next_cursor": null
}Get channel history
Get the history of a channel.
Inputs
- Room
room_idtextRequired - The room ID. It is required if the `roomName` is not provided.
- Sort
sortobject - List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
- Latest
latestdate and time - The end of time range of messages to retrieve. The default value is the current date and time.
- Oldest
oldestdate and time - The start of the time range of messages to retrieve
- Inclusive
inclusivetrue/false - Whether messages which land on the latest and oldest dates should be included. The default value is false.
- Show thread messages
show_thread_messagestrue/false - Whether thread messages should be included in the response
- Unreads
unreadstrue/false - Whether the number of unread messages should be included. The default value is false.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"count": 0,
"files": [],
"offset": 0,
"success": true,
"total": 0
},
"has_more": false,
"next_cursor": null
}Get message
Get a single chat message.
Inputs
- Msg ID
msg_idtextRequired - The message ID.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"message": {
"_id": "example",
"_updatedAt": "example",
"alias": "example",
"channels": [],
"groupable": false,
"mentions": [],
"msg": "example",
"reactions": {
":frowning2:": {
"usernames": []
}
},
"rid": "example",
"starred": {
"_id": "example"
},
"t": "example",
"ts": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
}
},
"success": true
},
"has_more": false,
"next_cursor": null
}Get user
Get information about a user, limited to the details the caller is allowed to view.
Inputs
- Target user
target_user_idtextRequired - The `userId` of the user. Alternatively, you can use `username`, `importId`, `email`, or `freeSwitchExtension` to retrieve user information.
- Include user rooms
include_user_roomstext - Whether to include the list of rooms the user is a member of.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true,
"user": {
"_id": "example",
"active": false,
"canViewAllInfo": false,
"createdAt": "example",
"emails": [],
"freeSwitchExtension": "example",
"lastLogin": "example",
"name": "example",
"requirePasswordChange": false,
"roles": [],
"status": "example",
"statusConnection": "example",
"type": "example",
"username": "example",
"utcOffset": 0
}
},
"has_more": false,
"next_cursor": null
}Join channel
Join a public channel.
Inputs
- Room
room_idtextRequired - The channel ID.
- Join code
join_codetext - The join code of the room. Channels can be password-protected. In that case, users must enter the password for access. See Channel information for details. The join code isn't needed if the user has the `join-without-join-code` permission.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": {
"_id": "example",
"_updatedAt": "example",
"broadcast": false,
"customFields": {},
"default": false,
"encrypted": false,
"fname": "example",
"lastMessage": {
"_id": "example",
"_updatedAt": "example",
"channels": [],
"md": [],
"mentions": [],
"msg": "example",
"rid": "example",
"ts": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
},
"urls": []
},
"lm": "example",
"msgs": 0,
"name": "example",
"ro": false,
"sysMes": false,
"t": "example",
"topic": "example",
"ts": "example",
"u": {
"_id": "example",
"username": "example"
},
"usersCount": 0
},
"success": true
},
"has_more": false,
"next_cursor": null
}Leave channel
Leave a public channel.
Inputs
- Room
room_idtextRequired - The channel ID that you want to leave.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": {
"_id": "example",
"_updatedAt": "example",
"msgs": 0,
"name": "example",
"ro": false,
"sysMes": false,
"t": "example",
"ts": "example",
"u": {
"_id": "example",
"username": "example"
},
"usernames": []
},
"success": true
},
"has_more": false,
"next_cursor": null
}List channel members
List all channel users. Gets one page; to see more, run it again with the next page it gives.
Inputs
- Room
room_idtextRequired - The room ID. It is required if the `roomName` is not provided.
- Status
statuslist - The user's status (search filter).
- Filter
filtertext - Extra search filters to be applied to the fields defined in the `Accounts_SearchFields`setting.
- Sort
sortobject - List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"count": 0,
"members": [],
"offset": 0,
"success": true,
"total": 0
},
"has_more": false,
"next_cursor": null
}List joined channels
List all the channels the authenticated user has joined. Gets one page; to see more, run it again with the next page it gives.
Inputs
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Sort
sortobject - List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.
- Query
queryobject - This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": `query={ "name": { "$regex": "g" } }`. Refer to the official documentation to learn more.
- Fields
fieldsobject - This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: `fields={ "username": 1 }`. Refer to the official documentation to learn more.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channels": [],
"count": 0,
"offset": 0,
"success": true,
"total": 0
},
"has_more": false,
"next_cursor": null
}List public channels
List all the channels in the workspace. Gets one page; to see more, run it again with the next page it gives.
Inputs
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Query
queryobject - This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": `query={ "name": { "$regex": "g" } }`. Refer to the official documentation to learn more.
- Fields
fieldsobject - This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: `fields={ "username": 1 }`. Refer to the official documentation to learn more.
- Sort
sortobject - Sort the channels in ascending (`1`) or descending (`-1`) order. The value must be entered as a JSON object. The options are as follows: * `name`: Sort by the channel name. For example, `sort={"name":1}` (this is the default sorting mechanism). * `ts`: Sort by channel creation timestamp. For example, `sort={"ts":-1}` * `usersCount`: Sort by the number of users in the channel. For example, `sort={"usersCount":1}`
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channels": [],
"count": 0,
"offset": 0,
"success": true,
"total": 0
},
"has_more": false,
"next_cursor": null
}List thread messages
Get thread messages. Gets one page; to see more, run it again with the next page it gives.
Inputs
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Sort
sortobject - List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, {"value": -1, "_id": 1}. Refer to the official documentation to learn more.
- Query
queryobject - This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": `query={ "name": { "$regex": "g" } }`. Refer to the official documentation to learn more.
- Fields
fieldsobject - This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: `fields={ "username": 1 }`. Refer to the official documentation to learn more.
- Tmid
tmidtextRequired - The thread message ID.
- Around ID
around_idtext - The ID of the thread's main message or one of its replies. The endpoint returns a page of replies surrounding this message. When you provide this parameter, the server calculates the page offset and ignores the requested `offset` value. The message must belong to the thread specified by `tmid`.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"count": 0,
"messages": [],
"offset": 0,
"success": true,
"total": 0
},
"has_more": false,
"next_cursor": null
}List users
Get workspace users and the information the caller is allowed to view. Gets one page; to see more, run it again with the next page it gives.
Inputs
- Query
queryobject - This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": `query={ "name": { "$regex": "g" } }`. Refer to the official documentation to learn more.
- Fields
fieldsobject - This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: `fields={ "username": 1 }`. Refer to the official documentation to learn more.
- Offset
offsetnumber - Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
- Count
countnumber - The number of items to return. Refer to the official documentation to learn more.At least 1.
- Sort
sortobject - Sort the users in ascending (`1`) or descending (`-1`) order. The value must be entered as a JSON string. The options are as follows: * `status`: Sort by users' status. For example, `sort={"status":1}` (this maps to the `active` status). * `createdAt`: Sort by the time of user creation. For example, `sort={"createdAt":-1}` * `name`: Sort by user name. For example, `sort={"name":1}`
- Email
emailtext - Filter users by email address. Minimum length: 1 character.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"count": 0,
"offset": 0,
"success": true,
"total": 0,
"users": []
},
"has_more": false,
"next_cursor": null
}Post message
Send messages to channels or users on your workspace.
Inputs
- Alias
aliastext - This will cause the message's name to appear as the given alias, but your username will still be displayed.
- Avatar
avatartext - If provided, the avatar will be displayed as the provided image URL.
- Emoji
emojitext - If provided, the avatar will be displayed as an emoji.
- Room
room_idtextRequired - The room ID or an array of room IDs where the message is to be sent. You can use channel name or username. The channel name must have the `#` prefix. `@` refers to username.
- Text
texttextRequired - The message text to send, it is optional because of attachments.
- Parse URLS
parse_urlstrue/false - Set `parseUrls` to `false` to prevent Rocket.Chat from generating link previews when the message in `text` contains a URL.
- Attachments
attachmentslist - Attachments.
- Tmid
tmidtext - The message ID of the original message to reply to or to create a thread on.
- Custom fields
custom_fieldsobject - You can add custom fields for messages. For example, set priorities for messages. You must enable this option and define the validation in the workspace settings. See the Message settings for further information.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": "example",
"message": {
"_id": "example",
"_updatedAt": "example",
"alias": "example",
"groupable": false,
"msg": "example",
"parseUrls": false,
"rid": "example",
"ts": "example",
"u": {
"_id": "example",
"username": "example"
}
},
"success": true,
"ts": 0
},
"has_more": false,
"next_cursor": null
}React to message
React or unreact to a chat message.
Inputs
- Message ID
message_idtextRequired - The message ID to react to.
- Emoji
emojitextRequired - The emoji to react with. It's required if you aren't using the `reaction` parameter.
- Should react
should_reacttrue/false - Boolean to specify if the reaction should be added or removed.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true
},
"has_more": false,
"next_cursor": null
}Rename channel
Change the name of a channel.
Inputs
- Room
room_idtextRequired - The channel's ID.
- Name
nametextRequired - The new name of the channel. It can not be the same as the current name.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"channel": {
"_id": "example",
"_updatedAt": "example",
"msgs": 0,
"name": "example",
"ro": false,
"sysMes": false,
"t": "example",
"ts": "example",
"u": {
"_id": "example",
"username": "example"
},
"usernames": []
},
"success": true
},
"has_more": false,
"next_cursor": null
}Set channel announcement
Set an announcement for the channel.
Inputs
- Room
room_idtextRequired - The channel's id
- Announcement
announcementtextRequired - The announcement to set for the channel.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"announcement": "example",
"success": true
},
"has_more": false,
"next_cursor": null
}Set channel description
Set the description for a channel.
Inputs
- Room
room_idtextRequired - The channel ID.
- Description
descriptiontextRequired - The description to set for the channel.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"description": "example",
"success": true
},
"has_more": false,
"next_cursor": null
}Set channel topic
Set the topic for a channel.
Inputs
- Room
room_idtextRequired - The channel's ID.
- Topic
topictextRequired - The channel's topic
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true,
"topic": "example"
},
"has_more": false,
"next_cursor": null
}Unarchive channel
Unarchive a channel.
Inputs
- Room
room_idtextRequired - The channel ID that you want to unarchive.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"success": true
},
"has_more": false,
"next_cursor": null
}Update message
Update a specific message.
Inputs
- Room
room_idtextRequired - The room ID where the message is.
- Msg ID
msg_idtextRequired - The message ID to update.
- Text
texttextRequired - Updated text for the message.
- Preview URLS
preview_urlslist - An array to define which URL previews should be retrieved from each message.
- Custom fields
custom_fieldsobject - You can add custom fields for messages. For example, set priorities for messages. You must enable this option and define the validation in the workspace settings. See the Message settings for further information.
Outputs
Result.
dataobject- The complete service response; record and list fields retain their API names.
has_moretrue/false- Whether the API reports another page.
next_cursortext- Pass to the pagination field for the next page, when Has more is true.
Example output
{
"data": {
"message": {
"_id": "example",
"_updatedAt": "example",
"channels": [],
"editedAt": "example",
"editedBy": {
"_id": "example",
"username": "example"
},
"md": [],
"mentions": [],
"msg": "example",
"rid": "example",
"ts": "example",
"u": {
"_id": "example",
"name": "example",
"username": "example"
},
"urls": []
},
"success": true
},
"has_more": false,
"next_cursor": null
}