Need help to append the json payload to my webhook

139 views
Skip to first unread message

surendra matta

unread,
Jun 27, 2022, 4:23:32 PM6/27/22
to Prometheus Users
Hi All,

I need help to append my JSON to the below webhook
receivers:
- name: "webhook_sample"
    webhook_configs:
    - url: '<webhook url>'
      send_resolved: true
      http_config:
        basic_auth:
          username: <username>
          password: <pwd>

I want to append the below JSON to the above receiver

{
   "request": {
      "entry": {
         "u_description": " description2",
         "u_work_notes": " work notes",
         "u_assignment_group": "APM Team",
         "u_impact": "2",
         "u_urgency": "2"
      }
   }
}

could someone please help with this?

Regards,
Venkat

Brian Candler

unread,
Jun 28, 2022, 5:52:03 AM6/28/22
to Prometheus Users
AFAIK, alertmanager webhook JSON is fixed.  If you want to send something else, then you have to write your own webhook receiver which receives the request from alertmanager and then reformats it and resends it to the upstream service.

Have a look at other projects which already do this, e.g. prom2teams

surendra matta

unread,
Jun 28, 2022, 2:36:21 PM6/28/22
to Prometheus Users
Sorry for asking multiple times, can I have an example of how to pass the payload in the webhook for the  post request or any POST-WEBHOOK JSON example

Brian Candler

unread,
Jun 28, 2022, 3:34:47 PM6/28/22
to Prometheus Users
Yes: the source code for prom2teams is on github, and you can follow that.

You cannot change the payload in the webhook *as it is sent by Alertmanager*. Hence you need to run a piece of software which will receive the alertmanager webhook, change the contents, and then resend it to the final destination.  Just like prom2teams does.

Reply all
Reply to author
Forward
0 new messages