Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this 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! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings

  2. Select Add Webhook Add

  3. Paste in the webhook url and append /github to the end. Select "Send me everything", set the type to application/json, and then Add Webhook WebhookSettings

  4. Test it by updating something or starring the repository! If it works, you're all set! Star

@depfryer

This comment has been minimized.

Copy link

depfryer commented Jan 25, 2017

but you're bot have a bester prez
so i think already use this code

@Pixel1011

This comment has been minimized.

Copy link

Pixel1011 commented Feb 13, 2017

i got an error saying Invalid HTTP Response: 400

@branden-akana

This comment has been minimized.

Copy link

branden-akana commented Feb 26, 2017

Adding the /github to the end of your webhook URL is absolutely needed. You get a bunch of 400s if you leave it out.

@AmigoSBlat

This comment has been minimized.

Copy link

AmigoSBlat commented Mar 3, 2017

Расстрелять за это!

@Xwilarg

This comment has been minimized.

Copy link

Xwilarg commented Mar 10, 2017

Is there a way for the GitHub bot to use the nickname and the picture profile of the one set in Discord, instead of the 'GitHub' one ?

@Xladeus

This comment has been minimized.

Copy link

Xladeus commented May 12, 2017

I've added /github but it is still not working

@theLMGN

This comment has been minimized.

Copy link

theLMGN commented Jun 8, 2017

I keep getting error 400 with /github

@theLMGN

This comment has been minimized.

Copy link

theLMGN commented Jun 8, 2017

Ah fixed it Change the type to application/json

@Tslimshady99

This comment has been minimized.

Copy link

Tslimshady99 commented Jul 31, 2017

Any one know how to add a webhook for circleci

@kelno

This comment has been minimized.

Copy link

kelno commented Sep 5, 2017

Thanks !

@xensor

This comment has been minimized.

Copy link

xensor commented Sep 7, 2017

I can't get this to work. I followed the guide.

I have one set up for a rep and it doesn't send anything when I modify anything.

Did something change?

@seal308

This comment has been minimized.

Copy link

seal308 commented Sep 12, 2017

@xensor
I got it to work.
Make sure the content type is application/json.

@gluons

This comment has been minimized.

Copy link

gluons commented Oct 2, 2017

Thanks. It works! 🎉

@ta-riq

This comment has been minimized.

Copy link

ta-riq commented Nov 24, 2017

Can you give us a way to add webhooks for Bitbucket too ?

It will be so useful . Thanks in Advance

@iCielin

This comment has been minimized.

Copy link

iCielin commented Nov 25, 2017

Not working ;-;

@LJNeon

This comment has been minimized.

Copy link

LJNeon commented Nov 28, 2017

@jagrosh you might wanna edit this so people know to set the content type to JSON without reading the comments.

@ghost

This comment has been minimized.

Copy link

ghost commented Dec 10, 2017

I found the problem: https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks
you have to add /github after the token in the URL. I totally overlooked that lol, thank you!

@BossBenji

This comment has been minimized.

Copy link

BossBenji commented Dec 16, 2017

settings has been updated, please update.

@greenbigfrog

This comment has been minimized.

Copy link

greenbigfrog commented Dec 21, 2017

@jagrosh you should mention, to change the content type to JSON...

@kevinkjt2000

This comment has been minimized.

Copy link

kevinkjt2000 commented Jan 3, 2018

Yeah, the application/json should also be circled in red LOL

@gamersalpha

This comment has been minimized.

Copy link

gamersalpha commented Jan 5, 2018

Hello,
can i create awbehook for a git who is not mine ?

thanks

@tverghis

This comment has been minimized.

Copy link

tverghis commented Jan 25, 2018

I tried to set this up. I got a 204 response from Discord, which means it accepted the request. However, nothing is showing up.
Any thoughts?

@echebbi

This comment has been minimized.

Copy link

echebbi commented Feb 12, 2018

Since a few days, all the messages I receive from the bot are shown empty :

empty-messages

It seems that the others that have access to the channel still can see the messages as usual, so apparently I am the only one who is affected by this bug. I tried to:

  • clear Discord's cache,
  • uninstall Discord,
  • use the web interface,

but the messages remain empty. Does someone have an idea to resolve this issue ?

@TheGuywithTheHat

This comment has been minimized.

Copy link

TheGuywithTheHat commented Mar 24, 2018

@Tslimshady99 This page claims that CircleCI works, so I'd try this tutorial, but with /circleci instead of /github.

@ghost

This comment has been minimized.

Copy link

ghost commented Apr 6, 2018

Thanks!

@gt-c

This comment has been minimized.

Copy link

gt-c commented Apr 21, 2018

@KazeJiyu. I'm extremely late, but judging off my knowledge of Discord that looks like you have embeds disabled in user settings. Not sure if this applies to webhooks too, but you may also have to allow permissions for people to send embeds in the channel

