guild_id, channel, member and other fields. You can find all the values in our data models below.
Interaction Object
Interaction Structure
* This is always present on application command, message component, and modal submit interaction types. It is optional for future-proofing against new interaction types
**
member is sent when the interaction is invoked in a guild, and user is sent when invoked in a DM
*** app_permissions includes ATTACH_FILES | EMBED_LINKS | MENTION_EVERYONE permissions for (G)DMs with other users, and additionally includes USE_EXTERNAL_EMOJIS for DMs with the app’s bot user
**** This is available on all interaction types except PING
Interaction Type
Interaction Context Types
Context in Discord where an interaction can be used, or where it was triggered from. Details about using interaction contexts for application commands is in the commands context documentation.Authorizing Integration Owners Object
Theauthorizing_integration_owners field includes details about the authorizing user or server for the installation(s) relevant to the interaction. For apps installed to a user, it can be used to tell the difference between the authorizing user and the user that triggered an interaction (like a message component).
A key will only be present if the following are true:
- The app has been authorized to the installation context corresponding to the key (
GUILD_INSTALLorUSER_INSTALL) - The interaction is supported in the source interaction context (
GUILD,BOT_DM, orPRIVATE_CHANNEL) for the installation context corresponding to the key - And for command invocations, the command must be supported in the installation context (using
integration_types)
authorizing_integration_owners depend on the key—
- If the key is
GUILD_INSTALL("0"), the value depends on the source of the interaction:- The value will be the guild ID if the interaction is triggered from a server
- The value will be
"0"if the interaction is triggered from a DM with the app’s bot user
- If the key is
USER_INSTALL("1"), the value will be the ID of the authorizing user
Interaction Data
While thedata field is guaranteed to be present for all interaction types besides PING, its structure will vary. The following tables detail the inner data payload for each interaction type.
Application Command Data Structure
Sent in
APPLICATION_COMMAND and APPLICATION_COMMAND_AUTOCOMPLETE interactions.
* This can be partial when in response to
APPLICATION_COMMAND_AUTOCOMPLETE
Message Component Data Structure
* This is always present for select menu components
Modal Submit Data Structure
Component Interaction Response Structures
Response structures for both modal and message component interactions.Resolved Data Structure
If data for a Member is included, data for its corresponding User will also be included.
* Partial
Member objects are missing user, deaf and mute fields
** Partial Channel objects only have id, name, type, permissions, app_permissions, last_message_id, last_pin_timestamp, nsfw, parent_id, guild_id, flags, rate_limit_per_user, topic and position fields. Threads will also have the thread_metadata field.
Application Command Interaction Data Option Structure
All options have names, and an option can either be a parameter and input value—in which casevalue will be set—or it can denote a subcommand or group—in which case it will contain a top-level key and another array of options.
value and options are mutually exclusive.
Message Interaction Object
This is sent on the message object when the message is a response to an Interaction without an existing message.This means responses to Message Components do not include this property, instead including a message reference object as components always exist on preexisting messages.
Message Interaction Structure
Receiving an Interaction
When a user interacts with your app, your app will receive an Interaction. Your app can receive an interaction in one of two ways:- Via Interaction Create gateway event
- Via outgoing webhook
INTERACTION_CREATE Gateway Event may be handled by connected clients, while the webhook method detailed below does not require a connected client.
If you want to receive interactions via HTTP-based outgoing webhooks, you must configure an Interactions Endpoint URL for your app. You can read about preparing and adding an Interactions Endpoint URL to your app in the Preparing for Interactions section in Interactions Overview.
Interaction Metadata
An Interaction includes metadata to aid your application in handling it as well asdata specific to the interaction type. You can find samples for each interaction type on their respective pages:
An explanation of all the fields can be found in our data models.
Now that you’ve gotten the data from the user, it’s time to respond to them.
Responding to an Interaction
Interactions—both receiving and responding—are webhooks under the hood. So responding to an Interaction is just like sending a webhook request!Interaction responses have the same header requirements as normal HTTP API requests. See here for further information.
Interaction Response Object
Interaction Response Structure
Interaction Callback Type
* Only valid for component-based interactions
** Not available for
MODAL_SUBMIT and PING interactions.
Interaction Callback Data Structure
Messages
Not all message fields are currently supported.
* If you create a callback with the type
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE the only valid message flag you may use is EPHEMERAL. If you’d like to create a component based message with IS_COMPONENTS_V2 you must do that with the edit original response endpoint, not this one.
** See Uploading Files for details.
Autocomplete
Modal
Interaction Callback
When responding to an interaction received, you can make aPOST request to /interactions/<interaction_id>/<interaction_token>/callback. interaction_id is the unique id of that individual Interaction from the received payload. interaction_token is the unique token for that interaction from the received payload.
If you are receiving Interactions over the gateway, you have to respond via HTTP. Responses to Interactions are not sent as commands over the gateway.
If you send this request for an interaction received over HTTP, respond to the original HTTP request with a 202 and no body.
Interaction
tokens are valid for 15 minutes and can be used to send followup messages but you must send an initial response within 3 seconds of receiving the event. If the 3 second deadline is exceeded, the token will be invalidated.Inline HTTP Response Behavior
Inline HTTP Response Behavior
If you receive interactions over HTTP, your server can also respond to the received
POST request. You’ll want to respond with a 200 status code (if everything went well), as well as specifying a type and data, which is an Interaction Response object:Interaction Callback Response Object
Interaction Callback Object
Interaction Callback Resource Object
* Only present if type is
LAUNCH_ACTIVITY.
** Only present if type is either CHANNEL_MESSAGE_WITH_SOURCE or UPDATE_MESSAGE.
Interaction Callback Activity Instance Resource
Followup Messages
Sometimes, you want to send followup messages to a user after responding to an interaction. Or, you may want to edit your original response. Whether you receive Interactions over the gateway or by outgoing webhook, you can use the following endpoints to edit your initial response or send followup messages:PATCH /webhooks/<application_id>/<interaction_token>/messages/@originalto edit your initial response to an InteractionDELETE /webhooks/<application_id>/<interaction_token>/messages/@originalto delete your initial response to an InteractionPOST /webhooks/<application_id>/<interaction_token>to send a new followup messagePATCH /webhooks/<application_id>/<interaction_token>/messages/<message_id>to edit a message sent with thattoken
Interactions webhooks share the same rate limit properties as normal webhooks.
Endpoints
The endpoints below are not bound to the application’s Global Rate Limit.
Create Interaction Response
Create a response to an Interaction. Body is an interaction response. Returns204 unless with_response is set to true which returns 200 with the body as interaction callback response.
This endpoint also supports file attachments similar to the webhook endpoints. Refer to Uploading Files for details on uploading files and multipart/form-data requests.
Query String Params
Get Original Interaction Response
Returns the initial Interaction response. Functions the same as Get Webhook Message.Edit Original Interaction Response
Edits the initial Interaction response. Functions the same as Edit Webhook Message.Delete Original Interaction Response
Deletes the initial Interaction response. Returns204 No Content on success.
Create Followup Message
Apps are limited to 5 followup messages per interaction if it was initiated from a user-installed app and isn’t installed in the server (meaning the authorizing integration owners object only contains
USER_INSTALL)wait is always true. The thread_id, avatar_url, and username parameters are not supported when using this endpoint for interaction followups. You can use the EPHEMERAL message flag 1 << 6 (64) to send a message that only the user can see. You can also use the IS_COMPONENTS_V2 message flag 1 << 15 (32768) to send a component-based message.
When using this endpoint directly after responding to an interaction with DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, this endpoint will function as Edit Original Interaction Response for backwards compatibility. In this case, no new message will be created, and the loading message will be edited instead. The ephemeral flag will be ignored, and the value you provided in the initial defer response will be preserved, as an existing message’s ephemeral state cannot be changed. This behavior is deprecated, and you should use the Edit Original Interaction Response endpoint in this case instead.
Get Followup Message
Returns a followup message for an Interaction. Functions the same as Get Webhook Message.Edit Followup Message
Edits a followup message for an Interaction. Functions the same as Edit Webhook Message.Delete Followup Message
Deletes a followup message for an Interaction. Returns204 No Content on success.