How to get GitHub notifications on your Discord server.
Ineza Bonté Grévy

Ineza Bonté Grévy @inezabonte

About: Learning and sharing what I've learnt on my coding journey 🙂

Location:
Gatineau, QC
Joined:
May 22, 2020

How to get GitHub notifications on your Discord server.

Publish Date: May 1 '21
114 13

GitHub provides us with a way to allow other applications such as discord to connect it and receive POST requests whenever any action is done on your repository.

This can be useful if you find the email notifications not as instant as you'd want them to be.

Prerequisites

  • You need to have a GitHub account with a repository.
  • You need to have a discord server where we will add the webhook.

1. Create the webhook

A webhook is basically a link that will allow other applications to post into discord.
To create a webhook, head into your server settings => integrations => New webhook
Alt Text
You can give your webhook a name and also choose which channel it will be posting to. You can click on Copy Webhook URL to copy the link which we are going to use on our GitHub repository.

2. Add Discord webhook to GitHub

After creating the webhook the next thing is to add it to your github repository from which you would like to get notifications.

Alt Text

Head over to your repo then settings => Webhooks => Add webhook

Paste the link we copied earlier from discord in the Payload URL and make sure to add /github at the end or it will not work.

Alt Text

Set the Content type to application/json and finally choose the events which should trigger the webhook. Personally, I want everything.

After you are done you can click the green button at the bottom labeled Add webhook to complete the process.

If you have done it correctly you should receive a similar notification to this;
Alt Text

3. Test the webhook

To test the webhook we can perform a simple action such as creating an issue on the repo which we just added the webhook.
A screenshot of creating a test issue

Upon creating the issue. You should immediately receive a notification from discord on whatever device you have installed it on.
Screen Shot 2021-05-01 at 13.50.28

It will work the same way when pushing commits, creating PRs ...etc

Thank You for reading❤️. If you have any questions feel free to drop them in the comments section below and I'll be glad to answer them.

Comments 13 total

  • Hasindu Lanka
    Hasindu LankaJan 7, 2022

    You saved my day!

  • Youssef Khouidi
    Youssef KhouidiJan 12, 2022

    FIX: add /github to the end of the webhook or it will not work!

    thanks

  • T04435
    T04435Jul 29, 2022

    is there a way to filter the data is provided from GH?

    IE: only notify on bugs created[new issue + label: bug]

    Thanks.

    • Ineza Bonté Grévy
      Ineza Bonté GrévyJul 29, 2022

      Yes it possible to narrow down what events you want to receive. You can select the
      Let me select individual events. to see the wide range of events to choose from
      Image description

      • T04435
        T04435Jul 29, 2022

        I saw that option but there is nothing that lets you aggregate a

        • created issue + label.contains('bug')

        If there is pls, could you point to the specific check boxes to check

        Thanks.

        ATM I'm moving towards GH workflow with github.com/marketplace/actions/dis...

  • Rifky Maulana
    Rifky MaulanaJun 15, 2023

    Thankk youu, your article is amazing. it's very useful for mee....

  • LEANDRE ALLY
    LEANDRE ALLYOct 6, 2023

    Thanks it working on my end💥

  • Jared Rigby
    Jared RigbyNov 1, 2023

    Perfect tutorial, concise and easy to follow 10/10 :)

  • Dev Keshwani
    Dev KeshwaniDec 8, 2023

    This webhook only connects a particular repo or covers all the repos of an github account?? @inezabonte

  • Mahbub Hasan Imon
    Mahbub Hasan ImonApr 21, 2024

    Thanks, man! Worked perfectly

Add comment