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 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 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 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 AmigoSBlat commented Mar 3, 2017

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

@Xwilarg

This comment has been minimized.

Copy link

@Xwilarg 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 Xladeus commented May 12, 2017

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

@theLMGN

This comment has been minimized.

Copy link

@theLMGN theLMGN commented Jun 8, 2017

I keep getting error 400 with /github

@theLMGN

This comment has been minimized.

Copy link

@theLMGN theLMGN commented Jun 8, 2017

Ah fixed it Change the type to application/json

@Tslimshady99

This comment has been minimized.

Copy link

@Tslimshady99 Tslimshady99 commented Jul 31, 2017

Any one know how to add a webhook for circleci

@kelno

This comment has been minimized.

Copy link

@kelno kelno commented Sep 5, 2017

Thanks !

@xensor

This comment has been minimized.

Copy link

@xensor 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 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 gluons commented Oct 2, 2017

Thanks. It works! 🎉

@ta-riq

This comment has been minimized.

Copy link

@ta-riq 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 iCielin commented Nov 25, 2017

Not working ;-;

@LJNeon

This comment has been minimized.

Copy link

@LJNeon 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 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 BossBenji commented Dec 16, 2017

settings has been updated, please update.

@greenbigfrog

This comment has been minimized.

Copy link

@greenbigfrog 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 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 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 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 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 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 ghost commented Apr 6, 2018

Thanks!

@gt-c

This comment has been minimized.

Copy link

@gt-c 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 SevenOutman commented Apr 23, 2018

Thanks! It works!

@SirHumans

This comment has been minimized.

Copy link

@SirHumans 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 janburzinski commented May 21, 2018

Thanks for that!

@Zorono

This comment has been minimized.

Copy link

@Zorono 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 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 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 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 fhbncghdytgf commented Aug 5, 2018

TOOOOOOOOOOOOOOOOOOOOOOOOO LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONGGGGGG

@Migmag789

This comment has been minimized.

Copy link

@Migmag789 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 guylepage3 commented Aug 9, 2018

+1 on the 400 error..

@ZyorYT

This comment has been minimized.

Copy link

@ZyorYT ZyorYT commented Sep 1, 2018

400 error

@ThePhynix

This comment has been minimized.

Copy link

@ThePhynix 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 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 Bluscream commented Oct 9, 2018

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

@freddy-m

This comment has been minimized.

Copy link

@freddy-m freddy-m commented Oct 12, 2018

I get the HTTP Response: 400 error

@bchen290

This comment has been minimized.

Copy link

@bchen290 bchen290 commented Oct 21, 2018

Is it possible to change avatar

@ghost

This comment has been minimized.

Copy link

@ghost ghost 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 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 hudson1740 commented Mar 25, 2019

Is it possible to change avatar

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

@FileRunner

This comment has been minimized.

Copy link

@FileRunner FileRunner commented Apr 2, 2019

image
doesnt work

@RealAlphabet

This comment has been minimized.

Copy link

@RealAlphabet RealAlphabet 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 Darketix commented May 30, 2019

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

@IngwiePhoenix

This comment has been minimized.

Copy link

@IngwiePhoenix 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 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 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 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 Mar1cX commented Jul 16, 2019

Great job making this.

@Rubylium

This comment has been minimized.

Copy link

@Rubylium 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 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 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 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 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 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 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 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 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 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 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 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 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 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

@ptkdev

This comment has been minimized.

Copy link

@ptkdev ptkdev commented Jan 25, 2020

How can I set specific branch?

@spergmoment

This comment has been minimized.

Copy link

@spergmoment spergmoment commented Feb 7, 2020

if you cant code, dont fucking set up a webhook

@Webhook-create

This comment has been minimized.

Copy link

@Webhook-create Webhook-create commented Feb 13, 2020

Hey, i want it to only happen when someone joins. How could i do that?

@jagrosh

This comment has been minimized.

Copy link
Owner Author

@jagrosh jagrosh commented Feb 13, 2020

What do you mean by "join"? Join a github organization? These webhooks only mirror events from github.

@GraphicEdit

This comment has been minimized.

Copy link

@GraphicEdit GraphicEdit commented Mar 21, 2020

how can I get a notifications someone assigned to a "issues" ? or edited it?

@Tenzix

This comment has been minimized.

Copy link

@Tenzix Tenzix commented Mar 25, 2020

It Work well ! Thanks buddy !

@deeze307

This comment has been minimized.

Copy link

@deeze307 deeze307 commented Apr 3, 2020

Worked for me, Thanks!!

@darvesh

This comment has been minimized.

Copy link

@darvesh darvesh commented Apr 29, 2020

Thanks.

@reddymnd

This comment has been minimized.

Copy link

@reddymnd reddymnd commented Apr 30, 2020

I was asking does anyone know how to set up messages that post daily at a certain time to a discord channel through the webhook/github setup? I have it all set up and working, I just can't figure out what code to use to get scheduled messages.

HOWEVER - some angel posted about Carl-bot in another forum and it's perfect! No setup, just add the bot to discord and you can set up all the autofeeds you want for free it's great! https://carl.gg/

@AGR2006

This comment has been minimized.

Copy link

@AGR2006 AGR2006 commented May 4, 2020

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

Me too

@Lyaaaaaaaaaaaaaaa

This comment has been minimized.

Copy link

@Lyaaaaaaaaaaaaaaa Lyaaaaaaaaaaaaaaa commented May 8, 2020

