Discord Bot
discord_bot · Nodes · Trigger · Trigger
Starts a workflow from Discord bot events.
Discord Bot#
Starts a workflow from Discord gateway events received through a discord_bot connection.
Slash commands arrive here over the Discord Gateway when the Discord application does not have an Interaction Endpoint URL configured. Discord sends interactions either to the gateway or to the configured HTTP endpoint, not both.
When to Use#
- React to Discord messages through a stateful bot
- React when a user adds an emoji reaction to one of the bot's messages
- Trigger slash-command workflows through the Discord gateway
- Feed gateway interaction data into
Discord Action - Avoid generic webhook interaction workflows when a gateway bot is enough
Configuration#
connection#
The discord_bot connection whose gateway events start the workflow. Add one under Settings → Connections; agents discover existing ones with list_connections and provider_name: "discord_bot", then pass the returned connection id.
The gateway intents come from the connection's intents property, set by editing the Discord Bot connection under Settings → Connections. Every trigger on the same connection shares one gateway session with those intents.
event_kind#
Choose which gateway event should start the workflow:
messageslash_commandreaction_add
command_name#
Optional slash-command filter.
- Ignored for
message - Ignored for
reaction_add - When set for
slash_command, only matching slash commands trigger the workflow
when_mentioned, when_replied_to, when_direct_message#
Optional checkboxes for message, all off by default. Ignored for slash_command and reaction_add.
when_mentioned(Bot mentioned): the message mentions the connection's bot user.when_replied_to(Replies to bot): the message is a reply to one of the bot's messages, whether or not the reply pings the bot. When Discord does not include the original message, for example because it was deleted, the reply's author is unknown and it does not count.when_direct_message(Direct message with bot): the message is in a direct message with the bot, mentioned or not.
With all three off, every message starts the workflow. With any on, a message starts it only when it meets at least one enabled condition. Unmatched messages start no run at all.
The conditions do not look at who sent the message, so the bot's own messages count too. With when_direct_message on, a workflow that answers in the DM is started again by its own answer; end that branch when {{ output.message.author.bot }} is true.
initial_presence#
Optional. Off by default. When on, sets the online status and activity the bot shows once this trigger installs:
status:online,idle,dnd(Do Not Disturb), orinvisibleactivity: tagged bykindnonecustomwithstate, a custom status messageplaying,listening,watching,competingwithnamestreamingwithnameandurl; the url must be a twitch.tv or youtube.com link
Activity text is plain text of at most 128 characters; templates are not rendered because the trigger installs with no input.
Presence belongs to the bot's gateway session, which runs only while a Discord listener on the connection keeps it open. It is kept across reconnects, cleared when the last listener goes away, and lost when Verdalia restarts. When several triggers on one connection set an initial presence, the most recently installed one wins, and saving a workflow reinstalls its trigger. To change presence from a workflow, use Discord Action with set_presence.
Output Contract#
The node emits one output object:
{
"event": "message",
"message": {
"id": "123",
"channel_id": "456",
"content": "hello",
"is_mentioned": true
},
"interaction": null,
"reaction": null
}
or:
{
"event": "slash_command",
"message": null,
"interaction": {
"id": "123",
"token": "interaction_token",
"command": { "name": "ping", "options": [] }
},
"reaction": null
}
or:
{
"event": "reaction_add",
"message": null,
"interaction": null,
"reaction": {
"user_id": "789",
"channel_id": "456",
"message_id": "123",
"guild_id": "321",
"message_author_id": "bot-user-id",
"emoji": { "id": null, "name": "👍", "animated": false },
"burst": false
}
}
Common Paths#
Message workflow#
Use:
{{ output.message.channel_id }}{{ output.message.id }}{{ output.message.content }}{{ output.message.is_mentioned }}{{ output.message.attachments }}
Video summary workflow#
For a Discord video attachment, fetch the attachment URL as binary, extract audio, then transcribe:
[Discord Bot event_kind=message]
↓ attachment url
[HTTP Request]
Response: auto
↓ { body: binary }
[Extract Audio]
↓ audio/ogg binary
[Transcribe Audio]
↓ text
[AI Agent]
↓ summary
[Discord Action]
Add Upload Media only when you want durable storage for the source video or extracted audio.
Slash-command workflow#
Use:
{{ output.interaction.id }}{{ output.interaction.token }}{{ output.interaction.command.name }}{{ output.interaction.command.options }}
Reaction workflow#
Use:
{{ output.reaction.user_id }}{{ output.reaction.channel_id }}{{ output.reaction.message_id }}{{ output.reaction.emoji.name }}{{ output.reaction.emoji.id }}
Example#
[Discord Bot event_kind=slash_command]
↓
[Discord Action credential_kind=connection op=respond_to_interaction]
Typical field mapping:
interaction_id:{{ output.interaction.id }}token:{{ output.interaction.token }}
Tips#
- Use
event_kindto keep one workflow focused on one Discord event type. - Each matching event starts one run, in the order Discord sent them, including events that arrive while earlier runs are still going.
- Use
command_namewhen you want one workflow per slash command. - The connection's bot token must belong to the same Discord application that owns the slash command.
- Manage slash commands from the Discord Bot connection's Commands action under Settings → Connections, then sync them to Discord.
- The gateway connection always includes
GUILDS, which Discord uses for application command events. reaction_addonly emits reactions from other users to messages authored by the connection's bot; the bot's own reactions are ignored.- Enable
GUILD_MESSAGE_REACTIONSfor guild reactions andDIRECT_MESSAGE_REACTIONSfor DM reactions in the connection'sintents. A connection with no intents usesGUILDS,GUILD_MESSAGES,GUILD_MESSAGE_REACTIONS,DIRECT_MESSAGES,DIRECT_MESSAGE_REACTIONS, andMESSAGE_CONTENT. - Message content needs
MESSAGE_CONTENTin the connection's intents and the Message Content privileged intent enabled for the application in Discord's developer portal. message.is_mentionedis true only when the connection's bot user appears in the message mentions list.- Use
when_mentioned,when_replied_to, andwhen_direct_messageinstead of anIforJsnode to ignore messages not addressed to the bot. Discord Actioncan use the samediscord_botconnection for outbound HTTP calls.
Inputs
None.
Outputs
output
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
connection | connection(discord_bot) | Yes | Discord bot connection whose gateway events start the workflow. Discover with list_connections provider_name=discord_bot. Gateway intents come from the connection's intents property. |
event_kind | enum(message, slash_command, reaction_add) | No | Discord gateway event kind to trigger on |
command_name | string | Yes | Optional slash-command name filter |
initial_presence | nullable<record> | No | Online status and activity the bot shows once this trigger installs. Presence lives only while a listener keeps the bot's gateway connected and resets after a restart; when several triggers on one connection set it, the most recently installed wins. Change it at run time with discord_action set_presence. |
when_mentioned | boolean | No | Trigger on messages that mention the bot. With all three message filters off, every message triggers; with any on, a message triggers when it meets at least one. |
when_replied_to | boolean | No | Trigger on replies to one of the bot's messages, pinged or not. A reply whose original message Discord did not include, such as a deleted one, does not count. |
when_direct_message | boolean | No | Trigger on every message in a direct message with the bot, mentioned or not. |
base_config | record | No | Shared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow). |