GitHub-Discord events

Customize your GitHub webhook messages to Discord

Get started Introduction

Highly customisable

Send webhooks in threads / forums, with messages, mentions, components and more!

Typescript

Enjoy the features of Typescript with typed payloads, methods, etc.

More Events

Send more GitHub webhook events to your Discord channel

Minimal setup

Easily to deploy with few code lines needed. Start your webhooks in about 30 lines of code

Filter by rules

Add new rules and control events by their labels, milestone, actions, branch and more!

Lifecycle hooks

Listen to lifecycle hooks and easily integrate events into your Discord bot

Example

Create a message in a Discord channel when a new release is published.

Discord

Code

import { RuleBuilder, GitHubEventManager } from 'github-discord-events'

const rules = new RuleBuilder({ webhook: WEBHOOK_URL })
    .addEvent({
        name: 'release',
        actions: ['published'],
        main: false,
        addFilter: (event) => {
            return !event.release.draft // Ignore draft releases
        },
        transformMessage: (event, embeds) => {
            const { tag_name } = event.release
            const changelog = `https://github.com/ghostrider-05/github-discord-events/blob/master/CHANGELOG.md#${tag_name}`

            const content = `<@role_id> version ${tag_name} is out!\n\nView the changelog: ${changelog}.`
            return {
                embeds,
                content
            }
        }
    })

const manager = new GitHubEventManager({ rules })

addEventListener('fetch', event => {
    event.respondWith(manager.handleEvent(event.request))
})