Skip to main content

Update Interaction Respond

Updates a deferred interaction response with the final content. Used after sending a deferred response to provide the actual result.

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

  • Client Id - The Discord bot client identifier from the Connect node (optional if Bot Token provided).
  • Application Id - The Discord application ID.
  • Interaction Token - The token from the interaction (found in interaction.Token).
  • Response - JSON configuration defining the updated response content.

Options

  • Bot Token - Discord bot token credential (optional if using Client ID from Connect node).

How It Works

The Update Interaction Respond node edits a previously sent deferred interaction response. When executed, the node:

  1. Authenticates using either Client ID or direct bot token
  2. Validates the application ID and interaction token
  3. Parses the response JSON configuration
  4. Processes any mustache template variables
  5. Converts the JSON to a webhook edit structure
  6. Updates the interaction response with the new content

Requirements

  • Active Discord bot session (Client ID) or bot token credentials
  • Valid application ID
  • Valid interaction token from a deferred interaction
  • A previously sent deferred response

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Client ID or bot token missing/invalid
  • ErrInvalidArg - Application ID is empty
  • ErrInvalidArg - Interaction token is empty
  • ErrJson - Invalid JSON format in response
  • Discord API errors

Typical Flow

1. Interaction In → interaction
2. Interaction Out (deferred)
- Response: {"type": "deferred message"}
3. Perform long operation (database query, API call, etc.)
4. Update Interaction Respond
- Application Id: (your app ID)
- Interaction Token: {{interaction.Token}}
- Response: (final content)

Response JSON Structure

{
"response_message": "Operation completed successfully!",
"embeds": [
{
"title": "Results",
"description": "Here are the results of your query",
"color": 3066993,
"fields": [
{
"name": "Status",
"value": "Success"
}
]
}
]
}

Properties:

  • response_message - The text content to update
  • embeds - Array of embed objects to display

Example: Long Database Query

Flow:

1. Interaction In → interaction
2. Interaction Out
- Response: {"type": "deferred message"}
3. Query database (takes 8 seconds)
4. Update Interaction Respond
- Application Id: "123456789012345678"
- Interaction Token: {{interaction.Token}}
- Response:
{
"response_message": "Query complete! Found {{results.length}} records."
}

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

Example: With Progress Updates

Flow:

1. Interaction In → interaction
2. Interaction Out (deferred)
3. Start processing
4. Update Interaction Respond
- Response: {"response_message": "Processing: Step 1 of 3"}
5. Continue processing
6. Update Interaction Respond
- Response: {"response_message": "Processing: Step 2 of 3"}
7. Finish processing
8. Update Interaction Respond
- Response:
{
"response_message": "Complete!",
"embeds": [{
"title": "Results",
"description": "All steps completed successfully"
}]
}

Example: API Call with Results

Flow:

1. Interaction In (command: /weather city:London) → interaction
2. Interaction Out (deferred)
3. Call weather API
4. Update Interaction Respond
- Response:
{
"response_message": "Weather for London:",
"embeds": [{
"title": "Current Weather",
"fields": [
{"name": "Temperature", "value": "{{weather.temp}}°C"},
{"name": "Conditions", "value": "{{weather.condition}}"}
]
}]
}

Example: Error Handling

Flow:

1. Interaction In → interaction
2. Interaction Out (deferred)
3. Try:
- Perform operation
- Update Interaction Respond (success message)
4. Catch:
- Update Interaction Respond (error message)
{
"response_message": "An error occurred: {{error.message}}",
"embeds": [{
"title": "Error",
"color": 15158332,
"description": "Please try again later"
}]
}

When to Use Deferred Responses

Use deferred responses when:

  • Database queries take > 3 seconds
  • External API calls are involved
  • Complex calculations are needed
  • File processing is required
  • Any operation that might exceed 3 seconds

Multiple Updates

You can update a deferred response multiple times to show progress:

1. Defer
2. Update: "Starting..."
3. Update: "50% complete..."
4. Update: "Done!"

Using Mustache Variables

Access data in your response:

{
"response_message": "Hello {{interaction.Member.User.Username}}!",
"embeds": [{
"description": "Results: {{results}}"
}]
}

Embed Structure

Same format as Send Channel Message:

{
"response_message": "Results ready",
"embeds": [
{
"title": "Query Results",
"description": "Found {{count}} items",
"color": 3447003,
"fields": [
{"name": "Field 1", "value": "Value 1"},
{"name": "Field 2", "value": "Value 2"}
],
"footer": {"text": "Completed at {{timestamp}}"}
}
]
}

Limitations

  • Can only update responses that were deferred
  • Interaction tokens expire after 15 minutes
  • Cannot update if the original interaction was deleted

Use Cases

  • Database operations - Show results of slow queries
  • External APIs - Display data from third-party services
  • File processing - Show results after processing files
  • Multi-step operations - Update progress through steps
  • Error recovery - Show error messages if operations fail

Tips and Best Practices

  • Always defer first - Send deferred response before long operations
  • Progress updates - Update periodically for very long operations
  • Error handling - Always handle errors and update with error messages
  • Clear messages - Make final messages clear and informative
  • Timeouts - Remember the 15-minute token expiration
  • User experience - Keep users informed of progress
  • Testing - Test with various operation durations