Start a workflow from Discord interactions
To run a workflow when someone uses one of your Discord app’s slash commands, presses a button in one of its messages, or submits one of its modals, add a Webhook block whose Source is Discord interactions and give its URL to the app as its Interactions Endpoint URL. Discord posts one request per interaction. Each request starts its own run.
This source receives interactions only. The webhook events Discord sends to an app, such as an authorization or a changed entitlement, go to a different URL setting in the Developer Portal and to a block of their own: start a workflow from Discord events. One block cannot serve both. Use one block and one URL for each kind.
Discord shows the reply to an interaction to the person who acted, and expects that reply within three seconds. A workflow cannot write it, because a run starts after the reply is sent. OutWin answers Discord at once, and you can set one fixed text for that answer on the block. What the workflow has to say comes afterward, from an HTTP request block.
The order of the steps matters. Discord tests the URL the moment you save it, and the block passes the test only when the app’s public key is saved. Save the key before you give Discord the URL.
You need a Discord app in the Discord Developer Portal whose settings you can open, edit access to the workflow’s project, and the member role or higher in the workspace to save the app’s key on a connection. OutWin does not create slash commands. You register each command with Discord yourself, through Discord’s API, before anyone can use it.
Add the Webhook block and generate its URL
Section titled “Add the Webhook block and generate its URL”- In a draft workflow, add a Webhook block. The block palette also lists Discord interactions webhook in the Start group, which adds the block with its source already set.
- Under Source, choose Discord interactions. The line under the setting reads “Verifies the signature · one run per event · skips duplicates”.
- Under Webhook URL, select Generate URL, then copy the URL. Do not paste it into Discord yet.
The badge beside the URL reads “Runs start after publish”. The URL contains a token, and anyone who has the URL can send requests to it. Keep it out of shared documents.
Save the Public Key on a connection
Section titled “Save the Public Key on a connection”Discord signs each request with a private key that belongs to the app, and publishes the matching Public Key. It is the key Discord signs the app’s webhook events with too. The key is the same for every request, so OutWin does not save it on the block. You save it once on an API connection, and each Webhook block that receives from the app chooses that connection. If a connection already holds the key for a Discord events block, choose that connection in step 4 and skip the first three steps.
- In the Discord Developer Portal, open your app and copy its public key. The block’s settings say it is on the app’s General Information page.
- In OutWin, open Connections. If the workspace has no API connection for Discord, add one. In Base URL, enter
https://discord.com/api/v10, the address of the Discord API that the workflow’s answer is sent to. Nothing is sent to it when interactions are received. Choose None under Authentication: the calls that answer an interaction need no credential. - On the connection’s page, under Receiving events, paste the key into the field that shows “Paste the signing secret” and select Save. The section then shows only a masked hint and the saved date, with Replace and Remove.
- In the block’s settings, under Connection that holds the public key, choose the connection. Each connection in the list is marked “secret saved” or “no secret yet”.
The line under the setting then starts “Verifying with the secret ending”, followed by the hint. Under Set up, the second line changes to “The public key is saved: deliveries are verified.”
In a workspace with no API connection, the setting shows “No API connections yet.” in place of the list, with an Add one link that opens Connections. If you choose a connection that has no key, the line reads “This connection has no public key yet.” with a Save it on the connection link to its page.
A public key is not a secret. OutWin stores it the same way as one, and shows only a masked hint after you save it.
Give the URL to your Discord app
Section titled “Give the URL to your Discord app”- In the Developer Portal, open your app’s General Information page.
- Paste the URL you copied into Interactions Endpoint URL, and save.
The field is not the endpoint on the app’s Webhooks page. That one carries webhook events.
When you save, Discord tests the URL in two ways. It sends a signed ping, which the block answers. Recent deliveries lists it as Handshake with “Discord confirmed the URL.”, and the last line under Set up reads the same. Discord also sends requests with a wrong signature on purpose, to see that the URL turns them away. Each of those is listed as Refused with “The signature did not match. Check that the secret saved here is the one the sender shows for this URL.” Discord’s documentation says it repeats this test from time to time. A Refused line beside interactions that ran is the block passing the test, and needs no action. While such a line is the newest, the last line under Set up starts “The last delivery was refused.”
A block with no key cannot turn a wrong signature away: it has nothing to check with. Discord’s documentation says that it removes an interactions URL that fails the test, and that the app’s owner then gets an email and a system message. A Discord block therefore does not work unverified.
Set what the person sees at once
Section titled “Set what the person sees at once”The Reply setting holds the one text OutWin answers Discord with. The field shows “Got it, working on it.” as a placeholder and takes up to 2,000 characters.
| Reply | The interaction | What the person sees |
|---|---|---|
| Empty | A slash command | A loading state, until the workflow edits the reply. The workflow has 15 minutes. |
| Empty | A button, a menu, or a submitted modal | Nothing. |
| A text | Any of the above | The text, shown to the person who acted and to nobody else. |
| Either | Autocomplete, which Discord sends while someone types a command’s option | No suggestions. It starts no run. |
The table holds for an interaction that is queued to run. When nothing will run, the text is not sent: a slash command is answered “This command is not running right now.”, and a button, a menu, or a submitted modal shows nothing. That is the case on a draft, on a paused workflow, for an interaction the filter turns away, for a duplicate, and when too many events are already waiting. Discord has no reply to a command that shows nothing, and a loading state that no run ends would mislead.
The text is the same for every interaction the block receives. It takes no expressions, so it cannot repeat what the person entered or say what the workflow found. Every reply, the loading state included, is visible to that one person only, and a mention in the text, such as @everyone, notifies nobody. There is no setting that posts the reply to the whole channel.
The lines under the field read “Discord shows this text to the person who used the command or the button, and to no one else. It is the same every time, and is sent only when the event is queued to run: not on a draft, a paused workflow, or an event the filter turns away.” and “Left empty, a command shows that the app is thinking until the workflow edits the reply, which it has 15 minutes to do. A button or a form shows nothing. When nothing will run, a command is answered "This command is not running right now."”
Credits and the subscription are checked later, when the run starts. A workspace that is out of credits is therefore found after the reply: the person sees the text, or the loading state, and no run follows.
Choose which interactions start a run
Section titled “Choose which interactions start a run”The event type of this source is the name of the command, or the custom_id your app gave the button, the menu, or the modal. A command’s name has no slash: /deploy arrives as deploy. The block does not know your app’s commands and ids, so Events that start a run offers none to tick. The line under it reads “Every event starts a run. Tick some to run only for those.”
To start runs for some of them only, type each name or custom_id into the box that shows “Another event type” and select Add. Each one you add is ticked. An interaction that is not ticked is then listed as Filtered out and starts no run. If it is a slash command, the person sees “This command is not running right now.”
To narrow further by a field of the interaction, select Add a condition under Only when. The field body.guild_id holds the server, and body.channel_id the channel. Webhook settings lists the comparisons.
Send a test and check what arrived
Section titled “Send a test and check what arrived”- In Discord, use one of the app’s slash commands in a server the app is installed in.
- In OutWin, look under Recent deliveries in the block’s settings.
Recent deliveries lists every interaction that reached the URL, including while the workflow is a draft. On a draft each interaction is listed as Dropped with “The workflow is not published, so nothing ran.” It starts no run and is not run later, and a slash command is answered “This command is not running right now.” The last line under Set up then reads, for example, “Received deploy. Dropped.”
With a key saved on the chosen connection, an interaction listed as Dropped on a draft has passed the signature check.
If you have edit access, select an interaction to see what the block passed on. The list is kept for seven days, and the data of the newest 20 events is kept.
Read the interaction in the next block
Section titled “Read the interaction in the next block”Each run receives one interaction. An HTTP request block or a database block directly after the Webhook block reads it with these expressions. An AI block such as Think receives the whole value as its input.
| Expression | What it holds |
|---|---|
{{input.body}} |
The interaction as Discord sent it, with fields such as id, application_id, type, data, token, channel_id, and guild_id. |
{{input.body.type}} |
The kind of interaction as a number: 2 for a command, 3 for a button or a menu, and 5 for a submitted modal. |
{{input.body.data.name}} |
The command’s name. {{input.body.data.options}} holds what the person entered for its options. |
{{input.body.data.custom_id}} |
The id your app gave the button, the menu, or the modal. |
{{input.body.member.user.id}} |
The id of the person who acted, in a server. In a direct message it is {{input.body.user.id}}. |
{{input.body.application_id}} |
The app’s id. The workflow’s answer needs it. |
{{input.body.token}} |
The interaction’s token. The workflow’s answer needs it, and it works for 15 minutes. |
{{input.event.type}} |
The command’s name, or the custom_id of a button, a menu, or a modal. |
{{input.event.id}} |
The interaction’s id. It is the body’s id field. |
{{input.delivery.verified}} |
true only when the signature was checked and passed. |
A block further along reads the same values through the Webhook block’s name, as in {{steps["Discord interactions"].body.token}} for a block named Discord interactions. Data and context describes what each block passes on.
Whoever holds the token can answer the interaction until it expires. It is part of what the block passes on, so it can be read in Recent deliveries and in the run.
Answer from the workflow
Section titled “Answer from the workflow”The workflow answers through Discord’s API, at an address made of the app’s id and the interaction’s token. Both arrive in the event. The token is the credential, so the connection needs none.
- After the blocks that do the work, add an HTTP request block and choose the Discord connection, with the base URL
https://discord.com/api/v10and None under Authentication. A connection with no base URL is not in the block’s list, and its page reads “None. This connection only receives events.” In that case, first set Base URL tohttps://discord.com/api/v10under Settings on the connection’s page and select Save changes, leaving Authentication as None. The Public Key under Receiving events is not affected. Then choose the connection in the block. - Under Request, choose the method and enter the path from the table.
- Under Body, choose JSON and enter the message.
| To | Method | Path |
|---|---|---|
| Replace the loading state, or the Reply text, with the workflow’s answer | PATCH |
/webhooks/{{steps["Discord interactions"].body.application_id}}/{{steps["Discord interactions"].body.token}}/messages/@original |
| Send a further message | POST |
/webhooks/{{steps["Discord interactions"].body.application_id}}/{{steps["Discord interactions"].body.token}} |
This body holds the answer:
{ "content": "The deploy has finished."}An edited reply stays visible to the one person only. Discord does not let a later call change that. A further message goes to the channel unless its body also holds "flags": 64, which makes it visible to that person alone.
Both calls work for 15 minutes from the interaction. After that Discord turns them down, and the block fails with <name> answered <status>., where <name> is the connection’s name. A run that waited for a free slot can reach the block too late. A slash command answered with the loading state needs the PATCH call within that time: nothing else replaces the loading state.
Publish and check the runs
Section titled “Publish and check the runs”Publish the workflow. From then on, each interaction that passes the filter starts a run. On a published workflow the block’s settings are read-only, including Reply and the choice of connection, and Recent deliveries is in the block’s inspector. You can still replace the key on the connection’s page.
| Outcome | What happened |
|---|---|
| Ran | The interaction started a run. |
| Waiting | 10 runs of the workflow are already active. The interaction starts a run when one of them ends. An interaction that waits longer than an hour is listed as Dropped. |
| Duplicate | An interaction with the same id already ran in the last 72 hours. The line reads “This event was already received and run, so it did not run again.” |
| Handshake | Discord’s ping when the URL was saved. It starts no run. |
| Ping | An autocomplete request. The line reads “A ping from the sender, not an event. Nothing ran.” |
| Refused | A request whose signature did not pass, including the ones Discord sends on purpose. It starts no run. |
Receiving an interaction costs no credits, and neither does one that is filtered out, a duplicate, a handshake, or an autocomplete request. A run that starts uses credits for the blocks that run in it.
If nothing runs
Section titled “If nothing runs”Open Recent deliveries and read the outcome and the sentence beside the newest interaction.
| What you see | Cause | Fix |
|---|---|---|
| “Nothing has arrived yet.” | No request has reached the URL, not even the ping. | Check that Interactions Endpoint URL on the app’s General Information page is the block’s current URL, and save it there again. The endpoint on the Webhooks page is a different setting. Rotate token on a published workflow changes the URL, and the old one stops working. |
| Discord does not accept the URL, and the block has no connection chosen or a connection with no key | The block answered Discord’s wrong signatures as if they were good, so the URL failed Discord’s test. | Save the public key on the connection, choose the connection in the block’s settings, then save the URL in Discord again. |
| Every line is Refused with “The signature did not match. Check that the secret saved here is the one the sender shows for this URL.”, and Discord does not accept the URL | The key on the chosen connection is not this app’s public key. This can happen when the block chose another service’s connection or when the key was copied from another app. | Copy the public key from the app again and select Replace under Receiving events on the connection’s page. You do not republish the workflow. Then save the URL in Discord again. |
| Refused with “The saved secret could not be used as this sender’s key. Save it again exactly as the sender shows it.” | The saved text is not a Discord public key, which is 64 characters of the digits 0 to 9 and the letters a to f. | Copy the public key again and select Replace under Receiving events. |
| Handshake and Refused lines and nothing else | Discord accepted the URL, and nobody has used a command or a button since. | Check that the command is registered with Discord and that the app is installed where you use it, then use the command again. |
| Dropped with “The workflow is not published, so nothing ran.” | The workflow is a draft. A slash command is answered “This command is not running right now.” | Publish the workflow. Interactions that arrived before then are not run later. |
| Dropped with “The workflow is paused, so nothing ran.” | The workflow is paused. | Resume the workflow. Interactions that arrived while it was paused are not run later. |
Filtered out with Events of type "status" are not chosen on this trigger. |
The command’s name or the custom_id is not ticked under Events that start a run, or a command was added there with a slash. |
Add the name without a slash, or clear every tick so that all interactions start a run. The settings are read-only on a published workflow. |
| Ran, and the loading state stays in Discord | No HTTP request block edited the reply, or the block reached Discord after the token’s 15 minutes. When the run could not start for lack of credits, the line is Dropped with “The workspace is out of credits, so nothing ran.” and the loading state stays as well. | Open the run and read the HTTP request block’s message. Check its path against the table under Answer from the workflow. |
| Refused with “The request carried no signature.” | A key is saved on the chosen connection, and the request did not carry Discord’s signature. A request sent by hand to try the URL has none. | Use the command in Discord so that Discord sends the request. |
A delivery listed as Refused is answered with status 401 and starts nothing. OutWin keeps none of its data. For every other outcome in the table, Discord receives status 200 with the reply described under Set what the person sees at once, and OutWin does not run the interaction later.