@SevenOutman

This comment has been minimized.

Copy link

SevenOutman commented Apr 23, 2018

Thanks! It works!

@SirHumans

This comment has been minimized.

Copy link

SirHumans commented Apr 29, 2018

I'm having an issue, I do everything everyone says but it never puts any messages into the discord chat, I have /GitHub at the end and have it on the /json

@janburzinski

This comment has been minimized.

Copy link

janburzinski commented May 21, 2018

Thanks for that!

@Zorono

This comment has been minimized.

Copy link

Zorono commented May 24, 2018

Thanks alot @jagrosh for this aweasome Tutorial.

@Anu-cool-007

This comment has been minimized.

Copy link

Anu-cool-007 commented May 25, 2018

I don't seem to get updates on many other things on GitHub (especially "project-card" events). The payload is delivered successfully but no message is being created for it. Git related events are posted as expected is this issue or simply a missing feature from JSON parsing?
"Send me everything" is selected btw

@HawkWalker

This comment has been minimized.

Copy link

HawkWalker commented Jun 2, 2018

I need some help. I meet 404 error everytime. I followed the guide but I can't create any bot.

@ovpv

This comment has been minimized.

Copy link

ovpv commented Jun 30, 2018

not getting any updates to discord from github
error no :400

this is the response i am getting :

{"code": 50006, "message": "Cannot send an empty message"}

please help.
ps : i have already selected content type: json

@fhbncghdytgf

This comment has been minimized.

Copy link

fhbncghdytgf commented Aug 5, 2018

TOOOOOOOOOOOOOOOOOOOOOOOOO LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONGGGGGG

@Migmag789

This comment has been minimized.

Copy link

Migmag789 commented Aug 9, 2018

o/ I have the error 400 but I have done everything that was in the tutorial :(

@guylepage3

This comment has been minimized.

Copy link

guylepage3 commented Aug 9, 2018

+1 on the 400 error..

@OfficialC0d3R

This comment has been minimized.

Copy link

OfficialC0d3R commented Sep 1, 2018

400 error

@ThePhynix

This comment has been minimized.

Copy link

ThePhynix commented Sep 13, 2018

I Paste the Link
Made sure it was in application/Json
Selected "Send Everything"

Still not working. Just isn't sending

@acollierr17

This comment has been minimized.

Copy link

acollierr17 commented Sep 29, 2018

Just wanted to stop by and comment on this matter. I had the same exact issue above. But I followed these steps to resolve my issue.

  1. Generate a new webhook
  2. Go to the setting of my repository -> go to webhooks -> add webhook
  3. I paste in the webhook url, appending it with /github
  4. I set the Content-Type to application/json
  5. I get a 400 error. What did I do?
  6. I simply went to the failed delivery and clicked "Redeliver". After that, it went through

Not sure if this will help anyone else here, but after messing around with the webhook page, I got it to work.

@Bluscream

This comment has been minimized.

Copy link

Bluscream commented Oct 9, 2018

You can also create a webhook for a whole organization: https://github.com/organizations/<YOUR ORG>/settings/hooks/new

@FreddyMarsden

This comment has been minimized.

Copy link

FreddyMarsden commented Oct 12, 2018

I get the HTTP Response: 400 error

@bchen290

This comment has been minimized.

Copy link

bchen290 commented Oct 21, 2018

Is it possible to change avatar

@snow344

This comment has been minimized.

Copy link

snow344 commented Nov 3, 2018

Ah fixed it Change the type to application/json

Thank you,
You are a life savior.

@Calvin-Xu

This comment has been minimized.

Copy link

Calvin-Xu commented Feb 28, 2019

Do not forget to add /github after the webhook url! Or the payload will not be parsed correctly. I think that is where most of the 400 errors are coming from.

@hudson1740

This comment has been minimized.

Copy link

hudson1740 commented Mar 25, 2019

Is it possible to change avatar

yes on discord goto the channel settings>webhook>edit>webhook icon (upload image)

@BettySwolax

This comment has been minimized.

Copy link

BettySwolax commented Apr 2, 2019

image
doesnt work

@OnceDot

This comment has been minimized.

Copy link

OnceDot commented Apr 27, 2019

@BettySwolax it's because you need to append /github to the end of the webhook URL!

@Darketix

This comment has been minimized.

Copy link

Darketix commented May 30, 2019

### I don't understand the last step! Someone help please!

@IngwiePhoenix

This comment has been minimized.

Copy link

IngwiePhoenix commented Jun 3, 2019

Is there a method to track an individual user's progress as well - or does this only apply to repositories and organizations?

Thanks for the little tutorial :)

@JDsWebService

This comment has been minimized.

Copy link

JDsWebService commented Jun 9, 2019

You are a SAINT! :D Easy and simple to follow tutorial! Love it!

@TheFinalDawn

This comment has been minimized.

Copy link

TheFinalDawn commented Jun 25, 2019

