REST:Â Commands
Slash commands of bots: listing them in a channel and running them. Generated from mnema-talk v3.3.13 (cca4f0fdb723).
List the slash commands of a channel
GET /api/channels/{channelID}/commands
The server's built-in commands the caller may use in the channel (builtin: true, listed first), then the commands of bots that can view and send in the channel (through their roles and overwrites), not disabled by an admin, for the composer's autocomplete. Needs View channels.
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
channelID | path | string (uuid) | yes | Channel ID. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Commands by name. | ChannelCommand[] |
| 401 | No valid session (UNAUTHORIZED). | ErrorResponse |
| 404 | NOT_FOUND: no such channel, or it is hidden from the caller. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Use a component of an ephemeral note
POST /api/channels/{channelID}/ephemeral/{noteID}/components
Like using a component of a message, for a bot's ephemeral response (interaction_response with components). Only the member who sees the note, for the 15 minutes of the interaction that made it; afterwards, or after a restart of the server, 404. The bot receives message {id, flags: 64, content, components}.
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
channelID | path | string (uuid) | yes | Channel ID. |
noteID | path | string (uuid) | yes | Note ID (id of interaction_response). |
Request body (application/json, required): ComponentUse
| Field | Type | Description |
|---|---|---|
custom_id (required) | string | |
values | string[] | Values are what a select menu got: option values of a string select, member, role or channel IDs of the others. Left out for a button. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 202 | Delivered to the bot. | Invoked |
| 400 | Invalid input (INVALID_INPUT): values that do not fit the component. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED). | ErrorResponse |
| 403 | FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet. | ErrorResponse |
| 404 | NOT_FOUND: no such channel or note, it is not the caller's or has expired; the component is gone or disabled, or its bot can no longer take it. | ErrorResponse |
| 409 | CONFLICT: the bot is not connected. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Invoked
| Field | Type | Description |
|---|---|---|
interaction_id (required) | string (uuid) | InteractionID identifies the run; the bot answers it. |
Run a slash command
POST /api/channels/{channelID}/interactions
A built-in command (builtin in the list) runs on the server and answers 200 with its result. Otherwise sends an interaction to the command's bot over the gateway; the bot answers with a message in the channel, or one only the caller sees (an ephemeral response, delivered as the interaction_response WebSocket event). Needs Send messages in the channel; the bot must still be able to view and send there. 409 when the bot is not connected. At most 20 a minute per member.
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
channelID | path | string (uuid) | yes | Channel ID. |
Request body (application/json, required): InvokeRequest
| Field | Type | Description |
|---|---|---|
command_id (required) | string (uuid) | |
options (required) | object | Options maps option names to values: a string, a whole number, a boolean, or the ID of a member or channel. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | A built-in command ran; message_id is the message it posted, if any. | Result |
| 202 | Delivered to the bot. | Invoked |
| 400 | Invalid input (INVALID_INPUT): unknown or ill-typed options. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED). | ErrorResponse |
| 403 | FORBIDDEN: missing the Send messages permission or the command's default_member_permissions in the channel, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet. | ErrorResponse |
| 404 | NOT_FOUND: no such channel or command, or the command is not available here. | ErrorResponse |
| 409 | CONFLICT: the bot is not connected. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Result
| Field | Type | Description |
|---|---|---|
message_id | string (uuid) |
Use a component of a bot's message
POST /api/channels/{channelID}/messages/{messageID}/components
A click on a button or a choice in a select menu of a bot's message. Needs View channels; a timed-out member cannot. The message must still have that enabled component, select values must fit it (options of a string select, between min_values and max_values; members who can view the channel, roles that exist, channels the member and the bot can view). Creates a new interaction (type 3) and delivers it to the bot. At most 30 clicks and modal submits a minute per member.
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
channelID | path | string (uuid) | yes | Channel ID. |
messageID | path | string (uuid) | yes | Message ID. |
Request body (application/json, required): ComponentUse
| Field | Type | Description |
|---|---|---|
custom_id (required) | string | |
values | string[] | Values are what a select menu got: option values of a string select, member, role or channel IDs of the others. Left out for a button. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 202 | Delivered to the bot. | Invoked |
| 400 | Invalid input (INVALID_INPUT): values that do not fit the component. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED). | ErrorResponse |
| 403 | FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet. | ErrorResponse |
| 404 | NOT_FOUND: no such channel or message, or it is hidden from the caller; the component is gone or disabled, or its bot is disabled, deleted or cannot view the channel. | ErrorResponse |
| 409 | CONFLICT: the bot is not connected. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Invoked
| Field | Type | Description |
|---|---|---|
interaction_id (required) | string (uuid) | InteractionID identifies the run; the bot answers it. |
Submit a modal
POST /api/channels/{channelID}/modals/{modalID}
Sends the answers of a modal a bot opened (interaction_modal) to the bot as an interaction of type 5. Only the member it was opened for, once, within 15 minutes; after a restart of the server an open modal is gone (404). The answers are trimmed and must fit their inputs (required, min_length, max_length). Needs View channels; a timed-out member cannot. At most 30 clicks and modal submits a minute per member. When the bot is not connected (409) the modal can be submitted again.
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
channelID | path | string (uuid) | yes | Channel ID. |
modalID | path | string (uuid) | yes | Modal ID (id of interaction_modal). |
Request body (application/json, required): ModalSubmit
| Field | Type | Description |
|---|---|---|
values (required) | object | Values maps the custom_id of each text input to what the member typed; an input left out is not filled in. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 202 | Delivered to the bot. | Invoked |
| 400 | Invalid input (INVALID_INPUT): an unknown input, a required one left out, or an answer of the wrong length. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED). | ErrorResponse |
| 403 | FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet. | ErrorResponse |
| 404 | NOT_FOUND: no such channel or modal, it was opened for someone else, already submitted or expired; or its bot can no longer take it. | ErrorResponse |
| 409 | CONFLICT: the bot is not connected. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Invoked
| Field | Type | Description |
|---|---|---|
interaction_id (required) | string (uuid) | InteractionID identifies the run; the bot answers it. |