> ## Documentation Index
> Fetch the complete documentation index at: https://discord-platform-username.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Receiving and Responding to Interactions

export const Route = ({method, children}) => {
  return <div className="MDXRoute">
      <span className={"verb" + " " + method.toLowerCase()}>{method}</span>
      <span className="url">{children}</span>
    </div>;
};

export const ManualAnchor = ({id}) => {
  return <div className="MDXManualAnchor" id={id}></div>;
};

An **[Interaction](/developers/interactions/receiving-and-responding#interaction-object)** is the message that your application receives when a user uses an application command or a message component.

For [Slash Commands](/developers/interactions/application-commands#slash-commands), it includes the values that the user submitted.

For [User Commands](/developers/interactions/application-commands#user-commands) and [Message Commands](/developers/interactions/application-commands#message-commands), it includes the resolved user or message on which the action was taken.

For [Message Components](/developers/components/reference) it includes identifying information about the component that was used. It will also include some metadata about how the interaction was triggered: the `guild_id`, `channel`, `member` and other fields. You can find all the values in our data models below.

### Interaction Object

<ManualAnchor id="interaction-object-interaction-structure" />

###### Interaction Structure

| Field                            | Type                                                                                                                                        | Description                                                                                                                                                                                                                                                                |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                               | snowflake                                                                                                                                   | ID of the interaction                                                                                                                                                                                                                                                      |
| application\_id                  | snowflake                                                                                                                                   | ID of the application this interaction is for                                                                                                                                                                                                                              |
| type                             | [interaction type](/developers/interactions/receiving-and-responding#interaction-object-interaction-type)                                   | Type of interaction                                                                                                                                                                                                                                                        |
| data?\*                          | [interaction data](/developers/interactions/receiving-and-responding#interaction-object-interaction-data)                                   | Interaction data payload                                                                                                                                                                                                                                                   |
| guild?                           | [partial guild](/developers/resources/guild#guild-object) object                                                                            | Guild that the interaction was sent from                                                                                                                                                                                                                                   |
| guild\_id?                       | snowflake                                                                                                                                   | Guild that the interaction was sent from                                                                                                                                                                                                                                   |
| channel?                         | [partial channel](/developers/resources/channel#channel-object) object                                                                      | Channel that the interaction was sent from                                                                                                                                                                                                                                 |
| channel\_id?                     | snowflake                                                                                                                                   | Channel that the interaction was sent from                                                                                                                                                                                                                                 |
| member?\*\*                      | [guild member](/developers/resources/guild#guild-member-object) object                                                                      | Guild member data for the invoking user, including permissions                                                                                                                                                                                                             |
| user?                            | [user](/developers/resources/user#user-object) object                                                                                       | User object for the invoking user, if invoked in a DM                                                                                                                                                                                                                      |
| token                            | string                                                                                                                                      | Continuation token for responding to the interaction                                                                                                                                                                                                                       |
| version                          | integer                                                                                                                                     | Read-only property, always `1`                                                                                                                                                                                                                                             |
| message?                         | [message](/developers/resources/message#message-object) object                                                                              | For components or modals triggered by components, the message they were attached to                                                                                                                                                                                        |
| app\_permissions\*\*\*           | string                                                                                                                                      | Bitwise set of permissions the app has in the source location of the interaction                                                                                                                                                                                           |
| locale?\*\*\*\*                  | string                                                                                                                                      | Selected [language](/developers/reference#locales) of the invoking user                                                                                                                                                                                                    |
| guild\_locale?                   | string                                                                                                                                      | [Guild's preferred locale](/developers/resources/guild#guild-object), if invoked in a guild                                                                                                                                                                                |
| entitlements                     | array of [entitlement](/developers/resources/entitlement#entitlement-object) objects                                                        | For [monetized apps](/developers/monetization/overview), any entitlements for the invoking user, representing access to premium [SKUs](/developers/resources/sku)                                                                                                          |
| authorizing\_integration\_owners | dictionary with keys of [application integration types](/developers/resources/application#application-object-application-integration-types) | Mapping of installation contexts that the interaction was authorized for to related user or guild IDs. See [Authorizing Integration Owners Object](/developers/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for details |
| context?                         | [interaction context type](/developers/interactions/receiving-and-responding#interaction-object-interaction-context-types)                  | Context where the interaction was triggered from                                                                                                                                                                                                                           |
| attachment\_size\_limit          | integer                                                                                                                                     | Attachment size limit in bytes                                                                                                                                                                                                                                             |

\* 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

<ManualAnchor id="interaction-object-interaction-type" />

###### Interaction Type

| Name                               | Value |
| ---------------------------------- | ----- |
| PING                               | 1     |
| APPLICATION\_COMMAND               | 2     |
| MESSAGE\_COMPONENT                 | 3     |
| APPLICATION\_COMMAND\_AUTOCOMPLETE | 4     |
| MODAL\_SUBMIT                      | 5     |

<ManualAnchor id="interaction-object-interaction-context-types" />

###### 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](/developers/interactions/application-commands#interaction-contexts).

| Name             | Type | Description                                                                    |
| ---------------- | ---- | ------------------------------------------------------------------------------ |
| GUILD            | 0    | Interaction can be used within servers                                         |
| BOT\_DM          | 1    | Interaction can be used within DMs with the app's bot user                     |
| PRIVATE\_CHANNEL | 2    | Interaction can be used within Group DMs and DMs other than the app's bot user |

<ManualAnchor id="interaction-object-authorizing-integration-owners-object" />

###### Authorizing Integration Owners Object

The `authorizing_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](/developers/resources/application#application-object-application-integration-types) corresponding to the key (`GUILD_INSTALL` or `USER_INSTALL`)
* The interaction is supported in the source [interaction context](/developers/interactions/receiving-and-responding#interaction-object-interaction-context-types) (`GUILD`, `BOT_DM`, or `PRIVATE_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`](/developers/interactions/application-commands#contexts))

The values in `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

<ManualAnchor id="interaction-object-interaction-data" />

###### Interaction Data

While the `data` field is guaranteed to be present for all [interaction types](/developers/interactions/receiving-and-responding#interaction-object-interaction-type) besides `PING`, its structure will vary. The following tables detail the inner `data` payload for each interaction type.

| Interaction Type                         | Interaction Data                                                                                                                              |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| PING (`1`)                               | N / A                                                                                                                                         |
| APPLICATION\_COMMAND (`2`)               | [Application Command Data Structure](/developers/interactions/receiving-and-responding#interaction-object-application-command-data-structure) |
| MESSAGE\_COMPONENT (`3`)                 | [Message Component Data Structure](/developers/interactions/receiving-and-responding#interaction-object-message-component-data-structure)     |
| APPLICATION\_COMMAND\_AUTOCOMPLETE (`4`) | [Application Command Data Structure](/developers/interactions/receiving-and-responding#interaction-object-application-command-data-structure) |
| MODAL\_SUBMIT (`5`)                      | [Modal Submit Data Structure](/developers/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure)               |

<ManualAnchor id="interaction-object-application-command-data-structure" />

###### Application Command Data Structure

<Info>
  Sent in `APPLICATION_COMMAND` and `APPLICATION_COMMAND_AUTOCOMPLETE` interactions.
</Info>

| Field       | Type                                                                                                                                                                               | Description                                                                                                                                                                                      |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id          | snowflake                                                                                                                                                                          | [`ID`](/developers/interactions/application-commands#application-command-object-application-command-structure) of the invoked command                                                            |
| name        | string                                                                                                                                                                             | [`name`](/developers/interactions/application-commands#application-command-object-application-command-structure) of the invoked command                                                          |
| type        | integer                                                                                                                                                                            | [`type`](/developers/interactions/application-commands#application-command-object-application-command-structure) of the invoked command                                                          |
| resolved?   | [resolved data](/developers/interactions/receiving-and-responding#interaction-object-resolved-data-structure)                                                                      | Converted users + roles + channels + attachments                                                                                                                                                 |
| options?\*  | array of [application command interaction data option](/developers/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Params + values from the user                                                                                                                                                                    |
| guild\_id?  | snowflake                                                                                                                                                                          | ID of the guild the command is registered to                                                                                                                                                     |
| target\_id? | snowflake                                                                                                                                                                          | ID of the user or message targeted by a [user](/developers/interactions/application-commands#user-commands) or [message](/developers/interactions/application-commands#message-commands) command |

\* This [can be partial](/developers/interactions/application-commands#autocomplete) when in response to `APPLICATION_COMMAND_AUTOCOMPLETE`

<ManualAnchor id="interaction-object-message-component-data-structure" />

###### Message Component Data Structure

| Field           | Type                                                                                                          | Description                                                                                           |
| --------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| custom\_id      | string                                                                                                        | [`custom_id`](/developers/components/reference#anatomy-of-a-component-custom-id) of the component     |
| component\_type | integer                                                                                                       | [type](/developers/components/reference#component-object-component-types) of the component            |
| values?\*       | array of [select option values](/developers/components/reference#string-select-select-option-structure)       | Values the user selected in a [select menu](/developers/components/reference#string-select) component |
| resolved?       | [resolved data](/developers/interactions/receiving-and-responding#interaction-object-resolved-data-structure) | Resolved entities from selected options                                                               |

\* This is always present for select menu components

<ManualAnchor id="interaction-object-modal-submit-data-structure" />

###### Modal Submit Data Structure

| Field      | Type                                                                                                                                                      | Description                             |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| custom\_id | string                                                                                                                                                    | The custom ID provided for the modal    |
| components | array of [component interaction response](/developers/interactions/receiving-and-responding#interaction-object-component-interaction-response-structures) | Values submitted by the user            |
| resolved?  | [resolved data](/developers/interactions/receiving-and-responding#interaction-object-resolved-data-structure)                                             | Resolved entities from selected options |

<ManualAnchor id="interaction-object-component-interaction-response-structures" />

###### Component Interaction Response Structures

Response structures for both modal and message component interactions.

| Component                                                                                                                   |
| --------------------------------------------------------------------------------------------------------------------------- |
| [String Select](/developers/components/reference#string-select-string-select-interaction-response-structure)                |
| [Text Input](/developers/components/reference#text-input-text-input-interaction-response-structure)                         |
| [User Select](/developers/components/reference#user-select-user-select-interaction-response-structure)                      |
| [Role Select](/developers/components/reference#role-select-role-select-interaction-response-structure)                      |
| [Mentionable Select](/developers/components/reference#mentionable-select-mentionable-select-interaction-response-structure) |
| [Channel Select](/developers/components/reference#channel-select-channel-select-interaction-response-structure)             |
| [Text Display](/developers/components/reference#text-display-text-display-interaction-response-structure)                   |
| [Label](/developers/components/reference#label-label-interaction-response-structure)                                        |
| [File Upload](/developers/components/reference#file-upload-file-upload-interaction-response-structure)                      |
| [Radio Group](/developers/components/reference#radio-group-interaction-response-structure)                                  |
| [Checkbox Group](/developers/components/reference#checkbox-group-interaction-response-structure)                            |
| [Checkbox](/developers/components/reference#checkbox-interaction-response-structure)                                        |

<ManualAnchor id="interaction-object-resolved-data-structure" />

###### Resolved Data Structure

<Info>
  If data for a Member is included, data for its corresponding User will also be included.
</Info>

| Field         | Type                                                                                           | Description                     |
| ------------- | ---------------------------------------------------------------------------------------------- | ------------------------------- |
| users?        | Map of Snowflakes to [user](/developers/resources/user#user-object) objects                    | IDs and User objects            |
| members?\*    | Map of Snowflakes to [partial member](/developers/resources/guild#guild-member-object) objects | IDs and partial Member objects  |
| roles?        | Map of Snowflakes to [role](/developers/topics/permissions#role-object) objects                | IDs and Role objects            |
| channels?\*\* | Map of Snowflakes to [partial channel](/developers/resources/channel#channel-object) objects   | IDs and partial Channel objects |
| messages?     | Map of Snowflakes to [partial messages](/developers/resources/message#message-object) objects  | IDs and partial Message objects |
| attachments?  | Map of Snowflakes to [attachment](/developers/resources/message#attachment-object) objects     | IDs and attachment objects      |

\* Partial `Member` objects are missing `user`, `deaf` and `mute` fields

\*\* Partial `Channel` objects only have `id`, `name`, `type`, `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.

<ManualAnchor id="interaction-object-application-command-interaction-data-option-structure" />

###### Application Command Interaction Data Option Structure

All options have names, and an option can either be a parameter and input value--in which case `value` 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.

| Field    | Type                                                                                                                                                                               | Description                                                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| name     | string                                                                                                                                                                             | Name of the parameter                                                                                                                                |
| type     | integer                                                                                                                                                                            | Value of [application command option type](/developers/interactions/application-commands#application-command-object-application-command-option-type) |
| value?   | string, integer, double, or boolean                                                                                                                                                | Value of the option resulting from user input                                                                                                        |
| options? | array of [application command interaction data option](/developers/interactions/receiving-and-responding#interaction-object-application-command-interaction-data-option-structure) | Present if this option is a group or subcommand                                                                                                      |
| focused? | boolean                                                                                                                                                                            | `true` if this option is the currently focused option for autocomplete                                                                               |

### Message Interaction Object

This is sent on the [message object](/developers/resources/message#message-object) when the message is a response to an Interaction without an existing message.

<Info>
  This means responses to [Message Components](/developers/components/reference) do not include this property, instead including a [message reference](/developers/resources/message#message-reference-structure) object as components *always* exist on preexisting messages.
</Info>

<ManualAnchor id="message-interaction-object-message-interaction-structure" />

###### Message Interaction Structure

| Field   | Type                                                                                                      | Description                                                                                                                                                                            |
| ------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id      | snowflake                                                                                                 | ID of the interaction                                                                                                                                                                  |
| type    | [interaction type](/developers/interactions/receiving-and-responding#interaction-object-interaction-type) | Type of interaction                                                                                                                                                                    |
| name    | string                                                                                                    | Name of the [application command](/developers/interactions/application-commands#application-command-object-application-command-structure), including subcommands and subcommand groups |
| user    | [user object](/developers/resources/user#user-object)                                                     | User who invoked the interaction                                                                                                                                                       |
| member? | [partial member](/developers/resources/guild#guild-member-object) object                                  | Member who invoked the interaction in the guild                                                                                                                                        |

## Receiving an Interaction

When a user interacts with your app, your app will receive an **[Interaction](/developers/interactions/receiving-and-responding#interaction-object)**. Your app can receive an interaction in one of two ways:

* Via [Interaction Create](/developers/events/gateway-events#interaction-create) gateway event
* Via outgoing webhook

These two methods are **mutually exclusive**; you can *only* receive Interactions one of the two ways. The `INTERACTION_CREATE` [Gateway Event](/developers/events/gateway-events#interaction-create) 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](/developers/interactions/overview#preparing-for-interactions) section in Interactions Overview.

### Interaction Metadata

An [Interaction](/developers/interactions/receiving-and-responding#interaction-object) includes metadata to aid your application in handling it as well as `data` specific to the interaction type. You can find samples for each interaction type on their respective pages:

* [Slash Commands](/developers/interactions/application-commands#slash-commands-example-interaction)
* [User Commands](/developers/interactions/application-commands#user-commands-example-interaction)
* [Message Commands](/developers/interactions/application-commands#message-commands-example-interaction)
* [Message Components](/developers/components/using-message-components)
* [Modal Components](/developers/components/using-modal-components)

An explanation of all the fields can be found in our [data models](/developers/interactions/receiving-and-responding#interaction-object).

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!

<Info>
  Interaction responses have the same header requirements as normal HTTP API requests. See [here](/developers/reference#http-api) for further information.
</Info>

There are a number of ways you can respond to an interaction:

### Interaction Response Object

<ManualAnchor id="interaction-response-object-interaction-response-structure" />

###### Interaction Response Structure

| Field | Type                                                                                                                                           | Description                  |
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
| type  | [interaction callback type](/developers/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type)           | Type of response             |
| data? | [interaction callback data](/developers/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure) | An optional response message |

<ManualAnchor id="interaction-response-object-interaction-callback-type" />

###### Interaction Callback Type

| Name                                       | Value | Description                                                                                                                                                                                                                                       |
| ------------------------------------------ | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PONG                                       | 1     | ACK a `Ping`                                                                                                                                                                                                                                      |
| CHANNEL\_MESSAGE\_WITH\_SOURCE             | 4     | Respond to an interaction with a message                                                                                                                                                                                                          |
| DEFERRED\_CHANNEL\_MESSAGE\_WITH\_SOURCE   | 5     | ACK an interaction and edit a response later, the user sees a loading state                                                                                                                                                                       |
| DEFERRED\_UPDATE\_MESSAGE\*                | 6     | For components, ACK an interaction and edit the original message later; the user does not see a loading state                                                                                                                                     |
| UPDATE\_MESSAGE\*                          | 7     | For components, edit the message the component was attached to                                                                                                                                                                                    |
| APPLICATION\_COMMAND\_AUTOCOMPLETE\_RESULT | 8     | Respond to an autocomplete interaction with suggested choices                                                                                                                                                                                     |
| MODAL\*\*                                  | 9     | Respond to an interaction with a popup modal                                                                                                                                                                                                      |
| PREMIUM\_REQUIRED                          | 10    | [**Deprecated**](/developers/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes); respond to an interaction with an upgrade button, only available for apps with [monetization](/developers/monetization/overview) enabled |
| LAUNCH\_ACTIVITY                           | 12    | Launch the Activity associated with the app. Only available for apps with [Activities](/developers/activities/overview) enabled                                                                                                                   |

\* Only valid for [component-based](/developers/components/reference) interactions

\*\* Not available for `MODAL_SUBMIT` and `PING` interactions.

<ManualAnchor id="interaction-response-object-interaction-callback-data-structure" />

###### Interaction Callback Data Structure

<ManualAnchor id="interaction-response-object-messages" />

###### Messages

Not all message fields are currently supported.

| Field              | Type                                                                                   | Description                                                                                                                                                                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tts?               | boolean                                                                                | Whether the response is TTS                                                                                                                                                                                                                                          |
| content?           | string                                                                                 | Message content                                                                                                                                                                                                                                                      |
| embeds?            | array of [embeds](/developers/resources/message#embed-object)                          | Supports up to 10 embeds                                                                                                                                                                                                                                             |
| allowed\_mentions? | [allowed mentions](/developers/resources/message#allowed-mentions-object)              | [Allowed mentions](/developers/resources/message#allowed-mentions-object) object                                                                                                                                                                                     |
| flags? \*          | integer                                                                                | [Message flags](/developers/resources/message#message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS`, `EPHEMERAL`, `IS_COMPONENTS_V2`, `IS_VOICE_MESSAGE`, and `SUPPRESS_NOTIFICATIONS` can be set) |
| components?        | array of [components](/developers/components/reference#component-object)               | Message components                                                                                                                                                                                                                                                   |
| attachments? \*\*  | array of partial [attachment](/developers/resources/message#attachment-object) objects | Attachment objects with filename and description                                                                                                                                                                                                                     |
| poll?              | [poll](/developers/resources/poll#poll-create-request-object) request object           | Details about the poll                                                                                                                                                                                                                                               |

\* If you create a callback with the [type](/developers/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE` the only valid [message flag](/developers/resources/message#message-object-message-flags) 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](/developers/interactions/receiving-and-responding#edit-original-interaction-response) endpoint, not this one.

\*\* See [Uploading Files](/developers/reference#uploading-files) for details.

<ManualAnchor id="interaction-response-object-autocomplete" />

###### Autocomplete

| Field   | Type                                                                                                                                     | Description                              |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| choices | array of [choices](/developers/interactions/application-commands#application-command-object-application-command-option-choice-structure) | autocomplete choices (max of 25 choices) |

<ManualAnchor id="interaction-response-object-modal" />

###### Modal

| Field      | Type                                                                     | Description                                                   |
| ---------- | ------------------------------------------------------------------------ | ------------------------------------------------------------- |
| custom\_id | string                                                                   | Developer-defined identifier for the modal, 1-100 characters  |
| title      | string                                                                   | Title of the popup modal, max 45 characters                   |
| components | array of [components](/developers/components/reference#component-object) | Between 1 and 5 (inclusive) components that make up the modal |

<Warning>
  If your application responds with user data, you should use [`allowed_mentions`](/developers/resources/message#allowed-mentions-object) to filter which mentions in the content actually ping.
</Warning>

## Interaction Callback

When responding to an interaction received, you can make a `POST` 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.**

```py theme={null}
import requests

url = "https://discord.com/api/v10/interactions/<interaction_id>/<interaction_token>/callback"

json = {
    "type": 4,
    "data": {
        "content": "Congrats on sending your command!"
    }
}
r = requests.post(url, json=json)
```

<Info>
  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.
</Info>

<Accordion title="Inline HTTP Response Behavior" icon="code">
  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](/developers/interactions/receiving-and-responding#interaction-response-object) object:

  ```py theme={null}
  @app.route('/', methods=['POST'])
  def my_command():
      if request.json["type"] == 1:
          return jsonify({
              "type": 1
          })

      else:
          return jsonify({
              "type": 4,
              "data": {
                  "tts": False,
                  "content": "Congrats on sending your command!",
                  "embeds": [],
                  "allowed_mentions": { "parse": [] }
              }
          })
  ```
</Accordion>

<ManualAnchor id="interaction-callback-interaction-callback-response-object" />

###### Interaction Callback Response Object

| Field       | Type                                                                                                                                       | Description                                                      |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| interaction | [interaction callback object](/developers/interactions/receiving-and-responding#interaction-callback-interaction-callback-object)          | The interaction object associated with the interaction response. |
| resource?   | [interaction resource object](/developers/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object) | The resource that was created by the interaction response.       |

<ManualAnchor id="interaction-callback-interaction-callback-object" />

###### Interaction Callback Object

| Field                         | Type      | Description                                                                                               |
| ----------------------------- | --------- | --------------------------------------------------------------------------------------------------------- |
| id                            | snowflake | ID of the interaction                                                                                     |
| type                          | integer   | [Interaction type](/developers/interactions/receiving-and-responding#interaction-object-interaction-type) |
| activity\_instance\_id?       | string    | Instance ID of the Activity if one was launched or joined                                                 |
| response\_message\_id?        | snowflake | ID of the message that was created by the interaction                                                     |
| response\_message\_loading?   | boolean   | Whether the message is in a loading state                                                                 |
| response\_message\_ephemeral? | boolean   | Whether the response message is ephemeral                                                                 |

<ManualAnchor id="interaction-callback-interaction-callback-resource-object" />

###### Interaction Callback Resource Object

| Field                 | Type                                                                                                                                                 | Description                                                                                                                          |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| type                  | integer                                                                                                                                              | [Interaction callback type](/developers/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type) |
| activity\_instance?\* | [Activity instance resource](/developers/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource) | Represents the Activity launched by this interaction.                                                                                |
| message?\*\*          | [message object](/developers/resources/message#message-object)                                                                                       | Message created by the interaction.                                                                                                  |

\* Only present if type is `LAUNCH_ACTIVITY`.

\*\* Only present if type is either `CHANNEL_MESSAGE_WITH_SOURCE` or `UPDATE_MESSAGE`.

<ManualAnchor id="interaction-callback-interaction-callback-activity-instance-resource" />

###### Interaction Callback Activity Instance Resource

| Field | Type   | Description                                                |
| ----- | ------ | ---------------------------------------------------------- |
| id    | string | Instance ID of the Activity if one was launched or joined. |

## 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/@original`](/developers/interactions/receiving-and-responding#edit-original-interaction-response) to edit your initial response to an Interaction
* [`DELETE /webhooks/<application_id>/<interaction_token>/messages/@original`](/developers/interactions/receiving-and-responding#delete-original-interaction-response) to delete your initial response to an Interaction
* [`POST /webhooks/<application_id>/<interaction_token>`](/developers/interactions/receiving-and-responding#create-followup-message) to send a new followup message
* [`PATCH /webhooks/<application_id>/<interaction_token>/messages/<message_id>`](/developers/interactions/receiving-and-responding#edit-followup-message) to edit a message sent with that `token`

<Info>
  Interactions webhooks share the same rate limit properties as normal webhooks.
</Info>

Interaction tokens are valid for **15 minutes**, meaning you can respond to an interaction within that amount of time.

### Endpoints

<Info>
  The endpoints below are not bound to the application's [Global Rate Limit](/developers/topics/rate-limits#global-rate-limit).
</Info>

## Create Interaction Response

<Route method="POST">/interactions/[\{interaction.id}](/developers/interactions/receiving-and-responding#interaction-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/callback</Route>

Create a response to an Interaction. Body is an [interaction response](/developers/interactions/receiving-and-responding#interaction-response-object). Returns `204` unless `with_response` is set to `true` which returns `200` with the body as [interaction callback response](/developers/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object).

This endpoint also supports file attachments similar to the webhook endpoints. Refer to [Uploading Files](/developers/reference#uploading-files) for details on uploading files and `multipart/form-data` requests.

<ManualAnchor id="create-interaction-response-query-string-params" />

###### Query String Params

| Field           | Type                                                   | Description                                                                                                                                                                      |
| --------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| with\_response? | [boolean](/developers/reference#boolean-query-strings) | Whether to include an [interaction callback object](/developers/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object) as the response |

## Get Original Interaction Response

<Route method="GET">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/@original</Route>

Returns the initial Interaction response. Functions the same as [Get Webhook Message](/developers/resources/webhook#get-webhook-message).

## Edit Original Interaction Response

<Route method="PATCH">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/@original</Route>

Edits the initial Interaction response. Functions the same as [Edit Webhook Message](/developers/resources/webhook#edit-webhook-message).

## Delete Original Interaction Response

<Route method="DELETE">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/@original</Route>

Deletes the initial Interaction response. Returns `204 No Content` on success.

## Create Followup Message

<Route method="POST">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)</Route>

<Info>
  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](/developers/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) only contains `USER_INSTALL`)
</Info>

Create a followup message for an Interaction. Functions the same as [Execute Webhook](/developers/resources/webhook#execute-webhook), but `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](/developers/resources/message#message-object-message-flags) `1 << 6` (64) to send a message that only the user can see. You can also use the `IS_COMPONENTS_V2` [message flag](/developers/resources/message#message-object-message-flags) `1 << 15` (32768) to send a [component](/developers/components/reference)-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](/developers/interactions/receiving-and-responding#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](/developers/interactions/receiving-and-responding#edit-original-interaction-response) endpoint in this case instead.

## Get Followup Message

<Route method="GET">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id}](/developers/resources/message#message-object)</Route>

Returns a followup message for an Interaction. Functions the same as [Get Webhook Message](/developers/resources/webhook#get-webhook-message).

## Edit Followup Message

<Route method="PATCH">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id}](/developers/resources/message#message-object)</Route>

Edits a followup message for an Interaction. Functions the same as [Edit Webhook Message](/developers/resources/webhook#edit-webhook-message).

## Delete Followup Message

<Route method="DELETE">/webhooks/[\{application.id}](/developers/resources/application#application-object)/[\{interaction.token}](/developers/interactions/receiving-and-responding#interaction-object)/messages/[\{message.id}](/developers/resources/message#message-object)</Route>

Deletes a followup message for an Interaction. Returns `204 No Content` on success.
