Customize body of webhook contact point in alerting

With the webhook contact point of Grafana alerting I want to trigger a Twilio flow. For this I need to add a ‘To’ and ‘From’ parameter (example in curl can be found below)

curl -X POST "https://studio.twilio.com/v1/Flows/FW9d816f0b90d2a10b913868462e339d29/Executions" --data-urlencode "To=+1646221xxxx" --data-urlencode "From=+1331481xxxx" --data-urlencode "Parameters={\"name\":\"zeke\"}" -u ACCOUNT_SID:AUTH_TOKEN

Where can I add these parameters? I’m tried it with a template but I’m unable to add a template to a webhook.

I’m using a self hosted Grafana V19

Thanks in advance

welcome to the :grafana: forum, @brecht

I believe this is only place where you can add args / parameters to your webhook request:

If this isn’t enough then you might want to consider filing a feature request:

for feature requests to Grafana OSS we ask the community to make a post here, in GitHub Discussions. It can then get upvoted by fellow users. Devs use this to gauge interest in new features:

I would check and make sure someone hasn’t already started a thread:

Hi

Kindly share if any update about this request. Customize body of webhook contact point in alert.

I am trying to upload payload to servicenow to create incident when grafana alerts.

Thanks.

Hi! This is not possible at present, but it is something that is being discussed within the Alerting team. We haven’t decided how it should work and so I don’t have a date of when this feature might be available.

Hello @georgerobinson,

Have we made any progress on this feature? do we have any alternate approach which we can use in the meanwhile? - The idea is to Trigger Post Webhook call with certain parameters whenever an alerting situation happens.

Regards,

Hi! I’m afraid we don’t have an update to share on templating webhooks in either Grafana or Alertmanager. I think the current recommendation is to run a service in between Grafana and the receiving service that can translate the JSON as required.

Hi @goetschhofer ,

What about something as simple as this? Will this currently work with grafana alert?

curl \
  -X POST \
  -H "Authorization: Bearer <MY TOKEN>" \
  https://api.github.com/repos/<my repo> \
  -d '{"ref":"LINK","inputs":{"tenant_id":"aaa"}}'

Steven

1 Like

Mr. @georgerobinson and Mr. @mattabrams,

Facing same issue, either my message format is not correct, or it is not supported.

 curl -X POST  https://api.restful-api.dev/objects/ff8081818e21ce2d018e55fc69903891 \
-H "Content-Type: application/json"  \
-d '{ "name": "Apple MacBook Pro 16", "data": { "year": 2019, "price": 2049.99, "CPU model": "Intel Core i9", "Hard disk size": "1 TB", "color": "silver" } }'

Putting the json payload to this ‘message’ section is not working. Kindly assist.

Infact, after trigger alert, the webhook(public api in mycase) do receive a http request , but after fetching the object, the name and data is null, it was a long string value before:

Do I have to use the templating labels mentioned here. Kindly assist how.
Thank you for your time.

Anyone has an example how to send a simple post with body ? No way this doesn t work, right ? :slight_smile: