Skip to content

Added more json fields to AlertStatus webhook notification#4445

Open
MichaelUray wants to merge 9 commits intotarget:masterfrom
MichaelUray:master
Open

Added more json fields to AlertStatus webhook notification#4445
MichaelUray wants to merge 9 commits intotarget:masterfrom
MichaelUray:master

Conversation

@MichaelUray
Copy link
Copy Markdown

Description:
Added more json fields to the AlertStatus webhook notification.
Added make test in documentation "Contributing to GoAlert".

for AlertStatus updates:

	Summary     string
	Details     string
	ServiceID   string
	ServiceName string
	Meta        map[string]string

Before these fields were only available in Alert notifications and it was not possible to send them to the user with acknowledge or close events.
notification for Alart and AlartStatus
Before was that field not available and it was not possible to send them to the user with messages.
Comment thread notification/webhook/sender.go Outdated
Comment thread notification/webhook/sender.go Outdated
MichaelUray and others added 2 commits December 1, 2025 23:00
Co-authored-by: Nathaniel Caza <mastercactapus@gmail.com>
AlertURL contains the full link to the alert page, or to the alarm list of the according service if it is an alert bundle.
Comment thread notification/webhook/sender.go Outdated
Comment on lines +133 to +142
@@ -127,13 +139,20 @@ func (s *Sender) SendMessage(ctx context.Context, msg notification.Message) (*no
ServiceID: m.ServiceID,
ServiceName: m.ServiceName,
Count: m.Count,
AlertURL: fmt.Sprintf("%s/services/%s/alerts", pubURL, m.ServiceID),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to use cfg.CallbackURL which accounts for things like the short URL generation

for example cfg.CallbackURL(fmt.Sprintf("/services/%s/alerts", m.ServiceID))

MichaelUray and others added 3 commits December 22, 2025 11:32
fmt.Sprintf("%s/alerts/%d", pubURL, m.AlertID)
with
cfg.CallbackURL(fmt.Sprintf("/alerts/%d", m.AlertID))
- Rename AlertURL to GoAlertURL as suggested, since the URL points to
  GoAlert itself, not to anything notification-specific
- Remove unused pubURL variable (cfg.CallbackURL is used instead)
- Remove unused strings import
@MichaelUray
Copy link
Copy Markdown
Author

@mastercactapus thanks for the review. All feedback is addressed in the latest commits:

  1. deprecated cfg.General.PublicURL → now using cfg.CallbackURL(fmt.Sprintf(...)) everywhere so short URL generation and any other callback behaviour is preserved (sender.go).
  2. field naming → renamed the field to GoAlertURL as suggested, so it is clear the URL points to GoAlert itself rather than any notification service.
  3. removed unused imports/variables → the intermediate pubURL variable and the unused strings import are gone.

The final layout:

  • Alert/alerts/<id>
  • AlertBundle/services/<id>/alerts
  • AlertStatus/alerts/<id>

Ready for another look when you have a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants