openapi: 3.0.0
info:
version: 1.0.0
title: Messaging
# description: |-
# * **Chat**: Create and manage chat [messages](https://docs.rocket.chat/use-rocket.chat/user-guides/messages/message-actions).
# * **DM**: Create and manage direct messages. The DM (dm.*) and IM (im.*) endpoint groups provide identical functionality. For example, im.close and dm.close execute the same operation.
servers:
- url: https://apiexplorer.support.rocket.chat
paths:
/api/v1/chat.delete:
post:
tags:
- Chat
summary: Delete Chat Message
description: |
Delete a chat message.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.48.0 | Added |
operationId: post-api-v1-chat.delete
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
description: ''
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room ID
msgId:
type: string
description: The id of the message to delete.
asUser:
type: boolean
description: Should the message be deleted as the user who sent it? It is `false` by default.
required:
- roomId
- msgId
examples:
Example:
value:
roomId: ByehQjC44FwMeiLbX
msgId: 7aDSXtjMA3KPLxLjt
asUser: false
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
_id:
type: string
ts:
type: string
message:
type: object
properties:
_id:
type: string
rid:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
success:
type: boolean
examples:
Example 1:
value:
_id: jEnjsxuoDJamGjbH2
ts: '1696533809813'
message:
_id: jEnjsxuoDJamGjbH2
rid: 6GFJ3tbmHiyHbahmC
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.test
name: Testtest
success: true
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
examples:
Example 1:
value:
success: false
error: The room id provided does not match where the message is from.
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/chat.react:
post:
tags:
- Chat
summary: React to Message
description: |-
React or unreact to a chat message.
### Changelog
| Version | Description |
| ---------------- | ------------|
|0.64.0 | Added parameter "shouldReact" to make endpoint work like a setter|
|0.63.0 | Emoji has to exist |
|0.62.2 |Added |
operationId: post-api-v1-chat.react
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
description: 'The emoji doesn''t have to contain `:`. However, the emoji must exist. Using either the `emoji` or `reaction` parameter is required.'
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID to react to.
emoji:
type: string
description: The emoji to react with. It's required if you aren't using the `reaction` parameter.
reaction:
type: string
description: The reaction to use. It's required if you aren't using the `emoji` parameter.
shouldReact:
type: boolean
description: Boolean to specify if the reaction should be added or removed.
required:
- messageId
examples:
Example 1:
value:
messageId: 7aDSXtjMA3KPLxLjt
emoji: smile
shouldReact: true
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "messageId" param is missing. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
Example 2:
value:
success: false
error: 'The provided "messageId" does not match any existing message. [error-message-not-found]'
errorType: error-message-not-found
/api/v1/chat.update:
post:
tags:
- Chat
summary: Update Message
description: |-
Update a specific message.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 6.12.0 | Fixed `customFields` not updating if `text` was unchanged |
| 6.4.0 | Add previewUrls param |
| 0.49.0 | Added |
operationId: post-api-v1-chat.update
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room ID where the message is.
msgId:
type: string
description: The message ID to update.
text:
type: string
description: Updated text for the message.
previewUrls:
type: array
description: An array to define which URL previews should be retrieved from each message.
items:
type: string
customFields:
type: object
description: |-
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.
example: {"priority": "high"}
required:
- roomId
- msgId
- text
examples:
Example:
value:
roomId: 64f0f82c2c26843a68c1f7ba
msgId: vzGBzSwy6jJQDwtZe
text: 'Updated list of links! https://google.com https://hola.org/ https://www.usepayday.com/ https://www.getbumpa.com/ https://www.atlassian.com/software/jira http://localhost:3000/'
previewUrls:
- 'https://google.com'
- 'http://localhost:3000/'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
properties:
url:
type: string
meta:
type: object
ignoreParse:
type: boolean
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
editedAt:
type: string
editedBy:
type: object
properties:
_id:
type: string
username:
type: string
success:
type: boolean
examples:
Example:
value:
message:
_id: vzGBzSwy6jJQDwtZe
rid: 64f0f82c2c26843a68c1f7ba
msg: 'Updated list of links! https://google.com https://hola.org/ https://www.usepayday.com/ https://www.getbumpa.com/ https://www.atlassian.com/software/jira http://localhost:3000/'
ts: '2023-09-20T17:27:59.945Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-09-20T22:22:45.793Z'
urls:
- url: 'https://google.com'
meta: {}
- url: 'https://hola.org/'
meta: {}
ignoreParse: true
- url: 'https://www.atlassian.com/software/jira'
meta: {}
ignoreParse: true
- url: 'http://localhost:3000/'
meta: {}
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: 'Updated list of links! '
- type: LINK
value:
src:
type: PLAIN_TEXT
value: 'https://google.com'
label:
- type: PLAIN_TEXT
value: 'https://google.com'
- type: PLAIN_TEXT
value: ' '
- type: LINK
value:
src:
type: PLAIN_TEXT
value: 'https://hola.org/'
label:
- type: PLAIN_TEXT
value: 'https://hola.org/'
- type: PLAIN_TEXT
value: ' '
- type: LINK
value:
src:
type: PLAIN_TEXT
value: 'https://www.atlassian.com/software/jira'
label:
- type: PLAIN_TEXT
value: 'https://www.atlassian.com/software/jira'
- type: PLAIN_TEXT
value: ' '
- type: LINK
value:
src:
type: PLAIN_TEXT
value: 'http://localhost:3000/'
label:
- type: PLAIN_TEXT
value: 'http://localhost:3000/'
editedAt: '2023-09-20T22:22:45.737Z'
editedBy:
_id: rbAXPnMktTFbNpwtJ
username: roxie
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "messageId" param is missing. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
/api/v1/chat.reportMessage:
post:
tags:
- Chat
summary: Report Message
description: |-
Report a specific message.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.64.0 | Added |
operationId: post-api-v1-chat.reportMessage
parameters:
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/Auth-Token'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID to report.
description:
type: string
description: The description of report.
required:
- messageId
- description
examples:
Example 1:
value:
messageId: 7aDSXtjMA3KPLxLjt
description: test
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'must have required property ''messageId'' [invalid-params]'
errorType: invalid-params
Example 2:
value:
success: false
error: 'must have required property ''description'' [invalid-params]'
errorType: invalid-params
/api/v1/chat.followMessage:
post:
tags:
- Chat
summary: Follow Message
description: |-
Follow a message to receive notifications.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 1.0.0 | Added |
operationId: post-api-v1-chat.followMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
description: ''
content:
application/json:
schema:
type: object
properties:
mid:
type: string
description: The `id` of the message to follow.
required:
- mid
examples:
Example 1:
value:
mid: 7aDSXtjMA3KPLxLjt
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: '[The required "mid" body param is missing.]'
errorType: The required "mid" body param is missing.
Invalid message ID:
value:
success: false
error: 'Invalid message [error-invalid-message]'
errorType: error-invalid-message
details:
method: followMessage
/api/v1/chat.unfollowMessage:
post:
tags:
- Chat
summary: Unfollow Message
description: |-
Unfollow a message.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 1.0.0 | Added |
operationId: post-api-v1-chat.unfollowMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
description: ''
content:
application/json:
schema:
type: object
properties:
mid:
type: string
description: The message ID to unfollow.
required:
- mid
examples:
Example 1:
value:
mid: 7aDSXtjMA3KPLxLjt
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: '[The required "mid" body param is missing.]'
errorType: The required "mid" body param is missing.
Invalid message ID:
value:
success: false
error: 'Invalid message [error-invalid-message]'
errorType: error-invalid-message
details:
method: unfollowMessage
/api/v1/chat.getMessage:
get:
tags:
- Chat
summary: Get Message
description: |-
Get a single chat message. You must have permission to access the room where the message resides.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.47.0 | Added |
operationId: get-api-v1-chat.getMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- name: msgId
in: query
description: The message ID.
required: true
schema:
type: string
example: 7aDSXtjMA3KPLxLjt
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
alias:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
reactions:
type: object
properties:
':frowning2:':
type: object
properties:
usernames:
type: array
items:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
starred:
type: object
properties:
_id:
type: string
t:
type: string
groupable:
type: boolean
success:
type: boolean
examples:
Success:
value:
message:
_id: CeXwh5eBbdrtvnqG6
rid: agh2Sucgb54RQ8dDo
msg: s
ts: '2018-10-05T13:48:21.616Z'
u:
_id: KPkEYwKKBKZnEEPpt
username: marc.pow
name: Marc Pow
_updatedAt: '2018-10-05T13:48:49.535Z'
reactions:
':frowning2:':
usernames:
- marcos.defendi
mentions: [ ]
channels: [ ]
starred:
_id: KPkEYwKKBKZnEEPpt
count: 2
offset: 0
total: 2
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
examples:
Example 1:
value:
success: false
error: The "msgId" query parameter must be provided.
/api/v1/chat.getThreadsList:
get:
tags:
- Chat
summary: List Threads
description: |-
Get a list of the thread conversations in a room.
### Changelog
| Version | Description |
| ---------------- | ------------|
|1.0.0 | Added |
operationId: get-chat.getThreadsList
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
- name: rid
in: query
description: The room ID.
schema:
type: string
example: 7aDSXtjMA3KPLxLjt
required: true
- name: type
in: query
schema:
type: string
description: |-
Filter the thread by type. It can either be:
- `unread`: returns the threads you follow which has unread messages.
- `following`: returns all the thread you follow.
- name: text
in: query
schema:
type: string
description: Filter the thread list by search term.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
threads:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
reactions:
type: object
properties:
':smile:':
type: object
properties:
usernames:
type: array
items:
type: string
starred:
type: array
items:
type: object
pinned:
type: boolean
pinnedAt:
type: string
pinnedBy:
type: object
properties:
_id:
type: string
username:
type: string
replies:
type: array
items:
type: string
tcount:
type: integer
tlm:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
threads:
- _id: NZieMNQDEdMDmLLip
rid: 6GFJ3tbmHiyHbahmC
msg: hola
ts: '2023-10-05T20:30:51.052Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-16T22:57:27.362Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: hola
reactions:
':smile:':
usernames:
- test.test
starred: []
pinned: true
pinnedAt: '2023-10-05T20:59:44.433Z'
pinnedBy:
_id: 5fRTXMt7DMJbpPJfh
username: test.test
replies:
- rbAXPnMktTFbNpwtJ
tcount: 2
tlm: '2023-10-16T22:57:27.158Z'
count: 1
offset: 0
total: 1
success: true
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/chat.getDeletedMessages:
get:
tags:
- Chat
summary: Get Deleted Messages
description: |-
Get deleted messages from a specific date.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.73.0 | Added |
operationId: get-api-v1-chat.getDeletedMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: since
in: query
description: A valid ISO date format from which you want to search the deleted messages.
required: true
schema:
type: string
example: 2018-12-12T00:11:22.345Z
- $ref: '#/components/parameters/RoomId'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: wKBW2YwrPahpag4zA
- _id: SJXYBbageAo8bo7rX
- _id: jEnjsxuoDJamGjbH2
count: 3
offset: 0
total: 3
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: '[The required "roomId" query param is missing.]'
errorType: The required "roomId" query param is missing.
Example 2:
value:
success: false
error: '[The required "since" query param is missing.]'
errorType: The required "since" query param is missing.
/api/v1/chat.getDiscussions:
get:
tags:
- Chat
summary: Get Discussions of A Room
description: |-
Gets the discussions in a room.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 2.4.0 | Added |
operationId: get-api-v1-chat.getDiscussions
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: text
in: query
schema:
type: string
description: Filter the thread list by search term.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
t:
type: string
rid:
type: string
ts:
type: string
msg:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
groupable:
type: boolean
drid:
type: string
_updatedAt:
type: string
dcount:
type: integer
dlm:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: 652dc4dda2f73c7460e18df8
t: discussion-created
rid: 6GFJ3tbmHiyHbahmC
ts: '2023-10-16T23:18:53.926Z'
msg: test discuss
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
groupable: false
drid: 652dc4dda2f73c7460e18df6
_updatedAt: '2023-10-16T23:19:18.992Z'
dcount: 2
dlm: '2023-10-16T23:19:18.748Z'
count: 1
offset: 0
total: 1
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "roomId" query param is missing. [error-invalid-params]'
errorType: error-invalid-params
Incorrect room ID:
value:
success: false
error: error-not-allowed
/api/v1/chat.getMentionedMessages:
get:
tags:
- Chat
summary: Get Mentioned Messages
description: |-
Get the messages in which you are mentioned (users are mentioned with the `@` symbol). Visit the [Messages](https://docs.rocket.chat/docs/messages#mention-users) user guide to learn more.
### Changelog
| Version | Description |
| ------------ | ------------|
| 2.2.0 | Added |
operationId: get-api-v1-chat.getMentionedMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
type:
type: string
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: p93m92bPRudzoJ7oW
rid: 6GFJ3tbmHiyHbahmC
msg: '@test.john hello'
ts: '2023-10-16T23:27:02.945Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-16T23:27:03.071Z'
urls: []
mentions:
- _id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
type: user
channels: []
md:
- type: PARAGRAPH
value:
- type: MENTION_USER
value:
type: PLAIN_TEXT
value: test.john
- type: PLAIN_TEXT
value: ' hello'
- _id: 4Q8nmha5doDHus5YR
rid: 6GFJ3tbmHiyHbahmC
msg: '@test.john'
ts: '2023-10-16T23:26:38.611Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-16T23:26:38.728Z'
urls: []
mentions:
- _id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
type: user
channels: []
md:
- type: PARAGRAPH
value:
- type: MENTION_USER
value:
type: PLAIN_TEXT
value: test.john
count: 2
offset: 0
total: 2
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "roomId" query param is missing. [error-invalid-params]'
errorType: error-invalid-params
Incorrect room ID:
value:
success: false
error: error-not-allowed
/api/v1/chat.getMessageReadReceipts:
get:
tags:
- Chat
summary: Get Message Read Receipts
description: |-

Get the read receipts of messages.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.63.0 | Added |
operationId: get-api-v1-chat.getMessageReadReceipts
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- name: messageId
in: query
description: The message id
required: true
schema:
type: string
example: ByehQjC44FwMeiLbX
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
receipts:
type: array
items:
type: object
properties:
_id:
type: string
roomId:
type: string
userId:
type: string
messageId:
type: string
ts:
type: string
user:
type: object
properties:
username:
type: string
name:
type: string
_id:
type: string
success:
type: boolean
examples:
Example 1:
value:
receipts:
- _id: HksCYdTpCiM9DZ7Sa
roomId: GENERAL
userId: nvw6PBrXTejp4sfQt
messageId: WyDsZzjk2wHogtWK2
ts: '2018-02-26T20:34:03.907Z'
user:
username: rocket.cat
name: Rocket cat
_id: nvw6PBrXTejp4sfQt
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
error:
type: string
success:
type: boolean
examples:
Example 1:
value:
error: The required 'messageId' param is missing.
success: false
/api/v1/chat.getPinnedMessages:
get:
tags:
- Chat
summary: Get Pinned Messages
description: |-
Get the pinned messages of a room.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 2.0.0 | Added |
operationId: get-api-v1-chat.getPinnedMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
pinned:
type: boolean
pinnedAt:
type: string
pinnedBy:
type: object
properties:
_id:
type: string
username:
type: string
reactions:
type: object
properties:
':smile:':
type: object
properties:
usernames:
type: array
items:
type: string
starred:
type: array
items:
type: object
replies:
type: array
items:
type: string
tcount:
type: integer
tlm:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: ycHhPqyoN2BZHt3Ag
rid: 6GFJ3tbmHiyHbahmC
msg: ekaara
ts: '2023-02-25T16:08:30.000Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-16T23:30:58.917Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: ekaara
pinned: true
pinnedAt: '2023-10-16T23:30:58.917Z'
pinnedBy:
_id: rbAXPnMktTFbNpwtJ
username: roxie
- _id: Ay9jYg48gzjfpy7pk
rid: 6GFJ3tbmHiyHbahmC
msg: wassup
ts: '2023-10-05T19:10:10.055Z'
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Testtest
_updatedAt: '2023-10-16T23:30:42.393Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: wassup
pinned: true
pinnedAt: '2023-10-16T23:30:42.393Z'
pinnedBy:
_id: rbAXPnMktTFbNpwtJ
username: roxie
- _id: NZieMNQDEdMDmLLip
rid: 6GFJ3tbmHiyHbahmC
msg: hola
ts: '2023-10-05T20:30:51.052Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-16T22:57:27.362Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: hola
reactions:
':smile:':
usernames:
- test.test
starred: []
pinned: true
pinnedAt: '2023-10-05T20:59:44.433Z'
pinnedBy:
_id: 5fRTXMt7DMJbpPJfh
username: test.test
replies:
- rbAXPnMktTFbNpwtJ
tcount: 2
tlm: '2023-10-16T22:57:27.158Z'
count: 3
offset: 0
total: 3
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "roomId" query param is missing. [error-roomId-param-not-provided]'
errorType: error-roomId-param-not-provided
Incorrect room ID:
value:
success: false
error: 'Not allowed [error-not-allowed]'
errorType: error-not-allowed
/api/v1/chat.getStarredMessages:
get:
tags:
- Chat
summary: Get Starred Messages
description: |-
Get the starred messages of the authenticated user in a room.
### Changelog
| Version | Description |
| ------------ | ------------|
| 2.2.0 | Added |
operationId: get-api-v1-chat.getStarredMessages
parameters:
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
t:
type: string
rid:
type: string
ts:
type: string
msg:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
groupable:
type: boolean
drid:
type: string
_updatedAt:
type: string
dcount:
type: integer
dlm:
type: string
starred:
type: array
items:
type: object
properties:
_id:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: 652dc4dda2f73c7460e18df8
t: discussion-created
rid: 6GFJ3tbmHiyHbahmC
ts: '2023-10-16T23:18:53.926Z'
msg: test discuss
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
groupable: false
drid: 652dc4dda2f73c7460e18df6
_updatedAt: '2023-10-17T12:51:07.826Z'
dcount: 3
dlm: '2023-10-16T23:25:58.375Z'
starred:
- _id: 5fRTXMt7DMJbpPJfh
count: 1
offset: 0
total: 1
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "roomId" query param is missing. [error-invalid-params]'
errorType: error-invalid-params
Incorrect room ID:
value:
success: false
error: error-not-allowed
/api/v1/chat.getThreadMessages:
get:
tags:
- Chat
summary: Get Thread Messages
description: |-
Get thread messages.
### Changelog
| Version | Description |
| ------------ | ------------|
| 1.2.0 | Remove `tlm` field which is not supported |
| 1.1.0 | Update example results - original message in thread is not returned |
| 1.0.0 | Added |
operationId: get-api-v1-chat.getThreadMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
- name: tmid
in: query
description: The thread message ID.
required: true
schema:
type: string
example: 7aDSXtjMA3KPLxLjt
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
replies:
type: array
items:
type: string
tcount:
type: integer
tlm:
type: string
tmid:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example:
value:
messages:
- _id: gcGai9bRREqokjyPc
rid: GENERAL
msg: Test
ts: '2019-04-08T13:15:52.017Z'
u:
_id: p4a8YxvLQEHmiBKTS
username: marc.dev
name: Marc Dev
_updatedAt: '2019-04-08T14:40:27.789Z'
mentions: []
channels: []
replies:
- p4a8YxvLQEHmiBKTS
tcount: 5
tlm: '2019-04-08T14:40:27.724Z'
- _id: GfhiiJjcjKFyYMuMY
rid: GENERAL
tmid: gcGai9bRREqokjyPc
msg: This is a test!
ts: '2019-04-08T13:20:22.238Z'
u:
_id: p4a8YxvLQEHmiBKTS
username: marc.dev
name: Marc Dev
_updatedAt: '2019-04-08T13:20:22.265Z'
mentions: []
channels: []
count: 2
offset: 0
total: 2
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing parameter:
value:
success: false
error: 'The required "tmid" query param is missing. [error-invalid-params]'
errorType: error-invalid-params
Invalid Message:
value:
success: false
error: 'Invalid Message [error-invalid-message]'
errorType: error-invalid-message
/api/v1/chat.ignoreUser:
get:
tags:
- Chat
summary: Ignore User
description: |-
Ignore or unignore a user in chat.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.64.0 | Added |
operationId: get-api-v1-chat.ignoreUser
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- name: rid
in: query
description: The room ID.
required: true
schema:
type: string
- name: userId
in: query
description: The user ID.
required: true
schema:
type: string
- name: ignore
in: query
description: 'If the user is to be ignored or not, default is true.'
schema:
type: boolean
required: true
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing RoomId:
value:
success: false
error: 'The required "rid" param is missing. [error-room-id-param-not-provided]'
errorType: error-room-id-param-not-provided
Missing UserId:
value:
success: false
error: 'The required "userId" param is missing. [error-user-id-param-not-provided]'
errorType: error-user-id-param-not-provided
Invalid room or user ID:
value:
success: false
error: 'Invalid subscription [error-invalid-subscription]'
errorType: error-invalid-subscription
details:
method: ignoreUser
/api/v1/chat.pinMessage:
post:
tags:
- Chat
summary: Pin Message
description: |-
Pin a chat message to the channel.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.59.0 | Added |
operationId: post-api-v1-chat.pinMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID that you want to pin.
required:
- messageId
examples:
Example:
value:
messageId: 7aDSXtjMA3KPLxLjt
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
_id:
type: string
t:
type: string
rid:
type: string
ts:
type: string
msg:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
groupable:
type: boolean
attachments:
type: array
items:
type: object
properties:
text:
type: string
author_name:
type: string
author_icon:
type: string
ts:
type: string
attachments:
type: array
items:
type: object
_updatedAt:
type: string
success:
type: boolean
examples:
Example 1:
value:
message:
_id: 651f23c0a2f73c7460e18d1a
t: message_pinned
rid: 6GFJ3tbmHiyHbahmC
ts: '2023-10-05T20:59:44.503Z'
msg: ''
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.test
name: Testtest
groupable: false
attachments:
- text: hola
author_name: roxie
author_icon: /avatar/roxie
ts: '2023-10-05T20:30:51.052Z'
attachments: []
_updatedAt: '2023-10-05T20:59:44.521Z'
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "messageId" param is missing. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
Example 2:
value:
success: false
error: 'The provided "messageId" does not match any existing message. [error-message-not-found]'
errorType: error-message-not-found
/api/v1/chat.unPinMessage:
post:
tags:
- Chat
summary: Unpin a message
description: |-
Remove a pinned message from the channel.
### Changelog
| Version | Description |
| -------------| ------------|
| 0.59.0 | Added |
operationId: post-api-v1-chat.unPinMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID you want to to unpin.
required:
- messageId
examples:
Example:
value:
messageId: 7aDSXtjMA3KPLxLjt
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing Parameter:
value:
success: false
error: 'The required "messageId" param is missing. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
Invalid Parameter:
value:
success: false
error: 'The provided "messageId" does not match any existing message. [error-message-not-found]'
errorType: error-message-not-found
/api/v1/chat.postMessage:
post:
tags:
- Chat
summary: Post Message
description: |-
Send messages to channels or users on your workspace.
**Note**: You can only send alias and avatar properties if your user has the `message-impersonate permission`. We implemented this rule to avoid users impersonating other users. By default, only the bot role has this permission, but that can be changed in **Administration** -> **Permissions** -> **message-impersonate**
### Change Log
| Version | Description |
| ------- |---------------------------------------------------------------------------- |
| 6.8.0 | Allow custom fields in messages |
| 2.4.1 | Document existing method to post reply/threaded messages |
| 2.4.0 | Added validation on user's identity |
| 0.49.0 | The `channel` can now be a room's id. |
| 0.48.0 | Information about the sent message is now returned. |
| 0.17.0 | Messages aren't always processed as from BOT and urls are parsed by default. |
| 0.14.0 | Internally using `processWebhookMessage` which enabled more features. |
| 0.13.0 | Added |
operationId: post-api-v1-chat.postMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
required: ["roomId"]
properties:
alias:
type: string
description: 'This will cause the message''s name to appear as the given alias, but your username will still be displayed.'
avatar:
type: string
description: 'If provided, the avatar will be displayed as the provided image URL.'
emoji:
type: string
description: 'If provided, the avatar will be displayed as an emoji.'
example: ":smile:"
roomId:
type: string
description: 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.
example: "#general"
text:
type: string
description: 'The message text to send, it is optional because of attachments.'
parseUrls:
type: boolean
description: 'Set `parseUrls` to `false` to prevent Rocket.Chat from generating link previews when the message in `text` contains a URL.'
attachments:
type: array
items:
type: object
properties:
audio_url:
type: string
description: |-
Audio file to attach. See the HTML audio element for information.
author_icon:
type: string
description: Displays a tiny icon to the left of the author's name.
author_link:
type: string
description: Providing this makes the author's name clickable and points to the provided link.
author_name:
type: string
description: Name of the author.
collapsed:
type: boolean
description: 'Causes the image, audio, and video sections to be displayed as collapsed when set to true.'
color:
type: string
description: |-
See background-css for the supported colors.'
fields:
type: array
items:
type: object
properties:
short:
type: boolean
description: Whether this field should be a short field.
title:
type: string
description: The title of this field.
value:
type: string
description: 'The value of this field, displayed underneath the title value.'
required:
- title
- value
image_url:
type: string
description: 'The image to display, will be big and easy to see.'
message_link:
type: string
description: 'Only applicable if the `ts` field is provided, as it makes the time clickable to this link.'
text:
type: string
description: 'The text to display for this attachment, it is different than the message''s text.'
thumb_url:
type: string
description: 'An image that displays to the left of the text, looks better when this is relatively small.'
title:
type: string
description: 'Title to display for this attachment, displays under the author.'
title_link:
type: string
description: 'Providing this makes the title clickable, pointing to this link.'
title_link_download:
type: boolean
description: 'When this is true, a download icon appears and clicking this saves the link to file.'
ts:
type: string
description: Displays the time next to the text portion.
video_url:
type: string
description: |-
Video file to attach. See the HTML video element for information.
tmid:
type: string
description: The message ID of the original message to reply to or to create a thread on.
customFields:
type: object
description: |-
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.
example: {"priority": "high"}
- type: object
required: ["channel"]
properties:
alias:
type: string
description: 'This will cause the message''s name to appear as the given alias, but your username will still be displayed.'
avatar:
type: string
description: 'If provided, the avatar will be displayed as the provided image URL.'
channel:
type: string
description: The channel ID or an array of channel 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.
example: "#test-room"
emoji:
type: string
description: 'If provided, the avatar will be displayed as an emoji.'
example: ":smile:"
text:
type: string
description: 'The message text to send, it is optional because of attachments.'
parseUrls:
type: boolean
description: 'Set `parseUrls` to `false` to prevent Rocket.Chat from generating link previews when the message in `text` contains a URL.'
attachments:
type: array
items:
type: object
properties:
audio_url:
type: string
description: |-
Audio file to attach. See the HTML audio element for information.
author_icon:
type: string
description: Displays a tiny icon to the left of the author's name.
author_link:
type: string
description: Providing this makes the author's name clickable and points to the provided link.
author_name:
type: string
description: Name of the author.
collapsed:
type: boolean
description: 'Causes the image, audio, and video sections to be displayed as collapsed when set to true.'
color:
type: string
description: |-
See background-css for the supported colors.'
fields:
type: array
items:
type: object
properties:
short:
type: boolean
description: Whether this field should be a short field.
title:
type: string
description: The title of this field.
value:
type: string
description: 'The value of this field, displayed underneath the title value.'
required:
- title
- value
image_url:
type: string
description: 'The image to display, will be big and easy to see.'
message_link:
type: string
description: 'Only applicable if the `ts` field is provided, as it makes the time clickable to this link.'
text:
type: string
description: 'The text to display for this attachment, it is different than the message''s text.'
thumb_url:
type: string
description: 'An image that displays to the left of the text, looks better when this is relatively small.'
title:
type: string
description: 'Title to display for this attachment, displays under the author.'
title_link:
type: string
description: 'Providing this makes the title clickable, pointing to this link.'
title_link_download:
type: boolean
description: 'When this is true, a download icon appears and clicking this saves the link to file.'
ts:
type: string
description: Displays the time next to the text portion.
video_url:
type: string
description: |-
Video file to attach. See the HTML video element for information.
customFields:
type: object
description: |-
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.
example: {"priority": "high"}
examples:
Example:
value:
alias: Gruggy
avatar: 'http://res.guggy.com/logo_128.png'
channel: '#general'
emoji: ':smirk:'
roomId: Xnb2kLD2Pnhdwe3RH
text: Sample message
attachments:
- audio_url: 'http://www.w3schools.com/tags/horse.mp3'
author_icon: 'https://avatars.githubusercontent.com/u/850391?v=3'
author_link: 'https://rocket.chat/'
author_name: Bradley Hilton
collapsed: false
color: '#ff0000'
fields:
- short: true
title: Test
value: Testing out something or other
- short: true
title: Another Test
value: '[Link](https://google.com/) something and this and that.'
image_url: 'http://res.guggy.com/logo_128.png'
message_link: 'https://google.com'
text: Yay for gruggy!
thumb_url: 'http://res.guggy.com/logo_128.png'
title: Attachment Example
title_link: 'https://youtube.com'
title_link_download: true
ts: '2016-12-09T16:53:06.761Z'
video_url: 'http://www.w3schools.com/tags/movie.mp4'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ts:
type: integer
channel:
type: string
message:
type: object
properties:
alias:
type: string
msg:
type: string
parseUrls:
type: boolean
groupable:
type: boolean
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
rid:
type: string
_updatedAt:
type: string
_id:
type: string
success:
type: boolean
examples:
Example:
value:
ts: 1481748965123
channel: general
message:
alias: ''
msg: This is a test!
parseUrls: true
groupable: false
ts: '2016-12-14T20:56:05.117Z'
u:
_id: y65tAmHs93aDChMWu
username: graywolf336
rid: GENERAL
_updatedAt: '2016-12-14T20:56:05.119Z'
_id: jC9chsFddTvsbFQG7
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing or invalid room ID:
value:
success: false
error: '[invalid-channel]'
errorType: invalid-channel
/api/v1/chat.search:
get:
tags:
- Chat
summary: Search Message
description: |
Search for messages by room ID and text message.
### Changelog
| Version | Description |
| -------------| ------------|
| 0.67.0 | Changed limit query parameter to count|
| 0.60.0 | Added |
operationId: get-api-v1-chat.search
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/offset'
- name: roomId
in: query
description: The room ID.
required: true
schema:
type: string
- name: searchText
in: query
description: The text to search for in messages.
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
_updatedAt:
type: string
score:
type: number
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: px9KLW9G2SfD5DKFt
rid: GENERAL
msg: this is a test
ts: '2018-03-27T14:44:00.549Z'
u:
_id: RtMDEYc28fQ5aHpf4
username: marc.dev
name: Marc Dev
mentions: []
channels: []
_updatedAt: '2018-03-27T14:44:00.550Z'
score: 0.5833333333333334
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing roomId:
value:
success: false
error: 'The required "roomId" query param is missing. [error-roomId-param-not-provided]'
errorType: error-roomId-param-not-provided
Missing searchText:
value:
success: false
error: 'The required "searchText" query param is missing. [error-searchText-param-not-provided]'
errorType: error-searchText-param-not-provided
/api/v1/chat.sendMessage:
post:
tags:
- Chat
summary: Send Message
description: |-
The difference between `chat.postMessage` and `chat.sendMessage` is that `chat.sendMessage` allows for passing a value for `_id` and the other one doesn't. Also, `chat.sendMessage` only sends it to one channel whereas the other one allows for sending to more than one channel at a time.
**Note**: You can only send alias and avatar properties if your user has the `message-impersonate permission`. We implemented this rule to avoid users impersonating other users. By default, only the bot role has this permission, but that can be changed in **Administration** -> **Permissions** -> **message-impersonate**.
### Change Log
| Version | Description |
| ------- | ----------------------------------- |
| 6.8.0 | Allow custom fields in messages |
| 6.4.0 | Add `previewUrls` param |
| 2.4.0 | Added validation on user's identity |
| 0.60.0 | Added |
operationId: post-api-v1-chat.sendMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
description: |-
**Some important things to note about the `previewUrls` parameter include:**
* If the `previewUrls` array is empty, no URL will be previewed.
* If the `previewUrls` parameter isn't sent, all URLs (up to a maximum of five external URLs) will be previewed.
* If the message contains attachments or quotes, no URL is previewed.
* Internal URLs are not considered in the `previewUrls` array.
* A maximum of five external URLs is previewed per message. If there are more than 5 external URLs, no URL is previewed.
> URLs that include the same text as the **Site URL** are referred to as Internal URLs.
content:
application/json:
schema:
type: object
required: ["message"]
properties:
message:
type: object
properties:
t:
type: string
description: The message type e.g. e2e
rid:
type: string
description: The room ID where the message is to be sent.
msg:
type: string
description: 'The message text to send, it is optional because of attachments.'
alias:
type: string
description: 'This will cause the message''s name to appear as the given alias, but your username will still be displayed. Requires the `impersonate-other-user` permission'
emoji:
type: string
description: 'If provided, the avatar will be displayed as the emoji. '
avatar:
type: string
description: 'If provided, the avatar will be displayed as the provided image url. Requires the `impersonate-other-user` permission.'
attachments:
type: array
description: |-
The attachment is an array of objects with any of the following properties. One attachment can have many sections, including:
* General
* Author Information
* Title Information
* Image
* Audio
* Video
* Table/Fields
items:
type: object
properties:
audio_url:
type: string
description: |-
Audio file to attach. See HTML audio element for information.
author_icon:
type: string
description: Displays a tiny icon to the left of the author's name.
author_link:
type: string
description: Providing this makes the author name clickable and points to this link.
author_name:
type: string
description: Name of the author.
collapsed:
type: boolean
description: 'Causes the image, audio, and video sections to be displayed as collapsed when set to true.'
color:
type: string
description: |-
See background-css for the supported format.
fields:
type: array
items:
type: object
properties:
short:
type: boolean
description: Whether this field should be a short field.
title:
type: string
description: The title of this field.
value:
type: string
description: 'The value of this field, displayed underneath the title value.'
required:
- title
- value
image_url:
type: string
description: 'The image to display, will be big and easy to see.'
message_link:
type: string
description: 'Only applicable if the `ts` parameter is provided, as it makes the time clickable to this link.'
text:
type: string
description: 'The text to display for this attachment, it is different than the message''s text.'
thumb_url:
type: string
description: 'An image that displays to the left of the text, looks better when this is relatively small.'
title:
type: string
description: 'Title to display for this attachment, displays under the author.'
title_link:
type: string
description: 'Providing this makes the title clickable, pointing to this link.'
title_link_download:
type: boolean
description: 'When this is true, a download icon appears and clicking this saves the link to file.'
ts:
type: string
description: Displays the time next to the text portion.
video_url:
type: string
description: |-
Video file to attach. See the HTML video element for information.
tmid:
type: string
description: The message ID to create a thread.
tshow:
type: string
description: Used when replying in a thread. Message will be sent in channel also if value is true
blocks:
type: array
items:
type: object
properties:
type:
type: string
text:
type: string
description: |-
A message block is an array of objects with any of the following properties. To view the example on how to use this parameter, select **Show example** in this body parameters section. Above the example code block, select the drop-down menu, and select the **Message with Blocks** option. For comprehensive information on blocks, refer to the Apps-Engine UI Blocks documentation.
Blocks can have many sections:
- type
- text
- fields
customFields:
type: object
description: |-
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.
example: {"priority": "high"}
required:
- rid
previewUrls:
type: array
description: An array to define which URL previews should be retrieved from each message.
items:
type: string
examples:
Message with Attachments:
value:
message:
rid: Xnb2kLD2Pnhdwe3RH
msg: Sample message
alias: Gruggy
emoji: ':smirk:'
avatar: 'http://res.guggy.com/logo_128.png'
attachments:
- color: '#ff0000'
text: Yay for gruggy!
ts: '2016-12-09T16:53:06.761Z'
thumb_url: 'http://res.guggy.com/logo_128.png'
message_link: 'https://google.com'
collapsed: false
author_name: Bradley Hilton
author_link: 'https://rocket.chat/'
author_icon: 'https://avatars.githubusercontent.com/u/850391?v=3'
title: Attachment Example
title_link: 'https://youtube.com'
title_link_download: true
image_url: 'http://res.guggy.com/logo_128.png'
audio_url: 'http://www.w3schools.com/tags/horse.mp3'
video_url: 'http://www.w3schools.com/tags/movie.mp4'
fields:
- short: true
title: Test
value: Testing out something or other
- short: true
title: Another Test
value: '[Link](https://google.com/) something and this and that.'
Message with Blocks:
value:
message:
rid: GENERAL
blocks:
- type: section
text:
type: mrkdwn
text: '*Text example* Normal message `code` here'
- type: divider
- type: section
fields:
- type: mrkdwn
text: '*Field 1*'
- type: mrkdwn
text: Field 2
Message with PreviewURLs:
value:
message:
rid: 64f0f82c2c26843a68c1f7ba
msg: 'This is a list of links! https://google.com https://hola.org/ https://www.usepayday.com/ https://www.getbumpa.com/ https://www.atlassian.com/software/jira http://localhost:3000/'
previewUrls:
- 'https://google.com'
- 'http://localhost:3000/'
- 'https://hola.org/'
- 'https://www.usepayday.com/'
- 'https://www.getbumpa.com/'
- 'https://www.atlassian.com/software/jira'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
unread:
type: boolean
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
_updatedAt:
type: string
_id:
type: string
success:
type: boolean
examples:
Example 1:
value:
message:
rid: GENERAL
msg: '123456789'
ts: '2018-03-01T18:02:26.825Z'
u:
_id: i5FdM4ssFgAcQP62k
username: rocket.cat
name: test
unread: true
mentions: []
channels: []
_updatedAt: '2018-03-01T18:02:26.828Z'
_id: LnCSJxxNkCy6K9X8X
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The "message" parameter must be provided. [error-invalid-params]'
errorType: error-invalid-params
Example 2:
value:
success: false
error: The 'rid' property on the message object is missing.
Example 3:
value:
success: false
error: error-invalid-room
/api/v1/chat.starMessage:
post:
tags:
- Chat
summary: Star Message
description: |-
Star a message.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.59.0 | Added |
operationId: post-api-v1-chat.starMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID to star.
required:
- messageId
examples:
Example:
value:
messageId: 7aDSXtjMA3KPLxLjt
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "messageId" param is required. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
Example 2:
value:
success: false
error: 'The provided "messageId" does not match any existing message. [error-message-not-found]'
errorType: error-message-not-found
/api/v1/chat.unStarMessage:
post:
tags:
- Chat
summary: Unstar Message
description: |-
Unstar a message.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.59.0 | Added |
operationId: post-api-v1-chat.unStarMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message ID to unstar.
required:
- messageId
examples:
Example:
value:
messageId: 7aDSXtjMA3KPLxLjt
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "messageId" param is required. [error-messageid-param-not-provided]'
errorType: error-messageid-param-not-provided
Example 2:
value:
success: false
error: 'The provided "messageId" does not match any existing message. [error-message-not-found]'
errorType: error-message-not-found
/api/v1/chat.syncThreadsList:
get:
tags:
- Chat
summary: Sync Thread List
description: |-
List the threads of a room along with any data updates from a specified date.
### Changelog
| Version | Description |
| ------------ | ------------|
| 1.0.0 | Added |
operationId: get-api-v1-chat.syncThreadsList
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/fields'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/sort'
- name: rid
in: query
description: The room Id.
required: true
schema:
type: string
- name: updatedSince
in: query
description: Date as an ISO string. When you provide the `updatedSince` query parameter, then the `update` and `remove` parameters in the response will contain only those updated and removed since this date and time.
schema:
type: string
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
threads:
type: object
properties:
update:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
replies:
type: array
items:
type: string
tcount:
type: integer
tlm:
type: string
remove:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
replies:
type: array
items:
type: string
tcount:
type: integer
tlm:
type: string
_deletedAt:
type: string
__collection__:
type: string
success:
type: boolean
examples:
Example:
value:
threads:
update:
- _id: J8Sqi5zPw62WgE4Md
rid: GENERAL
msg: test1
ts: '2019-04-16T18:16:00.614Z'
u:
_id: rocketchat.internal.admin.test
username: rocketchat.internal.admin.test
name: RocketChat Internal Admin Test
_updatedAt: '2019-04-16T18:17:09.749Z'
mentions: []
channels: []
replies:
- rocketchat.internal.admin.test
tcount: 1
tlm: '2019-04-16T18:17:09.672Z'
- _id: hbs2ZAjHH2JXrP7C7
rid: GENERAL
msg: another test
ts: '2019-04-16T18:13:20.403Z'
u:
_id: rocketchat.internal.admin.test
username: rocketchat.internal.admin.test
name: RocketChat Internal Admin Test
_updatedAt: '2019-04-16T18:30:46.722Z'
mentions: []
channels: []
replies:
- rocketchat.internal.admin.test
tcount: 1
tlm: '2019-04-16T18:30:46.615Z'
remove:
- _id: GXwCSs4cx6456WBJk
rid: GENERAL
msg: test
ts: '2019-04-16T18:13:39.217Z'
u:
_id: rocketchat.internal.admin.test
username: rocketchat.internal.admin.test
name: RocketChat Internal Admin Test
_updatedAt: '2019-04-16T18:16:00.696Z'
mentions: []
channels: []
replies:
- rocketchat.internal.admin.test
tcount: 1
tlm: '2019-04-16T18:16:00.614Z'
_deletedAt: '2019-04-16T18:16:13.508Z'
__collection__: message
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing rid:
value:
success: false
error: 'The required "rid" query param is missing. [error-room-id-param-not-provided]'
errorType: error-room-id-param-not-provided
Missing updatedSince:
value:
success: false
error: 'The required param "updatedSince" is missing. [error-updatedSince-param-invalid]'
errorType: error-updatedSince-param-invalid
Invalid Date:
value:
success: false
error: 'The "updatedSince" query parameter must be a valid date. [error-updatedSince-param-invalid]'
errorType: error-updatedSince-param-invalid
/api/v1/chat.syncThreadMessages:
get:
tags:
- Chat
summary: Sync Thread Messages
description: |-
List the messages in a thread along with any data updates from a specified date.
### Changelog
| Version | Description |
| ------------ | ------------|
| 1.0.0 | Added |
operationId: get-api-v1-chat.syncThreadMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
- name: updatedSince
in: query
description: Date as an ISO string. When you provide the `updatedSince` query parameter, the `update` and `remove` parameters in the response will contain only those updated and removed since this date and time.
required: true
schema:
type: string
- name: tmid
in: query
description: Thread's message ID.
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: object
properties:
update:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
tmid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
remove:
type: array
items:
type: object
success:
type: boolean
examples:
Example:
value:
messages:
update:
- _id: 8BciMkvotHLpmpDEG
rid: GENERAL
tmid: hbs2ZAjHH2JXrP7C7
msg: test
ts: '2019-04-16T18:30:46.615Z'
u:
_id: rocketchat.internal.admin.test
username: rocketchat.internal.admin.test
name: RocketChat Internal Admin Test
_updatedAt: '2019-04-16T18:30:46.669Z'
mentions: []
channels: []
remove: []
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "tmid" query param is missing. [error-invalid-params]'
errorType: error-invalid-params
Example 2:
value:
success: false
error: 'The required param "updatedSince" is missing. [error-updatedSince-param-invalid]'
errorType: error-updatedSince-param-invalid
/api/v1/chat.syncMessages:
get:
tags:
- Chat
summary: Sync Messages
description: |-
List the messages in a room along with any data updates from a specified date.
### Changelog
| Version | Description |
| ------------ | ------------|
| 1.0.0 | Added |
operationId: get-api-v1-chat.syncMessages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: lastUpdate
in: query
description: 'The date as an ISO string. You cannot use this parameter if you are using the `next` or `previous` parameter.'
schema:
type: string
example: 2019-04-16T18:30:46.669Z
- schema:
type: number
example: 14182940000
in: query
name: next
description: 'This indicates whether the query should retrieve items from a **later** point in time. The value must be the number of milliseconds, as it follows [Date getTime()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime). Note that you can use either `next` or `previous` at the same time.'
- schema:
type: number
example: 14182940000
in: query
name: previous
description: 'This indicates whether the query should retrieve items from an **earlier** point in time. The value must be the number of milliseconds, as it follows [Date getTime()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime).'
- schema:
type: string
in: query
name: type
description: 'You must specify whether you want to retrieve `DELETED` (for deleted messages) or `UPDATED` (for updated messages, which is the default use case). This parameter is **required** if you are using the `next` or `previous` parameter.'
# > **NOTE:** `offset`, `sort`, and `count` are optional parameters. By default, the endpoint returns 20 items if you don't specify a value for `count`. According to the remaining query parameters you use, this endpoint returns the messages in two ways: * With the `lastUpdate` parameter: If you use the `lastUpdate` parameter, the endpoint returns the messages updated since the specified date. * With the cursor based pagination: For this approach, you must enter either the `next` or the `previous` parameter, and `type` is a mandatory field. In this case, the `lastUpdate` parameter cannot be used.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
result:
type: object
properties:
updated:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
msg:
type: string
ts:
type: string
_updatedAt:
type: string
alias:
type: string
token:
type: string
unread:
type: boolean
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
t:
type: string
groupable:
type: boolean
deleted:
type: array
items:
type: object
success:
type: boolean
examples:
Example:
value:
result:
updated:
- _id: ak3WdaLbf4P7ZW3wQ
rid: 5qW6ssMFyzWjJev69
u:
_id: FWfHnJmcudrCagGDX
username: '555192857993'
name: '555192857993'
msg: teste
ts: '2021-09-24T19:19:47.911Z'
_updatedAt: '2021-09-24T19:19:48.048Z'
alias: mauricio pretto
token: do554ryecscmfrrxyxpvm
unread: true
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: teste
- _id: 2ttrNPABcCKbsbEtB
t: livechat-started
msg: ''
groupable: false
ts: '2021-09-24T19:19:46.523Z'
u:
_id: FWfHnJmcudrCagGDX
username: '555192857993'
name: '555192857993'
rid: 5qW6ssMFyzWjJev69
unread: true
_updatedAt: '2021-09-24T19:19:46.691Z'
urls: []
mentions: []
channels: []
deleted: []
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'The required "roomId" query param is missing. [error-roomId-param-not-provided]'
errorType: error-roomId-param-not-provided
Example 2:
value:
success: false
error: 'The required "lastUpdate" query param is missing. [error-lastUpdate-param-not-provided]'
errorType: error-lastUpdate-param-not-provided
Example 3:
value:
success: false
error: 'The "lastUpdate" query parameter must be a valid date. [error-roomId-param-invalid]'
errorType: error-roomId-param-invalid
/api/v1/chat.getURLPreview:
get:
summary: Get URL Preview
tags:
- Chat
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
urlPreview:
type: object
properties:
url:
type: string
meta:
type: object
properties: {}
headers:
type: object
properties:
contentLength:
type: string
contentType:
type: string
ignoreParse:
type: boolean
success:
type: boolean
examples:
Example 1:
value:
urlPreview:
url: 'http://www.w3schools.com/tags/movie.mp4'
meta: {}
headers:
contentLength: '318465'
contentType: video/mp4
ignoreParse: true
success: true
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'must have required property ''url'' [invalid-params]'
errorType: invalid-params
Example 2:
value:
success: false
error: 'must have required property ''roomId'' [invalid-params]'
errorType: invalid-params
'401':
$ref: '#/components/responses/authorizationError'
operationId: get-api-v1-chat.getURLPreview
description: Use this endpoint to get a URL preview that can be used in the send and update message endpoints.
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- schema:
type: string
example: Xnb2kLD2Pnhdwe3RH
in: query
name: roomId
description: Enter the room ID where you want to send or update the message.
required: true
- schema:
type: string
example: 'http://www.w3schools.com/tags/movie.mp4'
in: query
name: url
description: Enter the URL that you want to preview.
required: true
/api/v1/dm.close:
post:
tags:
- DM
summary: Close DM
description: |-
Removes the direct message from the user's list of direct messages.
### Changelog
| Version | Description |
| ------------ | ------------|
| 0.48.0 | Added |
operationId: post-api-v1-im.close
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room ID.
required:
- roomId
examples:
Example:
value:
roomId: ByehQjC44FwMeiLbX
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
RoomId is required:
value:
success: false
error: 'Body param "roomId" is required [error-room-param-not-provided]'
errorType: error-room-param-not-provided
Invalid room ID or user is not member of room:
value:
success: false
error: The user is not subscribed to the room
/api/v1/dm.counters:
get:
tags:
- DM
summary: Get DM Counters
description: |-
Gets counters and information of direct messages. Permission required: `view-room-administration`.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.65.0 | Added |
operationId: get-api-v1-im.counters
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- name: roomId
in: query
description: The DM room ID
required: true
schema:
type: string
- name: userId
in: query
description: The user ID to provide counters for.
schema:
type: string
responses:
'200':
description: |-
OK
**Note**
- `joined`: Boolean flag that shows that user has joined the room or not.
- `members`: Count of current room members.
- `unreads`: Count of unread messages for specified user (calling user or provided user ID).
- `unreadsFrom`: Start date-time of unread interval for specified user.
- `msgs`: Count of messages in the room.
- `latest`: End date-time of unread interval for specified user (or date-time of last posted message).
- `userMentions` - Count of user mentions in messages.
content:
application/json:
schema:
type: object
properties:
joined:
type: boolean
members:
type: integer
unreads:
type: integer
unreadsFrom:
type: string
msgs:
type: integer
latest:
type: string
userMentions:
type: integer
success:
type: boolean
examples:
Example 1:
value:
joined: true
members: 2
unreads: 4
unreadsFrom: '2023-10-30T20:30:47.975Z'
msgs: 10
latest: '2023-10-30T20:37:17.160Z'
userMentions: 0
success: true
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'Query param "roomId" is required [error-room-param-not-provided]'
errorType: error-room-param-not-provided
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/dm.create:
post:
tags:
- DM
summary: Create DM
description: |-
Create a direct message session with another user or more than one user.
#### Change Log
| Version | Description |
| ------- | ------------------------ |
| 0.59.0 | Added |
| 3.1.0 | Added usernames fields |
| 3.18.0 | Added excludeSelf option |
operationId: post-api-v1-im.create
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
properties:
username:
type: string
description: 'The username of the user to open a direct message session.'
excludeSelf:
type: boolean
description: Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the `view-room-administration` permission
- type: object
properties:
usernames:
type: string
description: 'Comma-seperated list of usernames to open a multiple direct message session. '
excludeSelf:
type: boolean
description: Creates the direct message session excluding the current authenticated user. The session will only be opened if the current user has the `view-room-administration` permission
examples:
Example:
value:
username: kim.dok
excludeSelf: true
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
room:
type: object
properties:
t:
type: string
rid:
type: string
usernames:
type: array
items:
type: string
success:
type: boolean
examples:
Example:
value:
room:
t: d
rid: PMrDaS4axRqkjY7errocket.cat
usernames:
- g1
- rocket.cat
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing parameter:
value:
success: false
error: |-
must have required property 'usernames'
must have required property 'username'
must match exactly one schema in oneOf [invalid-params]
errorType: invalid-params
Invalid User:
value:
success: false
error: 'Invalid user [error-invalid-user]'
errorType: error-invalid-user
details:
method: createDirectMessage
/api/v1/dm.delete:
post:
tags:
- DM
summary: Delete DM
description: |-
Delete a DM. Permission required: `view-room-administration`.
### Changelog
| Version | Description |
| ------------ | ------------|
|3.18.0 | Added |
operationId: post-api-v1-im.delete
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
oneOf:
- type: object
required: ["roomId"]
properties:
roomId:
type: string
description: The room ID of the DM. This parameter is required if you don't enter the `username` parameter.
- type: object
required: ["username"]
properties:
username:
type: string
description: The username of the user in the DM.
examples:
Example:
value:
roomId: hdy9972092873h8s7s0
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: |-
must have required property 'roomId'
must have required property 'username'
must match exactly one schema in oneOf [invalid-params]
errorType: invalid-params
Invalid room ID or username:
value:
success: false
error: '[invalid-channel]'
errorType: invalid-channel
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/dm.files:
get:
tags:
- DM
summary: Get DM Files
description: |-
Get all files in a DM.
### Changelog
| Version | Description |
| ---------------- | ------------|
|0.64.0 | Change `userId` to `user` object in response|
|0.59.0 | Added |
operationId: get-api-v1-im.files
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
- $ref: '#/components/parameters/filterTypeGroup'
- $ref: '#/components/parameters/filterName'
- name: roomId
in: query
description: The roomId of the DM. It is required if `username` is not provided.
schema:
type: string
- $ref: '#/components/parameters/Optional-Username'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
files:
type: array
items:
type: object
properties:
_id:
type: string
name:
type: string
size:
type: integer
type:
type: string
rid:
type: string
userId:
type: string
store:
type: string
_updatedAt:
type: string
complete:
type: boolean
etag:
type: string
path:
type: string
progress:
type: integer
token:
type: string
uploadedAt:
type: string
uploading:
type: boolean
url:
type: string
typeGroup:
type: string
user:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
files:
- _id: 6542e355a2f73c7460e18ef6
name: 2023-11-01_21-13-38.snagx
size: 652277
type: application/octet-stream
rid: 5fRTXMt7DMJbpPJfhgzvcvpov9G4TxbGFS
userId: 5fRTXMt7DMJbpPJfh
store: 'GridFS:Uploads'
_updatedAt: '2023-11-01T23:46:29.216Z'
complete: true
etag: 7qDc9jBurptfmrAxr
path: '/ufs/GridFS:Uploads/6542e355a2f73c7460e18ef6/2023-11-01_21-13-38.snagx'
progress: 1
token: eAD959d9A8
uploadedAt: '2023-11-01T23:46:29.196Z'
uploading: false
url: 'http://localhost:3000//ufs/GridFS:Uploads/6542e355a2f73c7460e18ef6/2023-11-01_21-13-38.snagx'
typeGroup: application
user:
_id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
count: 1
offset: 0
total: 1
success: true
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/dm.history:
get:
tags:
- DM
summary: DM History
description: |-
Retrieves the message history from a direct message.
### Change Log
| Version | Description |
| ------- | ----------------------- |
| 0.75.0 | Added `offset` property |
| 0.48.0 | Added |
operationId: get-api-v1-im.history
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: latest
in: query
description: The end of time range of messages to retrieve.
schema:
type: string
example: '2016-09-30T13:42:25.304Z'
- name: oldest
in: query
description: The start of the time range of messages to retrieve.
schema:
type: string
example: '2016-05-30T13:42:25.304Z'
- name: inclusive
in: query
description: Whether messages which land on the `latest` and `oldest` dates should be included.
schema:
type: string
- name: showThreadMessages
in: query
description: Choose to display thread message in the message history.
schema:
type: boolean
example: 'true'
- name: unreads
in: query
description: Whether the number of unread messages should be included.
schema:
type: boolean
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
_updatedAt:
type: string
t:
type: string
groupable:
type: boolean
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: AkzpHAvZpdnuchw2a
rid: ByehQjC44FwMeiLbX
msg: hi
ts: '2016-12-09T12:50:51.555Z'
u:
_id: y65tAmHs93aDChMWu
username: testing
_updatedAt: '2016-12-09T12:50:51.562Z'
- _id: vkLMxcctR4MuTxreF
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-08T15:41:37.730Z'
msg: testing2
u:
_id: bRtgdhzM6PD9F8pSx
username: testing2
groupable: false
_updatedAt: '2016-12-08T16:03:25.235Z'
- _id: bfRW658nEyEBg75rc
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-07T15:47:49.099Z'
msg: testing
u:
_id: nSYqWzZ4GsKTX4dyK
username: testing1
groupable: false
_updatedAt: '2016-12-07T15:47:49.099Z'
- _id: pbuFiGadhRZTKouhB
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-06T17:57:38.635Z'
msg: testing
u:
_id: y65tAmHs93aDChMWu
username: testing
groupable: false
_updatedAt: '2016-12-06T17:57:38.635Z'
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: 'must have required property ''roomId'' [invalid-params]'
errorType: invalid-params
Example 2:
value:
success: false
error: '[invalid-channel]'
errorType: invalid-channel
/api/v1/dm.list.everyone:
get:
tags:
- DM
summary: List All DMs
description: |-
List all DMs in the workspace.
Permission required:`view-room-administration`.
### Changelog
| Version | Description |
| ------------ | ------------|
|0.49.0 | Added |
operationId: get-api-v1-im.list.everyone
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ims:
type: array
items:
type: object
properties:
_id:
type: string
t:
type: string
usernames:
type: array
items:
type: string
usersCount:
type: integer
msgs:
type: integer
ts:
type: string
uids:
type: array
items:
type: string
default:
type: boolean
ro:
type: boolean
sysMes:
type: boolean
_updatedAt:
type: string
_USERNAMES:
type: array
items:
type: string
lastMessage:
type: object
properties:
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_id:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
properties:
url:
type: string
meta:
type: object
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
src:
type: object
properties:
type:
type: string
value:
type: string
label:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
lm:
type: string
offset:
type: integer
count:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
ims:
- _id: rYhzFRd2QZjNwAAXXrocket.cat
t: d
usernames:
- rocket.cat
- rodriq
usersCount: 2
msgs: 20
ts: '2023-01-25T02:00:18.095Z'
uids:
- rYhzFRd2QZjNwAAXX
- rocket.cat
default: false
ro: false
sysMes: true
_updatedAt: '2023-06-22T02:00:10.474Z'
_USERNAMES:
- rocket.cat
- rodriq
lastMessage:
rid: rYhzFRd2QZjNwAAXXrocket.cat
msg: |-
*Update your Rocket.Chat*
New version available (6.2.8)
https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8
ts: '2023-06-22T02:00:10.367Z'
u:
_id: rocket.cat
username: rocket.cat
name: Rocket.Cat
_id: T2KoWNeAgJM4zvTvt
_updatedAt: '2023-06-22T02:00:10.453Z'
urls:
- url: 'https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8'
meta: {}
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: BOLD
value:
- type: PLAIN_TEXT
value: Update your Rocket.Chat
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: New version available (6.2.8)
- type: PARAGRAPH
value:
- type: LINK
value:
src:
type: PLAIN_TEXT
value: 'https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8'
label:
- type: PLAIN_TEXT
value: 'https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8'
lm: '2023-06-22T02:00:10.367Z'
- _id: 6xia7f5JEYM4Fjxzt
t: d
usernames:
- rodriq
usersCount: 2
msgs: 0
ts: '2023-01-30T11:43:22.047Z'
uids:
- rYhzFRd2QZjNwAAXX
default: false
ro: false
sysMes: true
_updatedAt: '2023-01-31T14:40:37.483Z'
_USERNAMES:
- rodriq
lm: '2023-01-30T11:43:30.046Z'
offset: 0
count: 2
total: 2
success: true
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/dm.list:
get:
tags:
- DM
summary: List DMs
description: |-
List all the DMs of the authenticated user.
### Change Log
| Version | Description |
| ------- | -------------------------------------------- |
| 0.67.0 | Remove `query` parameter support. |
| 0.62.0 | Add `query` parameter support. |
| 0.49.0 | Count and offset query parameters supported. |
| 0.48.0 | Added |
operationId: get-api-v1-im.list
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
ims:
type: array
items:
type: object
properties:
_id:
type: string
t:
type: string
usernames:
type: array
items:
type: string
usersCount:
type: integer
msgs:
type: integer
ts:
type: string
uids:
type: array
items:
type: string
encrypted:
type: boolean
default:
type: boolean
ro:
type: boolean
sysMes:
type: boolean
_updatedAt:
type: string
_USERNAMES:
type: array
items:
type: string
e2eKeyId:
type: string
lastMessage:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
type:
type: string
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
lm:
type: string
topic:
type: string
offset:
type: integer
count:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
ims:
- _id: 5fRTXMt7DMJbpPJfhrbAXPnMktTFbNpwtJ
t: d
usernames:
- roxie
- test.john
usersCount: 2
msgs: 10
ts: '2023-07-11T01:37:04.552Z'
uids:
- 5fRTXMt7DMJbpPJfh
- rbAXPnMktTFbNpwtJ
encrypted: true
default: false
ro: false
sysMes: true
_updatedAt: '2023-10-30T20:37:17.317Z'
_USERNAMES:
- test.test
- test.test
e2eKeyId: eyJhbGciOiJB
lastMessage:
_id: qpx24HcNoTZCoj7jZ
rid: 5fRTXMt7DMJbpPJfhrbAXPnMktTFbNpwtJ
msg: gvjkbvjjgi
ts: '2023-10-30T20:37:17.160Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-30T20:37:17.267Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: gvjkbvjjgi
lm: '2023-10-30T20:37:17.160Z'
topic: Discuss all of the testing
- _id: 65400fc3a2f73c7460e18e9f
t: d
usernames:
- roxie
- hookdeck.write
- test.john
usersCount: 3
msgs: 8
ts: '2023-10-30T20:19:15.092Z'
uids:
- 5fRTXMt7DMJbpPJfh
- hFDuCPam7sWziWFYa
- rbAXPnMktTFbNpwtJ
encrypted: true
default: false
ro: false
sysMes: true
_updatedAt: '2023-10-30T20:36:41.696Z'
_USERNAMES:
- roxie
- hookdeck.write
- test.john
topic: Discuss all of the testing
lastMessage:
_id: dgDTvDAXN4eCLptr8
rid: 65400fc3a2f73c7460e18e9f
msg: '@test.john'
ts: '2023-10-30T20:36:41.494Z'
u:
_id: rbAXPnMktTFbNpwtJ
username: roxie
name: test test
_updatedAt: '2023-10-30T20:36:41.613Z'
urls: []
mentions:
- _id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
type: user
channels: []
md:
- type: PARAGRAPH
value:
- type: MENTION_USER
value:
type: PLAIN_TEXT
value: test.john
lm: '2023-10-30T20:36:41.494Z'
offset: 0
count: 2
total: 2
success: true
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/dm.members:
get:
tags:
- DM
summary: List DM Members
description: |-
List all the members of a DM.
### Changelog
| Version | Description |
| ---------------- | ------------|
|0.59.0 | Added |
operationId: get-api-v1-im.members
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- name: roomId
in: query
description: The room ID of the DM. It is required if `username` is not provided.
schema:
type: string
- $ref: '#/components/parameters/Optional-Username'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
members:
type: array
items:
type: object
properties:
_id:
type: string
username:
type: string
status:
type: string
name:
type: string
utcOffset:
type: integer
statusText:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example 1:
value:
members:
- _id: 5fRTXMt7DMJbpPJfh
username: test.john
status: online
name: Test John
utcOffset: 1
statusText: ''
- _id: rbAXPnMktTFbNpwtJ
username: roxie
status: offline
name: test test
utcOffset: 1
statusText: On a vacation
- _id: hFDuCPam7sWziWFYa
status: offline
name: Hookdeck Write
utcOffset: 1
username: hookdeck.write
count: 3
offset: 0
total: 3
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example 1:
value:
success: false
error: |-
must have required property 'roomId'
must have required property 'username'
must match exactly one schema in oneOf [invalid-params]
errorType: invalid-params
Example 2:
value:
success: false
error: '[invalid-channel]'
errorType: invalid-channel
/api/v1/dm.messages:
get:
tags:
- DM
summary: List DM Messages
description: |-
List all the messages in a DM.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 7.0.0 | Added `mentionIds`, `starredIds`, `pinned` query parameters.|
|0.59.0 | Added |
operationId: get-api-v1-im.messages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/fields'
- $ref: '#/components/parameters/query'
- name: roomId
in: query
description: The room ID of the DM. It is required if `username` is not provided.
schema:
type: string
- $ref: '#/components/parameters/Optional-Username'
- name: mentionIds
in: query
description: Filter the messages where a user has been mentioned by the userId. For a set of userIds, use an array (`["838ndhd79w", "dud0wu900"]`).
schema:
type: string
example: '838ndhd79w'
- name: starredIds
in: query
description: Filter the messages a user have starred by userId. For a set of userIds, use an array (`["838ndhd79w", "dud0wu900"]`).
schema:
type: string
example: 'dud0wu900'
- name: pinned
in: query
description: Filter pinned messages.
schema:
type: boolean
example: 'true'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
urls:
type: array
items:
type: object
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
md:
type: array
items:
type: object
properties:
type:
type: string
value:
type: array
items:
type: object
properties:
type:
type: string
value:
type: string
count:
type: integer
offset:
type: integer
total:
type: integer
success:
type: boolean
examples:
Example:
value:
messages:
- _id: dGNzxH29pFm4Qhufh
rid: 5fRTXMt7DMJbpPJfhgzvcvpov9G4TxbGFS
msg: DO we have any updates today?
ts: '2023-11-01T23:20:57.357Z'
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
_updatedAt: '2023-11-01T23:20:57.406Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: DO we have any updates today?
- _id: aiaCSRkxPcNGHqvtC
rid: 5fRTXMt7DMJbpPJfhgzvcvpov9G4TxbGFS
msg: Hows it going?
ts: '2023-11-01T23:20:51.504Z'
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
_updatedAt: '2023-11-01T23:20:51.549Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: Hows it going?
- _id: dLjcNr8ovyeCqqJW5
rid: 5fRTXMt7DMJbpPJfhgzvcvpov9G4TxbGFS
msg: Hi buddy
ts: '2023-11-01T23:20:47.991Z'
u:
_id: 5fRTXMt7DMJbpPJfh
username: test.john
name: Test John
_updatedAt: '2023-11-01T23:20:48.085Z'
urls: []
mentions: []
channels: []
md:
- type: PARAGRAPH
value:
- type: PLAIN_TEXT
value: Hi buddy
count: 3
offset: 0
total: 3
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing Parameter:
value:
success: false
error: |-
must have required property 'roomId'
must have required property 'username'
must match exactly one schema in oneOf [invalid-params]
errorType: invalid-params
Invalid Channel:
value:
success: false
error: '[invalid-channel]'
errorType: invalid-channel
/api/v1/dm.messages.others:
get:
tags:
- DM
summary: Message Others
description: |-
Retrieves the messages from any direct message in the server. For this method to work, navigate to **Administration > Workspace > Settings > General > REST API > Enable Direct Message History Endpoint** and enable it.
Permission required: `view-room-administration`.
### Change Log
| Version | Description |
| ------- | ----------------------- |
| 0.50.0 | Added |
operationId: get-api-v1-im.messages.others
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- $ref: '#/components/parameters/RoomId'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- $ref: '#/components/parameters/query'
- $ref: '#/components/parameters/fields'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
_updatedAt:
type: string
t:
type: string
groupable:
type: boolean
success:
type: boolean
examples:
Example 1:
value:
messages:
- _id: AkzpHAvZpdnuchw2a
rid: ByehQjC44FwMeiLbX
msg: hi
ts: '2016-12-09T12:50:51.555Z'
u:
_id: y65tAmHs93aDChMWu
username: testing
_updatedAt: '2016-12-09T12:50:51.562Z'
- _id: vkLMxcctR4MuTxreF
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-08T15:41:37.730Z'
msg: testing2
u:
_id: bRtgdhzM6PD9F8pSx
username: testing2
groupable: false
_updatedAt: '2016-12-08T16:03:25.235Z'
- _id: bfRW658nEyEBg75rc
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-07T15:47:49.099Z'
msg: testing
u:
_id: nSYqWzZ4GsKTX4dyK
username: testing1
groupable: false
_updatedAt: '2016-12-07T15:47:49.099Z'
- _id: pbuFiGadhRZTKouhB
t: uj
rid: ByehQjC44FwMeiLbX
ts: '2016-12-06T17:57:38.635Z'
msg: testing
u:
_id: y65tAmHs93aDChMWu
username: testing
groupable: false
_updatedAt: '2016-12-06T17:57:38.635Z'
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
details:
type: object
properties:
route:
type: string
examples:
Example 1:
value:
success: false
error: 'This endpoint is disabled [error-endpoint-disabled]'
errorType: error-endpoint-disabled
details:
route: /api/v1/dm.messages.others
Example 2:
value:
success: false
error: 'The parameter "roomId" is required [error-roomid-param-not-provided]'
errorType: error-roomid-param-not-provided
Example 3:
value:
success: false
error: 'No direct message room found by the id of: john [error-room-not-found]'
errorType: error-room-not-found
/api/v1/dm.open:
post:
tags:
- DM
summary: Open DM
description: |-
Adds a DM back to the user's list of direct messages.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.48.0 | Added |
operationId: post-api-v1-im.open
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room ID.
required:
- roomId
examples:
Example:
value:
roomId: 5fRTXMt7DMJbpPJfhrbAXPnMktTFbNpwtJ
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Missing Parameter:
value:
success: false
error: 'Body param "roomId" is required [error-room-param-not-provided]'
errorType: error-room-param-not-provided
/api/v1/dm.setTopic:
post:
tags:
- DM
summary: Set DM Topic
description: |-
Set the topic of a DM.
### Changelog
| Version | Description |
| ---------------- | ------------|
| 0.48.0 | Added |
operationId: post-api-v1-im.setTopic
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room ID of the direct message.
topic:
type: string
description: The topic of the DM.
required:
- roomId
- topic
examples:
Example:
value:
roomId: ByehQjC44FwMeiLbX
topic: Discuss all of the testing
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
topic:
type: string
success:
type: boolean
examples:
Example:
value:
topic: Discuss all of the testing
success: true
'401':
$ref: '#/components/responses/authorizationError'
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Example:
value:
success: false
error: 'Body param "roomId" is required [error-room-param-not-provided]'
errorType: error-room-param-not-provided
/api/v1/autotranslate.getSupportedLanguages:
get:
tags:
- Auto-Translate
summary: Get Supported Languages
description: |-
Get the list of languages supported by the translation service provider.
Make sure that the auto-translate feature is configured in your workspace. For details, see the Auto-Translate user guide.
### Changelog
| Version | Description |
| ---------------- | ------------|
|1.3.0 | Added |
operationId: get-api-v1-autotranslate.getSupportedLanguages
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
- name: targetLanguage
in: query
description: Language in which the language names will be returned.
required: true
schema:
type: string
example: en
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
languages:
type: array
items:
type: object
properties:
name:
type: string
supports_formality:
type: boolean
language:
type: string
success:
type: boolean
examples:
Success Example:
value:
languages:
- name: Arabic
supports_formality: false
language: ar
- name: Bulgarian
supports_formality: false
language: bg
- name: Czech
supports_formality: false
language: cs
- name: German
supports_formality: true
language: de
- name: Spanish (Latin American)
supports_formality: true
language: es-419
- name: Estonian
supports_formality: false
language: et
- name: Indonesian
supports_formality: false
language: id
- name: Korean
supports_formality: false
language: ko
- name: Lithuanian
supports_formality: false
language: lt
- name: Portuguese (Brazilian)
supports_formality: true
language: pt-BR
- name: Thai
supports_formality: false
language: th
- name: Vietnamese
supports_formality: false
language: vi
- name: Chinese (simplified)
supports_formality: false
language: zh
success: true
'400':
description: Bad Request
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
error:
type: string
errorType:
type: string
examples:
Target Language Required:
value:
success: false
error: 'must have required property ''targetLanguage'' [invalid-params]'
errorType: invalid-params
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/autotranslate.saveSettings:
post:
tags:
- Auto-Translate
summary: Save Auto-Translate Settings
description: |-
Saves autotranslate settings for a room.
### Changelog
| Version | Description |
| ---------------- | ------------|
|1.3.0 | Added |
operationId: post-api-v1-autotranslate.saveSettings
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
roomId:
type: string
description: The room's id to apply setting.
field:
type: string
description: The setting to apply to user's subscription.
value:
type: boolean
description: Boolean if the setting is autoTranslate and a string (the language) if the setting is autoTranslateLanguage.
defaultLanguage:
type: string
description: The default language.
required:
- roomId
- field
- value
examples:
Example:
value:
roomId: 7aDSXtjMA3KPLxLjt
field: autoTranslate
value: true
defaultLanguage: en
responses:
'200':
$ref: '#/components/responses/trueSuccess'
'401':
$ref: '#/components/responses/authorizationError'
/api/v1/autotranslate.translateMessage:
post:
tags:
- Auto-Translate
summary: Translate Message
description: |-
Auto-translates the provided message.
### Changelog
| Version | Description |
| ---------------- | ------------|
|1.3.0 | Added |
operationId: post-api-v1-autotranslate.translateMessage
parameters:
- $ref: '#/components/parameters/Auth-Token'
- $ref: '#/components/parameters/UserId'
requestBody:
content:
application/json:
schema:
type: object
properties:
messageId:
type: string
description: The message's id to be translated.
targetLanguage:
type: string
description: The target language that the message will be translated.
required:
- messageId
examples:
Example:
value:
messageId: Fq7sQNSnDEfzj8qoS
targetLanguage: en
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
_id:
type: string
rid:
type: string
msg:
type: string
ts:
type: string
u:
type: object
properties:
_id:
type: string
username:
type: string
name:
type: string
_updatedAt:
type: string
mentions:
type: array
items:
type: object
channels:
type: array
items:
type: object
translations:
type: object
properties:
en:
type: string
success:
type: boolean
examples:
Success:
value:
message:
_id: Fq7sQNSnDEfzj8qoS
rid: GENERAL
msg: Isso é um teste
ts: '2019-06-27T15:35:20.753Z'
u:
_id: pC6Z2N2ijivxdsYSu
username: marcos
name: marcos
_updatedAt: '2019-06-27T15:47:01.486Z'
mentions: []
channels: []
translations:
en: This is a test
success: true
'401':
$ref: '#/components/responses/authorizationError'
tags:
- name: Chat
- name: DM
- name: Auto-Translate
components:
parameters:
Optional-RoomId:
name: roomId
in: query
description: The room ID. It is required if the `roomName` is not provided.
schema:
type: string
example: dlp
Optional-RoomName:
name: roomName
in: query
description: The room name. It is required if the `roomId` is not provided.
required: false
schema:
type: string
example: WDuJLFkjwk6L7LdFC
RoomId:
name: roomId
in: query
description: The room ID.
required: true
schema:
type: string
example: 6GFJ3tbmHiyHbahmC
Optional-Username:
name: username
in: query
description: The username of the user in the DM. It is required if `roomId` is not provided.
required: false
schema:
type: string
Auth-Token:
name: X-Auth-Token
in: header
description: The `authToken` of the authenticated user.
required: true
schema:
type: string
example: RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
UserId:
name: X-User-Id
in: header
description: The `userId` of the authenticated user.
required: true
schema:
type: string
example: rbAXPnMktTFbNpwtJ
offset:
name: offset
in: query
description: 'Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more.'
required: false
schema:
type: integer
example: 50
count:
name: count
in: query
description: 'The number of items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more.'
required: false
schema:
type: integer
example: 50
sort:
name: sort
in: query
description: '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](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more.'
required: false
schema: {}
query:
name: query
in: query
description: '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](https://developer.rocket.chat/apidocs/query-parameters#query-and-fields) to learn more.'
required: false
schema: {}
fields:
name: fields
in: query
description: '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](https://developer.rocket.chat/apidocs/query-parameters#query-and-fields) to learn more.'
required: false
schema:
type: string
filterName:
name: name
in: query
description: The name of the file to search for.
schema:
type: string
example: logo
filterTypeGroup:
name: typeGroup
in: query
description: |-
Filter results by the type of file. Available options:
- `all`: Return all file types.
- `image`: Filter by image files.
- `video`: Filter by video files.
- `audio`: Filter by audio files.
- `text`: Filter by text documents.
- `application`: Filter by other file types.
schema:
type: string
example: images
responses:
trueSuccess:
description: OK
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
examples:
Success:
value:
success: true
authorizationError:
description: Unauthorized
content:
application/json:
schema:
type: object
properties:
status:
type: string
message:
type: string
examples:
Authorization Error:
value:
status: error
message: You must be logged in to do this.