How to create a Discord webhook?

How do I create a webhook in Discord? What even is a webhook and what can I do with it?... It's actually pretty cool and you can be quite creative about using these if you think about it.

A webhook is basically a way to programatically interact with an application, its an API. In the case of Discord, if you have your own Discord server you can configure channels to be webhook enabled.

In the Discord user interface and in discussions you will see/hear these referred to as "bots".

Discord Bot Example

How you could use them?

These are some ideas for things you could do with the webhooks offered in Discord.

  • Create a script that triggers on certain events and posts a message to your server channel.

  • Create an application that allows your Discord server users to interact with it using command in the channel

Create webhook

Discord has great documentation on this, have a look under Webhook Resource to learn about the different type of webhooks.

  1. Go to a Discord server you are admin in.

  2. Right Click the channel you want to enable the webhook for and click on Edit Channel

  3. Under Integrations click on Create Webhook

  4. Copy the webhook link by clicking on Copy Webhook URL

Channel Config

What you will get is an url that looks something like this:

https://discord.com/api/webhooks/[identifier]/[access_token]

Essentially with the information embedded in this URL there is enough information for the Discord API to determine exactly where this call should be made... to which server and channel.

Please have a look in the linked documentation above to learn more about how to make use of the webhook.

Word of caution

Ideally you should not expose this link to anyone as it contains everything you need to make calls to your Discord server.