CONNECT APP
Build with Discord Bot
Communication
- API key
MCP
Give your agent Discord Bot tools
Every Discord Bot action is exposed as an MCP tool on Pipedream's remote server. Point a client at it with your end user's ID and Connect resolves that user's Discord Bot account for each tool call — you store no tokens.
// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "discord_bot",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// e.g. run Add Role:
const result = await mcp.callTool({
name: "discord_bot-add-role",
arguments: {
guildId: "Guild",
userId: "User",
},
})# access_token: mint a short-lived token with the Connect SDK — see the MCP guide
headers = {
"Authorization": f"Bearer {access_token}",
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", # any stable ID for this user in your system
"x-pd-app-slug": "discord_bot",
}
async with streamablehttp_client("https://remote.mcp.pipedream.net/v3", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
# e.g. run Add Role:
result = await session.call_tool("discord_bot-add-role", {
"guildId": "Guild",
"userId": "User",
})API PROXY
Call the Discord Bot API directly
For an endpoint with no pre-built tool, the Connect proxy forwards your request to the Discord Bot API with the connected user's credentials attached. You store no tokens and write no refresh logic.
const resp = await pd.proxy.get({
externalUserId: "{external_user_id}", // any stable ID for this user in your system
accountId: "apn_xxxxxxx",
url: "https://discord.com/api/users/@me",
})
// Any allowed Discord Bot endpoint works here. Pipedream attaches the
// connected account's credentials to the outgoing request.# The path segment is the target URL, URL-safe base64 encoded:
# https://discord.com/api/users/@me
curl "https://api.pipedream.com/v1/connect/{project_id}/proxy/aHR0cHM6Ly9kaXNjb3JkLmNvbS9hcGkvdXNlcnMvQG1l?external_user_id={external_user_id}&account_id=apn_xxxxxxx" \
-H "Authorization: Bearer {access_token}" \
-H "x-pd-environment: production"SDK
Run Discord Bot actions from your backend
Connect a user's Discord Bot account once, then run Add Role on their behalf from your own code — TypeScript, Python, or plain HTTP.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "discord_bot-add-role",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
discord_bot: { authProvisionId: "apn_xxxxxxx" },
guildId: "Guild",
userId: "User",
},
})from pipedream import Pipedream
pd = Pipedream(
client_id="{oauth_client_id}",
client_secret="{oauth_client_secret}",
project_id="{project_id}",
project_environment="production",
)
result = pd.actions.run(
id="discord_bot-add-role",
external_user_id="{external_user_id}", # any stable ID for this user in your system
configured_props={
"discord_bot": {"authProvisionId": "apn_xxxxxxx"},
"guildId": "Guild",
"userId": "User",
},
)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "discord_bot-add-role",
"configured_props": {
"discord_bot": { "authProvisionId": "apn_xxxxxxx" },
"guildId": "Guild",
"userId": "User"
}
}'TOOLS
Discord Bot actions
On-demand operations your product or agent can configure and run on behalf of a connected user.
-
Add Role
actionAssign a role to a user. Remember that your bot requires theMANAGE_ROLESpermission. See the docs hereWritev1.0.2 -
Change Nickname
actionModifies the nickname of the current user in a guild.Writev1.0.1 -
Create Channel Invite
actionCreate a new invite for the channel. See the docs hereWritev1.0.2 -
Create Guild Channel
actionCreate a new channel for the guild. See the docs hereWritev1.0.1 -
Delete Channel
actionDelete a Channel.Writev1.0.1 -
Delete message
actionDelete a message. See the docs hereWritev1.0.1 -
Find Channel
actionFind an existing channel by name. See the docs hereRead-onlyv1.0.1 -
Find User
actionFind an existing user by name. See the docs hereRead-onlyv1.0.1 -
Get message
actionReturn a specific message in a channel. See the docs hereWritev1.0.1 -
List Channel Invites
actionReturn a list of invitees for the channel. Only usable for guild channels.Read-onlyv1.0.2 -
List Channel Messages
actionReturn the messages for a channel. See the docs hereRead-onlyv1.0.1 -
List Channels
actionReturn a list of channels. See the docs hereRead-onlyv1.0.1 -
List Guild Members
actionReturn a list of guild members. See the docs hereRead-onlyv1.0.1 -
List Users that Reacted with Emoji
actionReturn a list of users that reacted with a specified emoji.Read-onlyv1.0.1 -
Modify Channel
actionUpdate a channel's settings. See the docs hereWritev1.0.1 -
Modify Guild Member
actionUpdate attributes of a guild member. See the docs hereWritev1.0.2 -
Post Reaction with Emoji
actionPost a reaction for a message with an emoji. See the docs hereWritev1.0.1 -
Remove User Role
actionRemove a selected role from the specified user. See the docs hereWritev1.0.1 -
Rename Channel
actionRename a channel to a specified name you chooseWritev1.0.1 -
Send message
actionSend message to a user or a channel. See the docs here and hereWritev1.0.1 -
Send Message to Forum Post
actionSend a message to a Discord forum. See the documentationWritev1.0.1 -
Send Message With File
actionPost a message with an attached file. See the docs hereWritev1.0.3
EVENTS
Discord Bot triggers
Event sources your backend can deploy for users and receive through a webhook.
-
New Message in Channel
triggerEmit new event for each message posted to one or more channelsv1.0.0 -
New Forum Thread Message
triggerEmit new event for each forum thread message posted. Note that your bot must have theMESSAGE_CONTENTprivilege intent to see the message content. See the documentation.v1.0.0 -
New Guild Member
triggerEmit new event for every member added to a guild. See docs herev1.0.0 -
New Tag Added to Forum Thread
triggerEmit new event when a new tag is added to a threadv1.0.0 -
New Thread Message
triggerEmit new event for each thread message posted.v1.0.0
MULTI-APP
Use Discord Bot with other popular apps
Most products don't stop at one integration. Pair Discord Bot with the other apps your users rely on, and ship use cases that span both.
- App slug
- discord_bot
- Authentication
- API key
- Categories
- Communication
- Actions
- 22
- Triggers
- 5
- API proxy
- Available