Skip to content

Instantly share code, notes, and snippets.

@jagrosh
Last active March 29, 2025 04:44
Show Gist options
  • Save jagrosh/5b1761213e33fc5b54ec7f6379034a22 to your computer and use it in GitHub Desktop.
Save jagrosh/5b1761213e33fc5b54ec7f6379034a22 to your computer and use it in GitHub Desktop.
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

@The-LukeZ
Copy link

The-LukeZ commented Aug 8, 2024 via email

@KobeW50
Copy link

KobeW50 commented Aug 8, 2024

You can, but not natively. You can either use a bot that can automatically respond with a ping or (a bit trickier) use a bot and a private channel for the Girhub-webhook, so that GitHub sends the message to your private Discord channel and the bot "copies" this message and adds mentions.

Thank you. Do you know of any public bots that can do either of these? (I only tried YAGPDB, but even custom commands doesn't work since it doesn't listen for webhooks)

(Also, a few minutes ago someone shared this with me. It just seems like a bit of a pain to set up)

@mrgoonie
Copy link

mrgoonie commented Aug 8, 2024

@The-LukeZ
Copy link

The-LukeZ commented Aug 8, 2024

You can, but not natively. You can either use a bot that can automatically respond with a ping or (a bit trickier) use a bot and a private channel for the Girhub-webhook, so that GitHub sends the message to your private Discord channel and the bot "copies" this message and adds mentions.

Thank you. Do you know of any public bots that can do either of these? (I only tried YAGPDB, but even custom commands doesn't work since it doesn't listen for webhooks)

(Also, a few minutes ago someone shared this with me. It just seems like a bit of a pain to set up)

I would suggest Sapphire with the new Sticky Message feature for "reply with ping".
It could also be possible to use the Automod feature but I don't know if bot-messages (what a webhook message is) are recognized.
I could make you a custom bot that does this easily if you want (@thelukez)

@KobeW50
Copy link

KobeW50 commented Aug 8, 2024

Thank you for the advice and the offer @The-LukeZ πŸ™

I opted to try @mrgoonie 's suggestion, and it is working flawlessly. Thank you

@impanda123
Copy link

Hello I have a problem I cant see the description when i commit to main

@The-LukeZ
Copy link

The-LukeZ commented Sep 6, 2024

Hello I have a problem I cant see the description when i commit to main

Descriptions won't show up. I also noticed this.

@unenergizer
Copy link

I ended up using this Github Actions: https://github.com/marketplace/actions/actions-status-discord

Will I be able to show the entire commit message using this?

What I get on discord:
image
It truncates a large portion of my commit messages. This is how I show progress on my project(s).

@mrgoonie
Copy link

I ended up using this Github Actions: https://github.com/marketplace/actions/actions-status-discord

Will I be able to show the entire commit message using this?

What I get on discord: image It truncates a large portion of my commit messages. This is how I show progress on my project(s).

It totally depends on you, grab all commit messages in your action steps and pass them to this action in "description" param

I don't need that, just want the PR title, so this is what I got:
CleanShot 2024-11-23 at 16 31 15@2x

@AndyLevesque
Copy link

FYI - If wanting to send GitHub messages to a Discord forum thread, add "/github?thread_id=[thread number here from thread URL]"

@awalpremi
Copy link

Ty for this. Anyone know how to filter pull requests only? It would be ideal to have pull request opened and closed only to avoid clutter.

@The-LukeZ
Copy link

Ty for this. Anyone know how to filter pull requests only? It would be ideal to have pull request opened and closed only to avoid clutter.

image

Go here and only select the Pull requests.

@cdnghost
Copy link

How do I have this webhook pull posts from another discord server and post into mine? is that even possible?

@The-LukeZ
Copy link

The-LukeZ commented Jan 21, 2025 via email

@awalpremi
Copy link

Ty for this. Anyone know how to filter pull requests only? It would be ideal to have pull request opened and closed only to avoid clutter.

image

Go here and only select the Pull requests.

That was it, don't know how I missed it. Thanks

@mydkong
Copy link

mydkong commented Feb 1, 2025

Got it working:

1. delete hook

2. create new hook

3. add /github at the end,

4. select content type to `application/json`

my man <3 +1

Yes it's working <3

@hijuliancode
Copy link

Got it working:

1. delete hook

2. create new hook

3. add /github at the end,

4. select content type to `application/json`

my man <3 +1

Yes it's working <3

It works for me, thanks

@Ifycode
Copy link

Ifycode commented Feb 8, 2025

Very helpful, thank you. In my case I only needed it for issue ticket integration, so I selected "Let me select individual events" πŸ‘πŸΌ

@Jenspi
Copy link

Jenspi commented Feb 20, 2025

Works perfectly!

This is perfect for not needing to update my partners each time I make changes. Thank you for this! πŸŽ‰

@SchBenedikt
Copy link

Got it working:

1. delete hook

2. create new hook

3. add /github at the end,

4. select content type to `application/json`

my man <3 +1

Yes it's working <3

It works for me, thanks

Yes, now it works πŸ‘

@Robicus
Copy link

Robicus commented Mar 6, 2025

The issue I have is that I'm not actually seeing messages in the payload that appears in Github:
image

This is for both the initial test ping event, in addition to be triggering an event by closing out a branch.

@Robicus
Copy link

Robicus commented Mar 7, 2025

The issue I have is that I'm not actually seeing messages in the payload that appears in Github: image

This is for both the initial test ping event, in addition to be triggering an event by closing out a branch.

Whooops. Had to make sure my user settings allowed showing previews.
image

@P-Bauer
Copy link

P-Bauer commented Mar 28, 2025

Tested it and it works overall but review_requested is missing and is the one I personally need to approve PRs

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