Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save utensil/ed4d4c0e3dd936de9cc5c4c27311c470 to your computer and use it in GitHub Desktop.
Save utensil/ed4d4c0e3dd936de9cc5c4c27311c470 to your computer and use it in GitHub Desktop.

Github to Discord Webhook Tutorial

In this tutorial I'll show you how to create a Github webhook that will post updates from your Github account to a channel in Discord. The steps are simple so follow along!

Create a Webhook in a Discord Channel

First you need to create a webhook in a text channel. We're assuming you have both Manage Channel and Manage Webhooks permissions!

  • Go in a channel properties (Alternatively, Server Settings, Webhooks works too)
  • Click Webhooks
  • Click Create Webhook
  • Type in a name (this is for local reference, it's overriden by the incoming hook data)
  • Copy the Webhook URL (you can use the Copy button)
  • Click Save

WebhookDiscord

Note: Do NOT give the Webhook URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe!

Create the Github Webhook

In order to do this you need to be the owner of the github repository. Even Collaborators cannot access settings.

  • Click on Settings
  • Click on Webhooks
  • Click on Add Webhook
  • The Payload URL is the webhook URL with /github added to the end.
  • Leave Secret blank, change the Content-Type to application/json
  • Select what type of events you want
  • Click Add Webhook

WebhookGithub

Note: The "test" payload will not show anything in your channel. That is normal. You will need to actually take an action in order to show any activity. However, make sure the test payload has a green checkmark, and the response is 204.

Troubleshooting

I'm getting a 400 error!

Make sure to add /github at the end of the webhook URL.

Can I change the Avatar and Name of the hook's messages?

No, Github controls that part, so they're choosing the name and Avatar.

I'm not getting the events I want (or too many)

Under Which events would you like to trigger this webhook?, select Let me select individual events.

Check the events you'd like to receive. There are a lot of them.

Enjoy!

That's it. That's all you had to do. Now go code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment