Skip to content

Webhook

The Webhook component acts as the bridge between Discord and your Nappai automation. It listens for actions taken by users in your Discord server, such as clicking buttons, using commands, or adding reactions. When an interaction occurs, this component captures the details and triggers your workflow, allowing you to automate responses or update other systems based on Discord activity.

How it Works

When a user performs an action in Discord, Discord sends a message to your automation system. The Webhook component receives this message and passes the relevant information (like who interacted and what they did) to the rest of your workflow. It also sends a quick confirmation back to Discord to keep the connection stable. This allows your automations to react in real-time to user events in your server.

Connection & Credentials

This component requires configuring a credential in the Nappai panel before interacting with the external service:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type Discord API and fill in the required fields. You can find your Bot Token, Application ID, and Public Key in the Discord Developer Portal under your application’s Bot section.
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

Input Fields

  • Store Messages: Enables saving the message details to the flow history. Use this if you need to review the interaction later or reference the original message in subsequent steps.

Outputs

After the component processes the interaction, it provides the following data for use in your workflow:

  • HTTP Response: Confirms that the interaction was successfully received.
  • Status: Shows the result of the operation (e.g., success or error).
  • Message ID: The identifier of the message, useful if you need to edit the message or send follow-up replies later.

Output Data Example (JSON)json

{ “status”: “success”, “response”: { “code”: 200 }, “message_id”: “987654321012345678” }

Connectivity

This component is typically used at the start of a workflow as a trigger. It connects to other nodes that process the data, such as:

  • Message Editors: To update the original Discord message based on the interaction.
  • Data Processors: To analyze the content of the interaction.
  • Actions: To perform tasks in other connected applications based on the Discord event.

Usage Example

Scenario: Approving a Request via Discord

  1. A user clicks an “Approve” button in a Discord message.
  2. The Webhook component captures this click and sends the data to your workflow.
  3. A subsequent node receives the data and updates a spreadsheet to mark the request as approved.
  4. Another node sends a confirmation message back to Discord notifying the user.

Tips and Best Practices

  • Use the Store Messages option if you plan to analyze the interaction content later in your workflow.
  • Ensure your Discord bot has the correct permissions to read interactions and edit messages.
  • Keep your workflow simple by using the Webhook component only to trigger actions, and move complex logic to other specialized nodes.

Security Considerations

  • Bot Token Security: Never share your Bot Token. It grants full control over your bot. Always keep it secure within Nappai’s credential system.
  • Public Key Verification: The credential includes a Public Key to ensure that interactions are genuinely coming from Discord and not from unauthorized sources.