> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/human-connections/discord/discord.md).

# Discord

<p align="center"><a class="button primary" data-icon="circle-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

<figure><img src="/files/2iT5E4NjemnjxJIzrSJC" alt="" width="375"><figcaption></figcaption></figure>

<h3 align="center">Put Discord to Work with @Human Automations and @Human Agents</h3>

<p align="center">The Discord Connection documents all Triggers, Actions and Query Operations available for creating automations via the Discord API.</p>

{% embed url="<https://www.youtube.com/watch?v=CyuUuaBSZzA>" %}

#### What can you do with the Discord Connection?

* Connect to the Discord API in a few clicks
* Use the related Discord Operations (see below) in @Human Automations or @Human Agents

### Related Operations

#### Trigger Operations

**Server Updated**

Triggers on: servers/server\_updated

Triggered when a server's settings, including name or icon, are updated.

**Member Joined**

Triggers on: servers/member\_added

Triggered when a new member joins a server.

**Member Left**

Triggers on: servers/member\_removed

Triggered when a member leaves a server or is removed.

**Channel Created**

Triggers on: channels/channel\_created

Triggered when a new channel is created within a server.

**Channel Deleted**

Triggers on: channels/channel\_deleted

Triggered when an existing channel is deleted.

**Message Created**

Triggers on: messages/message\_created

Triggered when a new message is sent in a channel.

**Message Updated**

Triggers on: messages/message\_updated

Triggered when an existing message is edited.

**Message Deleted**

Triggers on: messages/message\_deleted

Triggered when a message is deleted from a channel.

#### Action Operations

[Action: Add Role](/human-connections/discord/discord/action-add-role.md)

[Action: Remove User Role](/human-connections/discord/discord/action-remove-user-role.md)

[Action: Send Channel Message](/human-connections/discord/discord/action-send-channel-message.md)

[Action: Send message in Forum Post](/human-connections/discord/discord/action-send-message-in-forum-post.md)

#### Query Operations

Example link

### Related Automations

Example link

### Obtaining Access Credentials

