Skip to content

Start a workflow from Discord events

To run a workflow when Discord reports that someone authorized your app, or that an entitlement was created or changed, add a Webhook block whose Source is Discord and give its URL to your Discord app as its webhook events URL. Discord posts one event per request. Each event starts its own run.

This source receives the webhook events Discord sends to an app. Messages posted in a server’s channels are not among them. Discord’s interactions endpoint, which carries slash commands and button presses, is a different URL setting at Discord and does not work with a block whose Source is Discord. It has its own source, Discord interactions, on a separate Webhook block with its own URL. One block cannot serve both URLs. See Start a workflow from Discord interactions. Both sources use the same Public Key, so one connection serves both blocks.

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. The Discord steps happen in the Developer Portal.

Add the Webhook block and generate its URL

Section titled “Add the Webhook block and generate its URL”
  1. In a draft workflow, add a Webhook block. The block palette also lists Discord webhook in the Start group, which adds the block with its source already set.
  2. Under Source, choose Discord. The line under the setting reads “Verifies the signature · one run per event · skips duplicates”.
  3. 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.

Discord signs each request with a private key that belongs to the app, and publishes the matching Public Key. The key is the same for every request the app’s events arrive in, 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.

  1. 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.
  2. In OutWin, open Connections. If the workspace has no API connection for Discord, add one. In the dialog, leave Base URL empty and set Authentication to None. The connection then only receives events. If your workflows also call the Discord API, enter its base URL and credential instead, or add them later on the connection’s page. This guide does not need them.
  3. 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.
  4. 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.

  1. In your app’s settings in the Developer Portal, open the Webhooks page.
  2. Under Endpoint, paste the URL you copied.
  3. Turn on the toggle in the Events section, and select the events you want.
  4. Select Save Changes.

When you save, Discord tests the URL in two ways. It sends a signed ping, which the block answers. Recent deliveries lists it as Ping with “A ping from the sender, not an event. Nothing ran.” 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 events 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 a webhook events 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.

The Webhook block offers these Discord event types: APPLICATION_AUTHORIZED, APPLICATION_DEAUTHORIZED, ENTITLEMENT_CREATE, ENTITLEMENT_UPDATE, ENTITLEMENT_DELETE, LOBBY_MESSAGE_CREATE, LOBBY_MESSAGE_UPDATE, LOBBY_MESSAGE_DELETE, GAME_DIRECT_MESSAGE_CREATE, GAME_DIRECT_MESSAGE_UPDATE, and GAME_DIRECT_MESSAGE_DELETE.

Under Events that start a run, tick the event types that start a run. With none ticked, every event Discord sends starts a run. To start runs for a type that is not listed, type it into the box under the list and select Add.

An event whose type is not ticked is listed as Filtered out and starts no run. To narrow further by a field of the event, add a row under Only when. Discord wraps each event, so a field of the event itself has a path that starts with body.event.data, such as body.event.data.user.id. Webhook settings lists the comparisons.

  1. In Discord, do something that causes one of the selected events, such as authorizing the app for a test account.
  2. In OutWin, look under Recent deliveries in the block’s settings.

Recent deliveries lists every event that reached the URL, including while the workflow is a draft. On a draft each event is listed as Dropped with “The workflow is not published, so nothing ran.” It starts no run and is not run later. The last line under Set up then reads, for example, “Received APPLICATION_AUTHORIZED. Dropped.”

With a key saved on the chosen connection, an event listed as Dropped on a draft has passed the signature check.

If you have edit access, select an event to see what the block passed on. The list is kept for seven days, and the data of the newest 20 events is kept.

Each run receives one Discord request. Discord wraps the event: the body holds the request’s own fields, and the event itself is one level down, at body.event. 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 request as Discord sent it, with the fields version, application_id, type, and event.
{{input.body.event.data}} The event’s data. Its fields depend on the event type.
{{input.body.event.data.user.id}} One field of the data: the id of the person who authorized the app, in an APPLICATION_AUTHORIZED event. Read any other field the same way.
{{input.event.type}} The event’s type, such as APPLICATION_AUTHORIZED. It is the type field of body.event, not of the body.
{{input.event.id}} A value OutWin builds, because Discord sends no id for an event. It joins the event’s type, its time, and the ids of what and whom the event is about.
{{input.event.time}} The event’s time as an ISO 8601 date and time. Discord sends it in body.event.timestamp with no time zone, and OutWin reads it as UTC.
{{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"].body.event.data.user.id}} for a block named Discord. Data and context describes what each block passes on.

Publish the workflow. From then on, each event that passes the filter starts a run. On a published workflow the block’s settings are read-only, including 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 event started a run.
Waiting 10 runs of the workflow are already active. The event starts a run when one of them ends. An event that waits longer than an hour is listed as Dropped.
Duplicate An event with the same type, time, and subject already ran in the last 72 hours. The line reads “This event was already received and run, so it did not run again.”
Ping Discord’s ping when the URL was saved. It starts no run.
Refused A request whose signature did not pass, including the ones Discord sends on purpose. It starts no run.

Runs start in the order events arrive. That is not always the order things happened, so do not build a workflow that relies on ENTITLEMENT_CREATE arriving before ENTITLEMENT_UPDATE.

Receiving an event costs no credits, and neither does an event that is filtered out, a duplicate, or a ping. A run that starts uses credits for the blocks that run in it.

Open Recent deliveries and read the outcome and the sentence beside the newest event.

What you see Cause Fix
“Nothing has arrived yet.” No request has reached the URL, not even the ping. Check that the URL under Endpoint on the app’s Webhooks page is the block’s current URL, and save it there again. 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.
Ping and Refused lines and nothing else Discord accepted the URL, and no selected event has happened since. Check that the toggle in the Events section is on and that the event you caused is selected, and cause it again.
Dropped with “The workflow is not published, so nothing ran.” The workflow is a draft. Publish the workflow. Events that arrived before then are not run later.
Dropped with “The workflow is paused, so nothing ran.” The workflow is paused. Resume the workflow. Events that arrived while it was paused are not run later.
Filtered out with Events of type "ENTITLEMENT_UPDATE" are not chosen on this trigger. The event’s type is not ticked under Events that start a run. Tick the type, or clear every tick so that all events start a run. The settings are read-only on a published 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. Cause the event 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 a success response with status 204 and OutWin does not run the event later.