Hello, thank you for the tutorial. However I have an error I guess.
Everything in the delivery is working (at least it seems like) however I have no message on discord.
After looking at Github it looks like the response is error 204 which means "no content". I don't understand, my payload is full of data detailing the action which triggered the delivery.
Thank you for your time.
image
image

@cristofersousa

This comment has been minimized.

Copy link

@cristofersousa cristofersousa commented May 10, 2020

sorry my english, but i test here works for me

  1. Shuttdown DiscordApp
  2. Start DiscordApp in WebBrowser
  3. Create your webhook in channel text
  4. Add your name/ avatar
  5. Copy url webhook
  6. In repository manage webhooks
  7. Paste url webhook
  8. Select type: json
  9. Disable SSL
  10. Save
@telmomarques

This comment has been minimized.

Copy link

@telmomarques telmomarques commented May 22, 2020

Having the same issue: 204 response on GitHub, nothing shows up no discord (yes, I've added /github at the end).
Did anyone manage to solve this?

@telmomarques

This comment has been minimized.

Copy link

@telmomarques telmomarques commented May 25, 2020

Having the same issue: 204 response on GitHub, nothing shows up no discord (yes, I've added /github at the end).
Did anyone manage to solve this?

So I left the Webhook configured for some time and reached the conclusion that some events are just not supported by the /github endpoint of the discord webhook. For example, new issue and issue comments appear on discord, but moving project cards do not (even though an event is fired).

Bottom line is: Discord's Github integration is incomplete.

@Lyaaaaaaaaaaaaaaa

This comment has been minimized.

Copy link

@Lyaaaaaaaaaaaaaaa Lyaaaaaaaaaaaaaaa commented Jun 3, 2020

@telmomarques I just tested it with an issue instead of a kanban. You are right, the integration is incomplete but it works.
Thank you for the answers!

@SgtDevRupesh

This comment has been minimized.

Copy link

@SgtDevRupesh SgtDevRupesh commented Jun 18, 2020

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.

THX :D IT WORKED

@ldeluigi

This comment has been minimized.

Copy link

@ldeluigi ldeluigi commented Jun 22, 2020

It works for me

@MMK21Hub

This comment has been minimized.

Copy link

@MMK21Hub MMK21Hub commented Jul 13, 2020

@echebbi Embeds are enabled right?

@rakeshshubhu

This comment has been minimized.

Copy link

@rakeshshubhu rakeshshubhu commented Jul 20, 2020

if some one having the problem with just integration.. there's no discordapp.com change it to discord.com in your webhook url.

@MMK21Hub

This comment has been minimized.

Copy link

@MMK21Hub MMK21Hub commented Jul 20, 2020

It's still only deprecated.

@Kqzz

This comment has been minimized.

Copy link

@Kqzz Kqzz commented Jul 24, 2020

Thanks for the guide! It helped me out and it worked 100% for me.

@MutableLoss

This comment has been minimized.

Copy link

@MutableLoss MutableLoss commented Jul 25, 2020

Completely overlooked the /github suffix when setting up. so thanks for the writeup! 🎉

Just to address the statement on the domain: The original discordapp.com domain is valid, so don't change domains. When testing the webhook URL in Postman, you can quickly find that both domains give the same response.

I also found that the webhook response to be confusing at first. Each time you update your integration, you will see the previously failed response. To test your changes, click the response error, then click the Redeliver button to test using an updated payload.

@TheSnowGuru

This comment has been minimized.

Copy link

@TheSnowGuru TheSnowGuru commented Aug 2, 2020

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

thanks!

@ThuggNuggets

This comment has been minimized.

Copy link

@ThuggNuggets ThuggNuggets commented Sep 2, 2020

400 ERROR ---- MAKE SURE YOU ADD A COMMIT MESSAGE OR IT WONT WORK

@Oof4

This comment has been minimized.

Copy link

@Oof4 Oof4 commented Sep 11, 2020

Works, Thanks

@lightmyfire17

This comment has been minimized.

Copy link

@lightmyfire17 lightmyfire17 commented Sep 14, 2020

Hey there, is it possible to prevent pushing events from private repos in organization?

@sblantipodi

This comment has been minimized.

Copy link

@sblantipodi sblantipodi commented Oct 13, 2020

it doesn't work for me for the releases. it works for most "actions" but not for the releases why?

@piorrro33

This comment has been minimized.

Copy link

@piorrro33 piorrro33 commented Oct 20, 2020

Thanks :)

@Lyaaaaaaaaaaaaaaa

This comment has been minimized.

Copy link

@Lyaaaaaaaaaaaaaaa Lyaaaaaaaaaaaaaaa commented Oct 20, 2020

it doesn't work for me for the releases. it works for most "actions" but not for the releases why?

Hello, it does work for me when I create a new release. I created a webhook specially for the release though.

@sveitser

This comment has been minimized.

Copy link

@sveitser sveitser commented Oct 22, 2020

For those who see empty messages. In my case it was caused by disabled link previews in the Discord Text & Images settings.

image

@brandoge91

This comment has been minimized.

Copy link

@brandoge91 brandoge91 commented Oct 28, 2020

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

Still not working. Just isn't sending

it is application/json, it is case sensitive, if Json is capitalized, try making it lower-case

@zeteticl

This comment has been minimized.

Copy link

@zeteticl zeteticl commented Nov 10, 2020

How can it only receive message when special branches get update like master

@ronakjain2012

This comment has been minimized.

Copy link

@ronakjain2012 ronakjain2012 commented Nov 17, 2020

How can it only receive message when special branches get update like master

you can use services like "Zapier"

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.