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

NameInTypeRequiredDescription
channelIDpathstring (uuid)yesChannel ID.

Responses

StatusMeaningBody
200Commands by name.ChannelCommand[]
401No valid session (UNAUTHORIZED).ErrorResponse
404NOT_FOUND: no such channel, or it is hidden from the caller.ErrorResponse
429RATE_LIMITED: too many requests.ErrorResponse
500INTERNAL_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

NameInTypeRequiredDescription
channelIDpathstring (uuid)yesChannel ID.
noteIDpathstring (uuid)yesNote ID (id of interaction_response).

Request body (application/json, required): ComponentUse

FieldTypeDescription
custom_id (required)string
valuesstring[]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

StatusMeaningBody
202Delivered to the bot.Invoked
400Invalid input (INVALID_INPUT): values that do not fit the component.ErrorResponse
401No valid session (UNAUTHORIZED).ErrorResponse
403FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet.ErrorResponse
404NOT_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
409CONFLICT: the bot is not connected.ErrorResponse
429RATE_LIMITED: too many requests.ErrorResponse
500INTERNAL_ERROR: sanitized server failure.ErrorResponse
Invoked
FieldTypeDescription
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

NameInTypeRequiredDescription
channelIDpathstring (uuid)yesChannel ID.

Request body (application/json, required): InvokeRequest

FieldTypeDescription
command_id (required)string (uuid)
options (required)objectOptions maps option names to values: a string, a whole number, a boolean, or the ID of a member or channel.

Responses

StatusMeaningBody
200A built-in command ran; message_id is the message it posted, if any.Result
202Delivered to the bot.Invoked
400Invalid input (INVALID_INPUT): unknown or ill-typed options.ErrorResponse
401No valid session (UNAUTHORIZED).ErrorResponse
403FORBIDDEN: 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
404NOT_FOUND: no such channel or command, or the command is not available here.ErrorResponse
409CONFLICT: the bot is not connected.ErrorResponse
429RATE_LIMITED: too many requests.ErrorResponse
500INTERNAL_ERROR: sanitized server failure.ErrorResponse
Result
FieldTypeDescription
message_idstring (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

NameInTypeRequiredDescription
channelIDpathstring (uuid)yesChannel ID.
messageIDpathstring (uuid)yesMessage ID.

Request body (application/json, required): ComponentUse

FieldTypeDescription
custom_id (required)string
valuesstring[]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

StatusMeaningBody
202Delivered to the bot.Invoked
400Invalid input (INVALID_INPUT): values that do not fit the component.ErrorResponse
401No valid session (UNAUTHORIZED).ErrorResponse
403FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet.ErrorResponse
404NOT_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
409CONFLICT: the bot is not connected.ErrorResponse
429RATE_LIMITED: too many requests.ErrorResponse
500INTERNAL_ERROR: sanitized server failure.ErrorResponse
Invoked
FieldTypeDescription
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

NameInTypeRequiredDescription
channelIDpathstring (uuid)yesChannel ID.
modalIDpathstring (uuid)yesModal ID (id of interaction_modal).

Request body (application/json, required): ModalSubmit

FieldTypeDescription
values (required)objectValues maps the custom_id of each text input to what the member typed; an input left out is not filled in.

Responses

StatusMeaningBody
202Delivered to the bot.Invoked
400Invalid input (INVALID_INPUT): an unknown input, a required one left out, or an answer of the wrong length.ErrorResponse
401No valid session (UNAUTHORIZED).ErrorResponse
403FORBIDDEN: the member is timed out, or cross-origin request rejected. RULES_NOT_ACCEPTED: the member has not accepted the community rules yet.ErrorResponse
404NOT_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
409CONFLICT: the bot is not connected.ErrorResponse
429RATE_LIMITED: too many requests.ErrorResponse
500INTERNAL_ERROR: sanitized server failure.ErrorResponse
Invoked
FieldTypeDescription
interaction_id (required)string (uuid)InteractionID identifies the run; the bot answers it.

Something wrong on this page? Tell us.