Skip to content

Instantly share code, notes, and snippets.

@evadecker
Created September 5, 2024 23:57
Show Gist options
  • Save evadecker/a72b39af12b00f7f3318e9b05efd37fd to your computer and use it in GitHub Desktop.
Save evadecker/a72b39af12b00f7f3318e9b05efd37fd to your computer and use it in GitHub Desktop.
Webhook: Better Stack Incident to Discord

Post Better Stack incident alerts to Discord

You can post incidents from Better Stack to a channel on Discord using webhooks.

  1. Add a new Webhook from your Discord server. Server Settings > Integrations > Webhooks.
  2. Name your bot and set what channel it posts to. CleanShot 2024-09-05 at 19 50 29@2x
  3. Copy the Webhook URL.
  4. In the Better Stack Admin, go to Integrations > Exporting Data > Outgoing webhooks > Configure > Incident webhook > Add.
  5. Paste your Discord webhook URL.
  6. Expand Advanced Settings.
  7. Copy and paste the contents of request_body.json, above, into the Request body template field.
  8. Test your webhook—it should have sent a message to Discord. CleanShot 2024-09-05 at 19 52 37@2x
  9. Modify the fields and structure to suit your needs. https://birdie0.github.io/discord-webhooks-guide/structure/embed/fields.html

Here's an avatar to use for your bot:

statusbot

Happy status reporting!

{
"content": "Incident **$STATUS**. [See details.]($URL)",
"embeds": [
{
"author": {
"name": "$TEAM_NAME"
},
"fields": [
{
"name": "Incident ID",
"value": "$INCIDENT_ID",
"inline": true
},
{
"name": "HTTP Method",
"value": "$HTTP_METHOD",
"inline": true
},
{
"name": "Cause",
"value": "$CAUSE",
"inline": true
},
{
"name": "Started At",
"value": "$STARTED_AT",
"inline": true
},
{
"name": "Acknowledged At",
"value": "$ACKNOWLEDGED_AT",
"inline": true
},
{
"name": "Resolved At",
"value": "$RESOLVED_AT",
"inline": true
}
],
"image": {
"url": "$SCREENSHOT_URL"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment