The Pipedream Discord app enables you to build event-driven workflows that interact with the Discord API. When you authorize the Pipedream app's access to your guilds, you can use Pipedream workflows to perform common Discord actions, or write your own code against the Discord API.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
discord_bot: {
type: "app",
app: "discord_bot",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://discord.com/api/users/@me`,
headers: {
"Authorization": `Bot ${this.discord_bot.$auth.bot_token}`,
},
})
},
})
To use the Discord Bot integration, you'll need to create a Discord bot and add that bot to your server(s). Watch the 4 minute video below for a short tutorial:
bot
auth scopeNot sure if you need to use the Discord or the Discord Bot integration for your workflow? Here's are the general similarities and differences:
Discord and Discord Bot actions and triggers can both:
However the Discord integration will perform actions with the official Pipedream Discord bot.
Using the Discord Bot integration will use a custom bot instead, with it's own name and photo.
This event source emits events each time a new message is delivered to a Discord channel. By default, it emits an event for every message.
When you create this source, you'll be prompted to connect your Discord Bot token (press Connect Account and then New to add your token). The source will use that token to list the guilds / channels that bot has access to.
We use Discord's API to poll for new messages in this channel once a minute, by default, but you can increase this to run up to once every 15 seconds, if you'd like.
The first time this source runs, it fetches up to the last 100 messages sent to your channel and stores the ID of the last message delivered to that channel. The next time the source runs, it polls your channel for messages sent after that ID.
By default, this event source is configured to emit an event for every new message in the channel. For example, if 5 messages are sent to the channel in one minute, the source will emit 5 events, one for each message. You can set the source to batch the events the source collects and emit them as a single event by setting the Emit messages as a single event parameter to true
.
In this example, the source would emit a single event: an array of 5 messages.
If you've successfully authenticated your Discord Bot to Pipedream, but the incoming message data including content
, embeds
and attachments
are empty; then your bot needs to apply for access to this messaging data.
At the time of writing, Discord only requires bots in 100 or more servers to apply for this access.
You can request for this approval in the Discord Developer Portal.
Assign a role to a user. Remember that your bot requires the MANAGE_ROLES
permission. See the docs here
Create a new invite for the channel. See the docs here
Make sure your bot has the required privileges:
If you have issues with this integration, please join our public Slack and ask for help.
Right now, the Discord Bot integration cannot utilize the Discord Gateway to receive events via websockets or make API requests that require an initial connection to the gateway.
Please reach out if prevents you from building a workflow. We're happy to prioritize support for this in the future.
Discord Bot uses API keys for authentication. When you connect your Discord Bot account, Pipedream securely stores the keys so you can easily authenticate to Discord Bot APIs in both code and no-code steps.
This app allows you to use the Discord API using your own Discord bot. If you don't want to use a custom bot, and you just need to use the Discord API, exit this screen and use the Discord app, instead.
If you want to use your own Discord bot, but haven't created one yet, see these instructions or watch this video. You'll need to add this bot to your server(s) to make successful API requests.
Once you've created your bot, you'll find the Bot token within the Bot section of your app. Enter that token below.