> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Discord Actions integration

[Back to list of integrations](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)

Use the Discord integration to let agents post messages, request approvals, and manage guild channels, roles, and members through Action Tools.

| Authentication | Actions | Workflow triggers |
| - | - | - |
| OAuth 2.0, API Key | [16](#supported-actions) | [2](#workflow-triggers) |

## Supported actions

Actions are Discord operations that an agent runs as Action Tools during a conversation. You can also run them from an [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node) in a workflow.

| Action | Use it to |
| - | - |
| [Send Message with Bot](#send-message-with-bot) | Post a message, with optional attachments, to a channel or thread as your bot. |
| [Send Message Webhook](#send-message-webhook) | Post a message through a channel webhook. |
| [Request Approval in a Channel](#request-approval-in-a-channel) | Post an approval request and wait for a response. |
| [Find channel](#find-channel) | Find a channel by name. |
| [Create channel](#create-channel) | Create a channel in a guild. |
| [Rename channel](#rename-channel) | Rename a channel. |
| [Delete channel](#delete-channel) | Delete a channel. |
| [List guild members](#list-guild-members) | List or search the members of a guild. |
| [Add role to member](#add-role-to-member) | Assign a role to a member. |
| [Remove role from member](#remove-role-from-member) | Remove a role from a member. |
| [Create guild role](#create-guild-role) | Create a role in a guild. |
| [Delete guild role](#delete-guild-role) | Delete a role from a guild. |
| [Remove member from guild](#remove-member-from-guild) | Remove (kick) a member from a guild. |
| [Ban guild member](#ban-guild-member) | Ban a member from a guild. |
| [Remove ban from user](#remove-ban-from-user) | Lift a ban on a user. |
| [Custom API Call](#custom-api-call) | Call any Discord API endpoint the other actions don't cover. |

## Workflow triggers

Triggers are Discord events that start a workflow automatically. Select them as [app triggers](https://koreai.mintlify.site/agent-platform/workflows.md#app-triggers) when you configure a workflow.

| Trigger | Fires when |
| - | - |
| New message | A message is sent in a channel. |
| New Member | A new member joins a guild. |

## Prerequisites

* A Discord application with a bot user in the [Developer Portal](https://discord.com/developers/applications), invited to your guild with the permissions your actions need.
* The bot role ranked above any role the agent manages.

## Set up the integration

**1. Prepare the Discord app**

Copy the **Client ID** and **Client Secret** from **OAuth2** (for OAuth 2.0), or the bot **Token** from **Bot** (for API Key).

**2. Create the auth profile**

In **Integrations**, select **Discord** > **Connect**. On **Project Auth Profiles**, select **New Profile** > **Integration Profile** > **Discord** > **Continue**. Configure the fields, select **Create Profile**, and for OAuth 2.0 select **Authorize**.

> [tab] OAuth 2.0
>
> Artemis pre-fills the Discord authorization, token, and refresh URLs. Enter **Scopes** (for example `bot guilds`), **Client ID**, and **Client Secret**, and add the read-only **Callback URL** under **OAuth2** > **Redirects** in the Developer Portal.
>
> **Usage Mode**: **Preconfigured** shares one authorization across users; **JIT** and **Preflight** ask each user to authorize, during or before the session. See [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles).

> [tab] API Key
>
> Set **Header Name** to `Authorization` (default `X-API-Key`), **Prefix** to `Bot ` (with a trailing space), and **API Key** to the bot token.

**3. Create the action tool**

In **Tools**, select **New Tool** > **Action** > **Discord** > **Continue**. Select the **Action** and **Auth Profile**, set parameter defaults (leave a value empty for the agent to supply at runtime), and select **Create Tool**. Then [assign the tool to an agent](https://koreai.mintlify.site/agent-platform/tools/actions.md#assign-an-action-to-an-agent).

## Action reference

> [accordion] Send Message with Bot
>
> | Parameter | Type | Description |
> | - | - | - |
> | `channel_id` | enum | Channel or thread to post to. |
> | `message` | string | Message content. |
> | `files` | array | Optional attachments. |

> [accordion] Send Message Webhook
>
> | Parameter | Type | Description |
> | - | - | - |
> | `webhook_url` | string | Channel webhook URL. |
> | `username` | string | Display name for the message. |
> | `content` | string | Message content. |
> | `avatar_url` | string | Avatar URL for the webhook. |
> | `embeds` | object | Embeds to send with the message. |
> | `tts` | boolean | Reads the message aloud with text-to-speech. |

> [accordion] Request Approval in a Channel
>
> Posts the request and pauses the tool until a user approves or rejects it.
>
> | Parameter | Type | Description |
> | - | - | - |
> | `content` | string | Approval request text. |
> | `channel` | enum | Channel to post to. |

> [accordion] Find channel
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild to search. |
> | `name` | string | Channel name. |

> [accordion] Create channel
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild to create the channel in. |
> | `name` | string | Name of the new channel. |

> [accordion] Rename channel
>
> | Parameter | Type | Description |
> | - | - | - |
> | `channel_id` | enum | Channel to rename. |
> | `name` | string | New channel name. |

> [accordion] Delete channel
>
> | Parameter | Type | Description |
> | - | - | - |
> | `channel_id` | enum | Channel to delete. |

> [accordion] List guild members
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild to list. |
> | `shortText` | string | Search text for member names. |

> [accordion] Add role to member
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `user_id` | string | User ID of the member. |
> | `role_id` | enum | Role to add. |

> [accordion] Remove role from member
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `user_id` | string | User ID of the member. |
> | `role_id` | enum | Role to remove. |

> [accordion] Create guild role
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `role_name` | string | Role name. |
> | `role_color` | string | RGB color of the role. |
> | `display_separated` | boolean | Shows the role separately in the member sidebar. |
> | `role_mentionable` | boolean | Lets other users mention the role. |
> | `creation_reason` | string | Reason recorded in the audit log. |

> [accordion] Delete guild role
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `role_id` | enum | Role to delete. |
> | `deletion_reason` | string | Reason recorded in the audit log. |

> [accordion] Remove member from guild
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `user_id` | string | User ID of the member. |

> [accordion] Ban guild member
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `user_id` | string | User ID of the member. |
> | `ban_reason` | string | Reason recorded in the audit log. |

> [accordion] Remove ban from user
>
> | Parameter | Type | Description |
> | - | - | - |
> | `guild_id` | enum | Guild. |
> | `user_id` | string | User ID. |
> | `unban_reason` | string | Reason recorded in the audit log. |

> [accordion] Custom API Call
>
> Sends a request to any Discord API endpoint. Artemis injects the authorization header from the auth profile.
>
> | Parameter | Type | Description |
> | - | - | - |
> | `url` | object | Endpoint URL. |
> | `method` | enum | HTTP method. |
> | `headers` | object | Additional request headers. |
> | `queryParams` | object | Query parameters. |
> | `body_type` | enum | Body type. Default: `None`. |
> | `body` | object | Request body. |
> | `response_is_binary` | boolean | Turn on for binary responses, such as PDFs or images. Default: `False`. |
> | `failsafe` | boolean | Returns no error when the call fails. |
> | `timeout` | number | Timeout, in seconds. |
> | `followRedirects` | boolean | Follows HTTP redirects. Default: `False`. |

> [!WARNING]
>
> **Delete channel**, **Delete guild role**, **Remove member from guild**, and **Ban guild member** are irreversible. Assign them only to agents that need them.

## Troubleshoot common issues

| Issue | Resolution |
| - | - |
| Authorization fails or doesn't complete | Verify that the **Callback URL** in the profile exactly matches a redirect in the Discord Developer Portal. |
| Channel, guild, or role lists are empty | Confirm the bot is a member of the guild and can view the channels. |
| `401 Unauthorized` with an **API Key** profile | Confirm **Header Name** is `Authorization` and **Prefix** is `Bot `, and that the bot token is current. |
| `50013 Missing Permissions` | Grant the bot the required permission, and move the bot role above the roles it manages. |
| Webhook messages fail | Confirm the webhook still exists in the channel settings and the URL is complete. |

**Related articles:**

* [Enterprise systems integrations](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)
* [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles)
* [Action Tools](https://koreai.mintlify.site/agent-platform/tools/actions.md)
* [Integration node](https://koreai.mintlify.site/agent-platform/workflows.md#integration-node)
* [Discord developer documentation](https://discord.com/developers/docs/intro)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.