Skip to content

Commit

Permalink
fix: webhook request parsing (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
anloubie2 committed May 20, 2024
1 parent b79fa3c commit 6ba916f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/alerting/notif_channel_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,19 +559,20 @@ type WebhookMessage struct {

func NewWebhookMessage(app *bunapp.App, alert org.Alert, payload any) *WebhookMessage {
baseAlert := alert.Base()
baseEvent := alert.GetEvent().Base()

msg := new(WebhookMessage)

msg.ID = baseAlert.Event.ID
msg.EventName = baseAlert.Event.Name
msg.ID = baseEvent.ID
msg.EventName = baseEvent.Name
msg.Payload = payload
msg.CreatedAt = baseAlert.Event.CreatedAt
msg.CreatedAt = baseEvent.CreatedAt

msg.Alert.ID = baseAlert.ID
msg.Alert.URL = app.SiteURL(baseAlert.URL())
msg.Alert.Name = baseAlert.Name
msg.Alert.Type = baseAlert.Type
msg.Alert.Status = baseAlert.Event.Status
msg.Alert.Status = baseEvent.Status
msg.Alert.CreatedAt = baseAlert.CreatedAt

return msg
Expand Down

0 comments on commit 6ba916f

Please sign in to comment.