Skip to content

Instantly share code, notes, and snippets.

@jagrosh
Last active July 21, 2024 06:29
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

@haddercone
Copy link

any idea why is necesary to add /github at the end?? It work, but...

Because it helps GitHub to map to a specific endpoint in case of discord.
You can have multiple endpoint on a single domain.

You can achieve this by creating your own endpoints.
E.g. you can create a simple node.js server which has two endpoints /a and /b that do different tasks.

  • Host your node js server on service like render. It will provide you with a domain.
  • Create two different webhooks in GitHub.
  • For each webhook, keep the domain name same but add different endpoints for different GitHub event.

Now you have two webhooks which are mapped to two different GitHub events, but with a single domain name.

@luisangeldevops
Copy link

luisangeldevops commented Jul 17, 2024 via email

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