Discord

Learn how to use Discord with Composio

Overview

SLUG: DISCORD

Description

An instant messaging and VoIP social platform.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to identify,email,connections,guilds,guilds.join,guilds.members.read,messages.read,openid

Connecting to Discord

Create an auth config

Use the dashboard to create an auth config for the Discord toolkit. This allows you to connect multiple Discord accounts to Composio for agents to use.

1

Select App

Navigate to Discord.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Discord Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4discord_auth_config_id = "ac_YOUR_DISCORD_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Discord: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, discord_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Discord toolkit’s playground

For code examples, see the Tool calling guide and Provider examples.

Tool List

Tool Name: Get Current User Application Entitlements

Description

Tool to retrieve entitlements for the current user for a given application. Use when you need to check what premium offerings or subscriptions the authenticated user has access to.

Action Parameters

application_id
stringRequired
exclude_deleted
exclude_ended

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Guild Template

Description

Tool to retrieve information about a Discord guild template using its unique template code. Use when you need to get details about a guild template for creating new servers.

Action Parameters

code
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Guild Widget

Description

Tool to retrieve the guild widget in JSON format. Use when you need to get public information about a Discord guild's widget that can be displayed on external websites. The widget must be enabled in the guild's server settings.

Action Parameters

guild_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Guild Widget PNG

Description

Tool to retrieve a PNG image widget for a Discord guild. Use when you need a visual representation of the guild widget that can be displayed on external websites. The widget must be enabled in the guild's server settings.

Action Parameters

guild_id
stringRequired
style

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Invite

Description

Tool to retrieve information about a specific invite code. Use when you need to get details about a guild or channel associated with an invite.

Action Parameters

guild_scheduled_event_id
invite_code
stringRequired
with_counts
with_expiration

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get my guild member

Description

Retrieves the guild member object for the currently authenticated user within a specified guild, provided they are a member of that guild.

Action Parameters

guild_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get my OAuth2 authorization

Description

Retrieves current OAuth2 authorization details for the application, including app info, scopes, token expiration, and user data (contingent on scopes like 'identify').

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get my user

Description

Fetches comprehensive profile information for the currently authenticated Discord user, including email if the 'email' scope is granted.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get OpenID Connect userinfo

Description

Tool to retrieve OpenID Connect compliant user information for authenticated users. Use when you need standardized OIDC user claims following the OpenID Connect specification.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get Public Keys

Description

Tool to retrieve Discord OAuth2 public keys. Use when you need to verify OAuth2 tokens or access public keys for cryptographic operations.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Get User

Description

Tool to retrieve information about a Discord user by their user ID. Use when you need to get details about a specific user or the authenticated user (@me).

Action Parameters

user_id
stringRequired

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Resolve Invite

Description

Tool to resolve and retrieve information about a Discord invite code. Use when you need to get details about a guild, channel, or event associated with an invite code.

Action Parameters

code
stringRequired
guild_scheduled_event_id
with_counts
with_expiration

Action Response

data
objectRequired
error
successful
booleanRequired

Tool Name: Retrieve user connections

Description

Retrieves a list of the authenticated user's connected third-party accounts on Discord.

Action Parameters

Action Response

data
arrayRequired
error
successful
booleanRequired

Tool Name: List my guilds

Description

Lists the current user's guilds, returning partial data for each; primarily used for displaying server lists or verifying memberships.

Action Parameters

after
before
limit
with_counts

Action Response

data
arrayRequired
error
successful
booleanRequired

Tool Name: List Sticker Packs

Description

Tool to retrieve all available Discord Nitro sticker packs. Use when you need to list or browse official Discord sticker packs.

Action Parameters

Action Response

data
objectRequired
error
successful
booleanRequired