# Rocket.Chat

> Read public channels and messages, manage channels, post replies and react to messages in Rocket.Chat.

App · 23 actions. Web page: https://docs.lodol.com/docs/integrations/rocket-chat

## Actions

### Archive channel

Archive a channel.

**Inputs**

- Room (`room_id`, text, required): The channel ID that you want to archive.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Create channel

Create a public channel.

**Inputs**

- Name (`name`, text, required): The name of the channel.
- Members (`members`, list): An array of the users to be added to the channel when it is created.
- Read only (`read_only`, true/false): Set if the channel is read only or not. It is `false` by default.
- Exclude self (`exclude_self`, true/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_fields`, object): 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_data`, object): Additional channel settings applied at creation. For more information, see Channels .

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): Enter the room ID. This parameter is required if no `roomName` is provided.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Delete message

Delete a chat message.

**Inputs**

- Room (`room_id`, text, required): The room ID. Required when deleting by `msgId`.
- Msg ID (`msg_id`, text, required): The ID of the message to delete. Required together with `roomId`.
- As user (`as_user`, true/false): Should the message be deleted as the user who sent it? It is `false` by default.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The room ID. It is required if the `roomName` is not provided.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The room ID. It is required if the `roomName` is not provided.
- Sort (`sort`, object): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Offset (`offset`, number): 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 (`latest`, date and time): The end of time range of messages to retrieve. The default value is the current date and time.
- Oldest (`oldest`, date and time): The start of the time range of messages to retrieve
- Inclusive (`inclusive`, true/false): Whether messages which land on the latest and oldest dates should be included. The default value is false.
- Show thread messages (`show_thread_messages`, true/false): Whether thread messages should be included in the response
- Unreads (`unreads`, true/false): Whether the number of unread messages should be included. The default value is false.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The message ID.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The `userId` of the user. Alternatively, you can use `username`, `importId`, `email`, or `freeSwitchExtension` to retrieve user information.
- Include user rooms (`include_user_rooms`, text): Whether to include the list of rooms the user is a member of.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The channel ID.
- Join code (`join_code`, text): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The channel ID that you want to leave.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The room ID. It is required if the `roomName` is not provided.
- Status (`status`, list): The user's status (search filter).
- Filter (`filter`, text): Extra search filters to be applied to the fields defined in the `Accounts_SearchFields`setting.
- Sort (`sort`, object): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Offset (`offset`, number): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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 (`offset`, number): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Sort (`sort`, object): 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 (`query`, object): 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 (`fields`, object): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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 (`offset`, number): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Query (`query`, object): 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 (`fields`, object): 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 (`sort`, object): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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 (`offset`, number): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Sort (`sort`, object): 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 (`query`, object): 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 (`fields`, object): 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 (`tmid`, text, required): The thread message ID.
- Around ID (`around_id`, text): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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 (`query`, object): 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 (`fields`, object): 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 (`offset`, number): 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 (`count`, number): The number of items to return. Refer to the official documentation to learn more. At least 1.
- Sort (`sort`, object): 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 (`email`, text): Filter users by email address. Minimum length: 1 character.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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 (`alias`, text): This will cause the message's name to appear as the given alias, but your username will still be displayed.
- Avatar (`avatar`, text): If provided, the avatar will be displayed as the provided image URL.
- Emoji (`emoji`, text): If provided, the avatar will be displayed as an emoji.
- Room (`room_id`, text, required): 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 (`text`, text, required): The message text to send, it is optional because of attachments.
- Parse URLS (`parse_urls`, true/false): Set `parseUrls` to `false` to prevent Rocket.Chat from generating link previews when the message in `text` contains a URL.
- Attachments (`attachments`, list): Attachments.
- Tmid (`tmid`, text): The message ID of the original message to reply to or to create a thread on.
- Custom fields (`custom_fields`, object): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The message ID to react to.
- Emoji (`emoji`, text, required): The emoji to react with. It's required if you aren't using the `reaction` parameter.
- Should react (`should_react`, true/false): Boolean to specify if the reaction should be added or removed.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Rename channel

Change the name of a channel.

**Inputs**

- Room (`room_id`, text, required): The channel's ID.
- Name (`name`, text, required): The new name of the channel. It can not be the same as the current name.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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_id`, text, required): The channel's id
- Announcement (`announcement`, text, required): The announcement to set for the channel.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "announcement": "example",
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Set channel description

Set the description for a channel.

**Inputs**

- Room (`room_id`, text, required): The channel ID.
- Description (`description`, text, required): The description to set for the channel.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "description": "example",
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Set channel topic

Set the topic for a channel.

**Inputs**

- Room (`room_id`, text, required): The channel's ID.
- Topic (`topic`, text, required): The channel's topic

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "success": true,
    "topic": "example"
  },
  "has_more": false,
  "next_cursor": null
}
```

### Unarchive channel

Unarchive a channel.

**Inputs**

- Room (`room_id`, text, required): The channel ID that you want to unarchive.

**Outputs**: Result.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "data": {
    "success": true
  },
  "has_more": false,
  "next_cursor": null
}
```

### Update message

Update a specific message.

**Inputs**

- Room (`room_id`, text, required): The room ID where the message is.
- Msg ID (`msg_id`, text, required): The message ID to update.
- Text (`text`, text, required): Updated text for the message.
- Preview URLS (`preview_urls`, list): An array to define which URL previews should be retrieved from each message.
- Custom fields (`custom_fields`, object): 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.

- `data` (object): The complete service response; record and list fields retain their API names.
- `has_more` (true/false): Whether the API reports another page.
- `next_cursor` (text): Pass to the pagination field for the next page, when Has more is true.

**Example output**

```json
{
  "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
}
```
