Skip to main content
Solved

Discord Integration

  • December 6, 2024
  • 4 replies
  • 275 views

Forum|alt.badge.img

Or how to send incidents for PagerDuty to Discord.

Any ideas on what’s the best way?

Best answer by mwalls

Hey, ​@pessoa 

I think you can use webhooks for this. You can add a webhook endpoint to your account via the menu at “Integrations” > “Generic Webhooks v3”. (I think this is available for all accounts.. If not, check with your account team.)

There’s more on those in the knowledge base: https://support.pagerduty.com/main/docs/webhooks. You can choose which actions will send an update to the webhook as well.

It looks like Discord will allow you to create webhook destinations on channels in your Discord server: https://hookdeck.com/webhooks/platforms/how-to-get-started-with-discord-webhooks

That is what I would try. I don’t have a Discord server handy at the moment to try it out myself.

 

HTH,

--mandi

4 replies

mwalls
Forum|alt.badge.img
  • Community Manager
  • Answer
  • December 13, 2024

Hey, ​@pessoa 

I think you can use webhooks for this. You can add a webhook endpoint to your account via the menu at “Integrations” > “Generic Webhooks v3”. (I think this is available for all accounts.. If not, check with your account team.)

There’s more on those in the knowledge base: https://support.pagerduty.com/main/docs/webhooks. You can choose which actions will send an update to the webhook as well.

It looks like Discord will allow you to create webhook destinations on channels in your Discord server: https://hookdeck.com/webhooks/platforms/how-to-get-started-with-discord-webhooks

That is what I would try. I don’t have a Discord server handy at the moment to try it out myself.

 

HTH,

--mandi


Forum|alt.badge.img
  • Author
  • New Member
  • December 15, 2024

Thanks ​@mwalls! I had given that a try, The issue seems to be that PagerDuty generic webhook v3 sends a payload such as

{
"incident": {
"id": "ABC123",
"title": "Server Down",
"status": "triggered",
"urgency": "high"
}
}

and Discord is expecting something such as

{
"content": "🚨 **PagerDuty Alert**: Server Down",
"embeds": [
{
"title": "Incident Triggered",
"description": "Server Down",
"color": 16711680,
"fields": [
{
"name": "Status",
"value": "Triggered"
},
{
"name": "Urgency",
"value": "High"
}
]
}
]
}

I’m not seeing a way to convert this without throwing some middleware in there.

Is everyone using some middleware or I’m the first wanting to send PD data into Discord?


mwalls
Forum|alt.badge.img
  • Community Manager
  • December 16, 2024

🤔

@pessoa You’re sort of the first.

we had an internal hackweek project for a Discord bot a while back, but the dev has since left. The code wasn’t open sourced and it’s in Elixir. So I’m not entirely sure what all got implemented. I’ll ask around internally and see what’s up.


mwalls
Forum|alt.badge.img
  • Community Manager
  • December 16, 2024

Hi ​@pessoa 

Ok. From eng. I’ve not seen this feature used this way before.

If you are on the Enterprise plan for Incident Management, there is a setting in Incident Workflows that will allow you to add a generic external destination for incident information via an API call. You set up the destinations in Workflow Integrations.

You can also choose how the body of the message will be delivered to the remote endpoint using the templating engine. It would look something like:

 

{

"content": {{incident.title}},

"embeds": [

  { 

  "title": {{incident.title}},

  "description": {{incident.custom_fields.description}},

  "color": 16711680,

  "fields": [

    {

      "name": "Status",

      "value": {{incident.status}}

    },

    {

      "name": "Urgency",

      "value": {{incident.urgency}}

    }

  ]

  }

}

That might get you where you’re going. Otherwise, yeah, you’d need some kind of middleware to get something really custom.

 

HTH,

--mandi