Webhooks
GitHub
Point a GitHub repository at a Klang webhook and its pushes, pull requests, issues and releases show up in a channel as embeds, the way Discord does it.
Set it up
-
Create a webhook in Klang for the channel and copy its URL (see Create a webhook).
-
In GitHub, open the repository’s Settings › Webhooks › Add webhook. For every repository of an organization, use the organization’s Settings › Webhooks instead.
-
In Payload URL, paste the Klang URL with
/githubat the end:https://api.klang.gg/api/webhooks/{webhook.id}/{webhook.token}/github -
In Content type, choose
application/json. GitHub’s default,application/x-www-form-urlencoded, gets a400that says which one to choose. -
Leave Secret empty: Klang doesn’t check it (see Security).
-
Choose the events: Send me everything or the ones you want. Klang posts the ones in the table below and accepts the rest without posting anything.
-
Select Add webhook. GitHub sends a
pingat once, and it shows up in the channel.
Supported events
Event (X-GitHub-Event) |
What shows up in the channel |
|---|---|
push |
The commits pushed, up to 5, with their messages. |
pull_request |
A pull request opened, closed, merged or reopened. |
issues |
Activity on an issue. |
issue_comment |
A comment on an issue or a pull request. |
release |
A release published. |
create, delete |
A branch or a tag created or deleted. |
star, watch |
Someone starred the repository. |
fork |
Someone forked the repository. |
ping |
GitHub’s test message, sent when you add the webhook. |
Every other event is accepted with a 204 and nothing is posted, so turning on more events in
GitHub doesn’t break anything.
Security
GitHub can sign each delivery with a secret (X-Hub-Signature-256), but Klang doesn’t check
that signature: the token in the URL already authorizes, as with Discord. That makes the
Payload URL the secret. If it leaks, regenerate the token
and paste the new URL, with /github at the end, in GitHub.
When something doesn’t show up
GitHub keeps every delivery and Klang’s answer under the webhook’s Recent Deliveries:
204: Klang took it. If nothing was posted, the event isn’t one of the supported ones.400: the content type isn’tapplication/json. Change it, then select Redeliver.404: the URL is wrong, or the token was regenerated or the webhook deleted. Copy the URL again from Klang.429: over the rate limit, 5 requests every 2 seconds per webhook. A very busy repository may hit it: send only the events you need.