everyone getting 400 errors,

You forgot to append /github in your link.

@xorz57

This comment has been minimized.

Copy link

xorz57 commented Jun 26, 2019

Just wanted to stop by and comment on this matter. I had the same exact issue above. But I followed these steps to resolve my issue.

  1. Generate a new webhook
  2. Go to the setting of my repository -> go to webhooks -> add webhook
  3. I paste in the webhook url, appending it with /github
  4. I set the Content-Type to application/json
  5. I get a 400 error. What did I do?
  6. I simply went to the failed delivery and clicked "Redeliver". After that, it went through

Not sure if this will help anyone else here, but after messing around with the webhook page, I got it to work.

It works!

@Mar1cX

This comment has been minimized.

Copy link

Mar1cX commented Jul 16, 2019

Great job making this.

@Rubylium

This comment has been minimized.

Copy link

Rubylium commented Aug 14, 2019

Is there anyway to get custom message and not premade one?

@ClearlyElevated

This comment has been minimized.

Copy link

ClearlyElevated commented Aug 18, 2019

Is there anyway to get custom message and not premade one?

What exactly are you trying to do? If you make a commit you can obviously put a custom defined reason. Other then that. If you are looking to simply send custom we hook messages this is the wrong tutorial for you.

@ClearlyElevated

This comment has been minimized.

Copy link

ClearlyElevated commented Aug 18, 2019

image
doesnt work

If you read the tutorial correctly then it would be working fine.

@ClearlyElevated

This comment has been minimized.

Copy link

ClearlyElevated commented Aug 18, 2019

If you can’t setup a web hook then you have no business trying to do so. I mean if you use github as a doc site for your server rules or something then I could see that being reasonable. But other then that. If you can write code a webhook api should be a piece of cake

@Rubylium

This comment has been minimized.

Copy link

Rubylium commented Aug 18, 2019

Is there anyway to get custom message and not premade one?

What exactly are you trying to do? If you make a commit you can obviously put a custom defined reason. Other then that. If you are looking to simply send custom we hook messages this is the wrong tutorial for you.

Well, i'm trying to mostly change the language, for exemple on my screen you can see "updated blablabla" well i would like to change it to "Mise à jours de blablabla"
Not sure if this is possible ( i know it's not with this tutorial, but even searching for an other method i could not find how
image

@Stadler76

This comment has been minimized.

Copy link

Stadler76 commented Aug 19, 2019

Backticks in commit titles can mess up the Webhook post. I'd suggest to either purge them, close the unclosed ones or replace them with for example '. I guess the same can happen with other markdown-ish commit titles.

@YellowGecko777

This comment has been minimized.

Copy link

YellowGecko777 commented Sep 18, 2019

argh how do you update something.... sorry im new to this

@Mshriver2

This comment has been minimized.

Copy link

Mshriver2 commented Nov 12, 2019

Is there a way for the GitHub bot to use the nickname and the picture profile of the one set in Discord, instead of the 'GitHub' one ?

@Woodzyttv

This comment has been minimized.

Copy link

Woodzyttv commented Nov 13, 2019

I had the issue where is was giving me the error 400 thing. I just deleted the webhooks in both github and discord and started the process over, making sure to select the json option and adding /github at the end of the URL. it worked fine after that.

@jagrosh

This comment has been minimized.

Copy link
Owner Author

jagrosh commented Nov 13, 2019

Is there anyway to get custom message and not premade one?

It's just using your commit messages, so write something for them instead of using the default commit messages

Is there a way for the GitHub bot to use the nickname and the picture profile of the one set in Discord, instead of the 'GitHub' one ?

No, Discord automatically sets those for the github webhook

@Triloworld

This comment has been minimized.

Copy link

Triloworld commented Jan 2, 2020

Other webhook available there:
https://github.com/Commit451/skyhook || https://skyhook.glitch.me/
Run own server or use this service :)
You can use free GCP account for something simple like that to achieve HA and privacy

@Da04Boss

This comment has been minimized.

Copy link

Da04Boss commented Jan 6, 2020

I have been working on this forever and decided to use this. It took so long to set it up and to verify my email address. After that, I began working on it. I got it done. Thing is that it did nothing. My bot doesn't even show up!!!!!!

@ClearlyElevated

This comment has been minimized.

Copy link

ClearlyElevated commented Jan 9, 2020

I have been working on this forever and decided to use this. It took so long to set it up and to verify my email address. After that, I began working on it. I got it done. Thing is that it did nothing. My bot doesn't even show up!!!!!!

Contact me on discord. Or via email. I can help you. this still works the same as it did when this tut came out. my email is admin@lutu.dev

@Doggow

This comment has been minimized.

Copy link

Doggow commented Jan 9, 2020

Soo Im trying to make an auto msging thingy if thats possible. And I cant seem to make it work. Can anyone help?
*No idea how to code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.