Skip to content

feat: add custom payload support to Grafana OnCall provider#6176

Open
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:feat/grafana-oncall-custom-json
Open

feat: add custom payload support to Grafana OnCall provider#6176
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:feat/grafana-oncall-custom-json

Conversation

@DragonBot00
Copy link
Copy Markdown

Summary

Adds an optional payload parameter to the Grafana OnCall provider's _notify method, allowing users to send a fully custom JSON body to the OnCall webhook instead of the default structured payload.

Motivation

The Grafana OnCall webhook accepts arbitrary key-value pairs for custom templating, but the provider was limited to a fixed set of fields (title, message, alert_uid, image_url, state, link_to_upstream_details). This prevented users from leveraging OnCall's full templating capabilities.

Closes #5316

Changes

  • Added optional payload: dict | None = None parameter to _notify
  • When payload is provided, it is sent directly to the webhook — giving full control over the request body
  • When payload is None (default), the existing structured body is used — fully backwards compatible
  • Fixed duplicate __init__ definition in the original file (two __init__ methods were defined)
  • Cleaned up minor formatting issues

Usage example

- name: notify-oncall
  provider:
    type: oncall
    config: "{{ providers.grafana_oncall }}"
  with:
    payload:
      title: "{{ alert.name }}"
      custom_field: "{{ alert.labels.severity }}"
      runbook_url: "https://wiki.example.com/runbooks/{{ alert.name }}"

Testing

  • Existing behaviour (no payload argument) remains unchanged
  • When payload is passed, it is forwarded directly without modification

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

@DragonBot00 is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 1, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added Enhancement New feature or request Provider Providers related issues labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Provider Providers related issues size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Allow custom JSON input for Grafana OnCall Provider

2 participants