Discord Trigger

Receive Discord messages and interactions as workflow triggers.

When to Use

Use Discord Trigger when:

  • You want to run a workflow when a message is posted in a channel
  • You need to handle slash commands or button interactions
  • Discord is the event source and your workflow runs asynchronously

For sending messages back to Discord, pair this with Discord Send Message.

Output

HandleTypeDescription
payloadobjectNormalized Discord event payload

The payload (accessed as {{ discord.* }}) shape:

FieldTypeDescription
authorobjectMessage author object (username, id, etc.)
channel_idstringChannel ID where the event occurred
guild_idstringServer (guild) ID
contentstringMessage text content
message_idstringDiscord message ID
attachmentsarrayFile attachments on the message
event_typestringEvent type (e.g. MESSAGE_CREATE, INTERACTION_CREATE)
raw_eventobjectFull Discord event object for advanced use cases

Settings

Events

SettingTypeDefaultDescription
event_typesmulti-selectMESSAGE_CREATEDiscord event types to listen for: MESSAGE_CREATE, INTERACTION_CREATE

Filters

SettingTypeDefaultDescription
guild_filterstringOnly trigger for events in this guild (server) ID
channel_filterstringOnly trigger for events in this channel ID

Testing

SettingTypeDefaultDescription
mockPayloadcode editor (JSON)Sample Discord event JSONJSON body to inject when running this workflow locally for testing.

Required Secrets

Configure these on the Env Vars page:

Env VarDescription
DISCORD_BOT_TOKENBot token from your Discord application
DISCORD_PUBLIC_KEYApplication public key used for Ed25519 signature verification

Example

Canvas

React to new messages in a specific channel:

  1. Create a Discord Application and Bot at discord.com/developers/applications
  2. Copy the Bot Token and Public Key from the application settings
  3. Set the Interactions Endpoint URL to your deployed trigger endpoint on triggers.tensorify.io
  4. Enable the Message Content Intent if you need to read message text
  5. Add DISCORD_BOT_TOKEN and DISCORD_PUBLIC_KEY as env vars
  6. Set event_types to MESSAGE_CREATE and channel_filter to your target channel ID
  7. Add a Discord Send Message node to post a response

Access event data in downstream nodes:

{{ discord.author.username }}
{{ discord.content }}
{{ discord.channel_id }}
{{ discord.guild_id }}
{{ discord.event_type }}

The plugin handles Discord's PING verification automatically.

TSL

import discord from @tensorify/discord-trigger:1.0.0
import discord_send from @tensorify/discord-send-message:1.0.0

node trigger @tensorify/discord-trigger:1.0.0 {
    event_types = ["MESSAGE_CREATE"]
    channel_filter = "123456789012345678"
}

node reply @tensorify/discord-send-message:1.0.0 {
    content = "Hello {{ discord.author.username }}!"
}

trigger.payload -> reply.input

Common Gotchas

  • Message Content Intent: Discord requires the Message Content Intent to be enabled in the Developer Portal for bots to read message text.
  • Interactions vs. messages: INTERACTION_CREATE covers slash commands and component interactions. Use MESSAGE_CREATE for regular channel messages.
  • Public key verification: Requests without a valid Ed25519 signature are rejected. Ensure DISCORD_PUBLIC_KEY matches your application settings exactly.
  • Guild and channel filters: Use numeric Discord IDs, not names. Enable Developer Mode in Discord to copy IDs from the context menu.

See Also

On this page