1. **Log in** to the [Discord Developer Portal](https://discord.com/developers/applications) and select your application.
2. **Navigate to the "Bot"** page in the left sidebar.
3. **Reset and Copy your Bot Token** by clicking the **"Reset Token"** button (this is your permanent access credential).
4. **Ensure "Public Bot" is disabled** if you only want this bot for your own server.
5. **Add the Bot to your server** via the **OAuth2 URL Generator** with the required scopes (e.g., `bot`, `applications.commands`).

### Configuring Webhooks

1. **Log in** to your [Discord Developer Portal](https://discord.com/developers/applications) and select your application.
2. **Navigate to "Settings" → "Webhook Events"** in the left sidebar.
3. **Enter the Webhook URL** provided by your integration into the **Endpoint** field.
4. **Enable Events** by clicking the toggle in the Events section.
5. **Select the specific events** you wish to receive (e.g., `APPLICATION_AUTHORIZED`, `ENTITLEMENT_CREATE`) and click **Save Changes**.
6. **Navigate to the "General Information"** page and enter the same URL into the **Interactions Endpoint URL** field to receive slash commands and component interactions.
7. **Navigate to the "Bot" page** settings in the left sidebar.
8. **Enable Privileged Gateway Intents** by toggling **"Server Members Intent"** and **"Message Content Intent"** to ensure all server-level events are captured.
9. **Click "Save Changes"** to activate the configuration.

### Code (Apache v2.0): Service Connectivity and Metadata

```
{
  "handle": "discord",
  "status": "active",
  "meta": {
    "short": "Discord",
    "description": "Connect to Discord's API for managing servers, channels, and messages.",
    "icon": "discord",
    "tags": ["communication", "messaging", "api"]
  },
  "service": {
    "baseURL": {
      "value": "https://discord.com/api/v10"
    },
    "protocol": "https",
    "contentType": "application/json",
    "headers": {
      "Authorization": {
        "value": "Bot {{token}}"
      },
      "User-Agent": {
        "value": "DiscordBot (https://example.com, v1.0)"
      }
    },
    "auth": {
      "method": "api_token",
      "params": {
        "apiToken": {
          "token": {
            "value": "{{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "headerName": {
            "value": "Authorization"
          }
        }
      }
    }
  }
}

```

### Code (Apache v2.0): List of External Resources and Internal Mapping

```
[
  {
    "handle": "servers",
    "meta": {
      "short": "Servers",
      "description": "Manage Discord servers (guilds) including creation, updates, and deletions."
    },
    "endpoint": {
      "value": "/guilds",
      "placeholders": []
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": {
          "description": "The unique identifier for the server."
        }
      },
      {
        "name": "name",
        "type": "String",
        "selector": ["name"],
        "meta": {
          "description": "The name of the server."
        }
      },
      {
        "name": "icon",
        "type": "String",
        "selector": ["icon"],
        "meta": {
          "description": "The icon hash of the server."
        }
      },
      {
        "name": "owner_id",
        "type": "String",
        "selector": ["owner_id"],
        "meta": {
          "description": "The ID of the server owner."
        }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "create": {
        "method": "POST",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"name\": \"{{name}}\", \"region\": \"{{region}}\"}",
          "placeholders": [
            {
              "name": "name",
              "type": "String",
              "description": "Name of the server",
              "required": true
            },
            {
              "name": "region",
              "type": "String",
              "description": "Region of the server",
              "required": true
            }
          ]
        }
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Server ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "update": {
        "method": "PATCH",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Server ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"name\": \"{{name}}\"}",
          "placeholders": [
            {
              "name": "name",
              "type": "String",
              "description": "New name of the server",
              "required": false
            }
          ]
        }
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Server ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "server_updated",
        "path": "/webhooks/discord/server_updated",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the server." } },
          { "name": "name", "type": "String", "selector": ["name"], "meta": { "description": "The name of the server." } },
          { "name": "description", "type": "String", "selector": ["description"], "meta": { "description": "The description of the server." } },
          { "name": "owner_id", "type": "String", "selector": ["owner_id"], "meta": { "description": "The ID of the server owner." } }
        ]
      },
      {
        "event": "member_added",
        "path": "/webhooks/discord/member_added",
        "payload": [
          { "name": "guild_id", "type": "String", "selector": ["guild_id"], "meta": { "description": "The ID of the server." } },
          { "name": "user_id", "type": "String", "selector": ["user", "id"], "meta": { "description": "The ID of the member." } },
          { "name": "username", "type": "String", "selector": ["user", "username"], "meta": { "description": "The username of the member." } },
          { "name": "joined_at", "type": "String", "selector": ["joined_at"], "meta": { "description": "The timestamp when the member joined." } }
        ]
      },
      {
        "event": "member_removed",
        "path": "/webhooks/discord/member_removed",
        "payload": [
          { "name": "guild_id", "type": "String", "selector": ["guild_id"], "meta": { "description": "The ID of the server." } },
          { "name": "user_id", "type": "String", "selector": ["user", "id"], "meta": { "description": "The ID of the member." } },
          { "name": "username", "type": "String", "selector": ["user", "username"], "meta": { "description": "The username of the member." } }
        ]
      }
    ]
  },
  {
    "handle": "channels",
    "meta": {
      "short": "Channels",
      "description": "Manage Discord channels within servers, including text and voice channels."
    },
    "endpoint": {
      "value": "/guilds/{{guild_id}}/channels",
      "placeholders": [
        {
          "name": "guild_id",
          "type": "String",
          "description": "ID of the server",
          "required": true
        }
      ]
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": {
          "description": "The unique identifier for the channel."
        }
      },
      {
        "name": "name",
        "type": "String",
        "selector": ["name"],
        "meta": {
          "description": "The name of the channel."
        }
      },
      {
        "name": "type",
        "type": "Integer",
        "selector": ["type"],
        "meta": {
          "description": "The type of channel (e.g., 0 for text, 2 for voice)."
        }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "create": {
        "method": "POST",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"name\": \"{{name}}\", \"type\": {{type}}}",
          "placeholders": [
            {
              "name": "name",
              "type": "String",
              "description": "Name of the channel",
              "required": true
            },
            {
              "name": "type",
              "type": "Integer",
              "description": "Type of channel (0 for text, 2 for voice)",
              "required": true
            }
          ]
        }
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Channel ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "update": {
        "method": "PATCH",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Channel ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"name\": \"{{name}}\"}",
          "placeholders": [
            {
              "name": "name",
              "type": "String",
              "description": "New name of the channel",
              "required": false
            }
          ]
        }
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Channel ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "channel_created",
        "path": "/webhooks/discord/channel_created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the channel." } },
          { "name": "guild_id", "type": "String", "selector": ["guild_id"], "meta": { "description": "The ID of the server." } },
          { "name": "name", "type": "String", "selector": ["name"], "meta": { "description": "The name of the channel." } },
          { "name": "type", "type": "Integer", "selector": ["type"], "meta": { "description": "The type of channel." } }
        ]
      },
      {
        "event": "channel_deleted",
        "path": "/webhooks/discord/channel_deleted",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the deleted channel." } },
          { "name": "guild_id", "type": "String", "selector": ["guild_id"], "meta": { "description": "The ID of the server." } }
        ]
      }
    ]
  },
  {
    "handle": "messages",
    "meta": {
      "short": "Messages",
      "description": "Manage messages within Discord channels, including sending, editing, and deleting messages."
    },
    "endpoint": {
      "value": "/channels/{{channel_id}}/messages",
      "placeholders": [
        {
          "name": "channel_id",
          "type": "String",
          "description": "ID of the channel",
          "required": true
        }
      ]
    },
    "fields": [
      {
        "name": "id",
        "type": "String",
        "selector": ["id"],
        "meta": {
          "description": "The unique identifier for the message."
        }
      },
      {
        "name": "content",
        "type": "String",
        "selector": ["content"],
        "meta": {
          "description": "The content of the message."
        }
      },
      {
        "name": "author_id",
        "type": "String",
        "selector": ["author", "id"],
        "meta": {
          "description": "The unique ID of the message author."
        }
      },
      {
        "name": "author_username",
        "type": "String",
        "selector": ["author", "username"],
        "meta": {
          "description": "The username of the message author."
        }
      },
      {
        "name": "author_global_name",
        "type": "String",
        "selector": ["author", "global_name"],
        "meta": {
          "description": "The display name of the message author."
        }
      },
      {
        "name": "author_bot",
        "type": "Boolean",
        "selector": ["author", "bot"],
        "meta": {
          "description": "Whether the message author is a bot."
        }
      },
      {
        "name": "timestamp",
        "type": "String",
        "selector": ["timestamp"],
        "meta": {
          "description": "The timestamp of the message."
        }
      }
    ],
    "operations": {
      "list": {
        "method": "GET",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "create": {
        "method": "POST",
        "path": {
          "value": "",
          "placeholders": []
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"content\": \"{{content}}\"}",
          "placeholders": [
            {
              "name": "content",
              "type": "String",
              "description": "Content of the message",
              "required": true
            }
          ]
        }
      },
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Message ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      },
      "update": {
        "method": "PATCH",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Message ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          },
          "Content-Type": {
            "value": "application/json",
            "placeholders": []
          }
        },
        "queryParams": {},
        "bodyTemplate": {
          "value": "{\"content\": \"{{content}}\"}",
          "placeholders": [
            {
              "name": "content",
              "type": "String",
              "description": "New content of the message",
              "required": false
            }
          ]
        }
      },
      "delete": {
        "method": "DELETE",
        "path": {
          "value": "/{{id}}",
          "placeholders": [
            {
              "name": "id",
              "type": "String",
              "description": "Message ID",
              "required": true
            }
          ]
        },
        "headers": {
          "Authorization": {
            "value": "Bot {{token}}",
            "placeholders": [
              {
                "name": "token",
                "type": "String",
                "description": "Discord bot token",
                "required": true
              }
            ]
          }
        },
        "queryParams": {},
        "bodyTemplate": null
      }
    },
    "webhooks": [
      {
        "event": "message_created",
        "path": "/webhooks/discord/message_created",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the message." } },
          { "name": "channel_id", "type": "String", "selector": ["channel_id"], "meta": { "description": "The ID of the channel." } },
          { "name": "guild_id", "type": "String", "selector": ["guild_id"], "meta": { "description": "The ID of the server." } },
          { "name": "content", "type": "String", "selector": ["content"], "meta": { "description": "The content of the message." } },
          { "name": "author_id", "type": "String", "selector": ["author", "id"], "meta": { "description": "The unique ID of the message author." } },
          { "name": "author_username", "type": "String", "selector": ["author", "username"], "meta": { "description": "The username of the message author." } }
        ]
      },
      {
        "event": "message_updated",
        "path": "/webhooks/discord/message_updated",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the message." } },
          { "name": "channel_id", "type": "String", "selector": ["channel_id"], "meta": { "description": "The ID of the channel." } },
          { "name": "content", "type": "String", "selector": ["content"], "meta": { "description": "The new content of the message." } }
        ]
      },
      {
        "event": "message_deleted",
        "path": "/webhooks/discord/message_deleted",
        "payload": [
          { "name": "id", "type": "String", "selector": ["id"], "meta": { "description": "The unique identifier for the deleted message." } },
          { "name": "channel_id", "type": "String", "selector": ["channel_id"], "meta": { "description": "The ID of the channel." } }
        ]
      }
    ]
  }
]

```

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.planetcrust.com/human-connections/discord/discord.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
