跳到內容

Responses & follow-up messages

本頁內容尚未翻譯。

Status Stable · Last verified 2026-07-11 · API v10 · Source Receiving & responding

You reply to an interaction with a response object whose type (the callback type) selects the behavior. Then, for up to 15 minutes, you can edit that response and send follow-ups using the interaction token.

Verified values:

Callback type Value Use
PONG 1 ACK a PING (endpoint handshake)
CHANNEL_MESSAGE_WITH_SOURCE 4 Reply with a message now
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE 5 ACK now, show a loading state, edit the reply later
DEFERRED_UPDATE_MESSAGE 6 (components) ACK now, no loading state, edit the message later
UPDATE_MESSAGE 7 (components) edit the message the component is on
APPLICATION_COMMAND_AUTOCOMPLETE_RESULT 8 Return autocomplete suggestions
MODAL 9 Open a modal
PREMIUM_REQUIRED 10 Deprecated — use a Premium button/component instead
LAUNCH_ACTIVITY 12 Launch the app’s Activity
  • Reply now (type 4): return the message in the initial response. Only works if you’re done within the 3-second window.
  • Defer (type 5 for commands, 6 for components): ACK immediately, then do slow work, then edit the original response (below). This is the pattern for anything touching a network or database.

Set the message EPHEMERAL flag (1 << 6 = 64) in the response data.flags to make a reply visible only to the invoking user:

{ "type": 4, "data": { "content": "Only you can see this.", "flags": 64 } }

Use ephemeral for errors, confirmations, and anything containing personal or sensitive output. Follow-ups can be ephemeral too.

After the initial response, use the interaction token (valid ~15 minutes). These are webhook-style endpoints — no auth header, the token is in the path:

Method Endpoint Does
PATCH /webhooks/{application_id}/{interaction_token}/messages/@original Edit the initial response
DELETE /webhooks/{application_id}/{interaction_token}/messages/@original Delete the initial response
POST /webhooks/{application_id}/{interaction_token} Create a follow-up message
PATCH /webhooks/{application_id}/{interaction_token}/messages/{message_id} Edit a follow-up
DELETE /webhooks/{application_id}/{interaction_token}/messages/{message_id} Delete a follow-up

Typical deferred flow:

1. Respond {"type": 5} # ACK within 3s, loading state
2. …do the slow work…
3. PATCH /webhooks/{app_id}/{token}/messages/@original {"content": "Done ✅"}

[!NOTE] Verified — follow-up limit for user-installs For user-installed apps not installed in the server where the interaction occurs, apps are limited to 5 follow-up messages per interaction. Source: Receiving & responding.

PREMIUM_REQUIRED (10) is deprecated; prompt upgrades with a Premium button (button style 6, pointing at a SKU) instead — see Components → buttons. LAUNCH_ACTIVITY (12) opens the app’s Activity.

The interaction-endpoint example answers a command with type 4. To make it deferred, reply {"type": 5} and then PATCH …/@original when the work completes.