Skip to main content

Interaction Out

Sends a response to a Discord interaction. Must be used after Interaction In to acknowledge and respond to user interactions.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Interaction Id - The Discord interaction ID from the Interaction In node.
  • Interaction Out - JSON configuration defining the response.

How It Works

The Interaction Out node sends a response to a Discord interaction. When executed, the node:

  1. Validates the interaction ID
  2. Retrieves the interaction session
  3. Parses the response JSON configuration
  4. Processes any mustache template variables in the JSON
  5. Determines the response type (message, modal, deferred, autocomplete)
  6. Sends the appropriate response to Discord
  7. Removes the interaction from the session manager

Requirements

  • Valid interaction ID from an Interaction In node
  • Properly formatted response JSON
  • Response must be sent within 3 seconds of receiving the interaction

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Interaction ID is empty or invalid
  • ErrJsonParse - Invalid JSON format in response
  • ErrInvalidArg - Invalid JSON structure
  • Discord API errors
warning

Interactions must be responded to within 3 seconds or they will fail and show "This interaction failed" to the user.

Response Types

1. Message Response

Send a message as the response:

{
"type": "message",
"response_message": "Your command was successful!",
"embeds": [
{
"title": "Success",
"description": "Operation completed",
"color": 3066993
}
]
}

2. Modal Response

Show a modal (form) to the user:

{
"type": "modal",
"data": {
"CustomID": "feedback_modal",
"Title": "Feedback Form",
"Components": [
{
"CustomID": "name",
"Label": "Your Name",
"Style": "short",
"Placeholder": "Enter your name",
"Required": true
},
{
"CustomID": "feedback",
"Label": "Your Feedback",
"Style": "paragraph",
"Placeholder": "Tell us what you think",
"Required": true
}
]
}
}

3. Deferred Message Response

Acknowledge the interaction immediately (use when processing takes > 3 seconds):

{
"type": "deferred message"
}

Then use Update Interaction Respond to send the actual response later.

4. Autocomplete Response

Provide autocomplete choices:

{
"type": "autocomplete",
"choices": [
{"name": "Option 1", "value": "opt1"},
{"name": "Option 2", "value": "opt2"},
{"name": "Option 3", "value": "opt3"}
]
}

Example: Simple Text Response

Inputs:

  • Interaction Id: {{interaction.ID}}
  • Response:
{
"type": "message",
"response_message": "Pong! Latency: 42ms"
}

Result: Bot sends a simple text response.

Example: Rich Embed Response

Inputs:

  • Interaction Id: {{interaction.ID}}
  • Response:
{
"type": "message",
"response_message": "User Information",
"embeds": [
{
"title": "{{interaction.Member.User.Username}}",
"description": "User ID: {{interaction.Member.User.ID}}",
"color": 5814783,
"fields": [
{
"name": "Server",
"value": "{{interaction.GuildID}}",
"inline": true
}
]
}
]
}

Result: Bot sends a formatted embed with user info.

Example: Show Modal Form

Inputs:

  • Interaction Id: {{interaction.ID}}
  • Response:
{
"type": "modal",
"data": {
"CustomID": "report_modal",
"Title": "Report Issue",
"Components": [
{
"CustomID": "issue_title",
"Label": "Issue Title",
"Style": "short",
"Required": true
},
{
"CustomID": "issue_description",
"Label": "Description",
"Style": "paragraph",
"Required": true
}
]
}
}

Result: User sees a form modal to fill out.

Example: Deferred Response for Long Operations

Flow:

1. Interaction In → interaction
2. Interaction Out (immediate acknowledgment)
- Response: {"type": "deferred message"}
3. Perform long database query (takes 10 seconds)
4. Update Interaction Respond
- With actual results

Result: User sees "Bot is thinking..." then gets the final response.

Example: Autocomplete Suggestions

Flow:

1. Interaction In (autocomplete) → interaction
2. Get user's partial input
3. Search for matching options
4. Interaction Out
- Response with dynamic choices based on input

For modal text inputs:

  • "short" - Single line text input
  • "paragraph" - Multi-line text area

Response Message Properties

{
"type": "message",
"response_message": "Text content",
"embeds": [ /* array of embed objects */ ]
}

Properties:

  • type - Must be "message"
  • response_message - The text content (up to 2000 characters)
  • embeds - Array of embed objects (same format as Send Channel Message)

Using Mustache Variables

You can use data from the interaction in your responses:

{
"type": "message",
"response_message": "Hello {{interaction.Member.User.Username}}!"
}

Common variables:

  • {{interaction.Member.User.Username}} - User's name
  • {{interaction.Member.User.ID}} - User ID
  • {{interaction.Data.Name}} - Command name
  • {{interaction.Data.Options[0].Value}} - First command option value
  • {{interaction.ChannelID}} - Channel ID

Response Time Limit

danger

You have only 3 seconds to respond to an interaction. If you exceed this:

  • User sees "This interaction failed"
  • The interaction becomes invalid
  • Use deferred responses for long operations

Ephemeral Messages

To send a message only visible to the user who invoked the interaction, you would need to use Discord API's flags directly (not currently exposed in this node configuration).

Use Cases

  • Command responses - Reply to slash commands
  • Button confirmations - Acknowledge button clicks
  • Form collection - Show modal forms
  • Progress indication - Use deferred responses for long tasks
  • Autocomplete - Provide dynamic suggestions
  • Error messages - Show error information to users

Tips and Best Practices

  • Respond quickly - Always respond within 3 seconds
  • Use deferred - For operations taking longer than 3 seconds
  • Clear messages - Provide clear, helpful response messages
  • Embeds for structure - Use embeds for formatted information
  • Error handling - Catch errors and send user-friendly error messages
  • Validation - Validate interaction ID before responding
  • Testing - Test all response types thoroughly
  • User experience - Make responses informative and helpful