Custom Notification Method

We have an internal API that handles event notifications. Is it possible to perform an HTTP POST with JSON body for an alert action?

Thanks

Yes it is. You can simply using python requests for this.
Get context from environment:

def sendmsg(url, data, verify=False):
    headers = {'Content-Type': 'application/json'}
    try:
        r = requests.post(url, data=data, headers=headers, verify=verify_cert)
        is_success = True
    except:
       is_success = False
    return is_success
 

context = dict([(var[7:], value.decode("utf-8"))
                for (var, value) in os.environ.items()
                if var.startswith("NOTIFY_")])
data = json.dumps(context)
sendmsg(url, data, verify=verify_cert)

I hope it helps.

Cheers,
Christian

This is great to hear. Looking at a new notification rule I don’t see an option to do this under the notification method dropdown box. Is this possible within the interface to configure?

Looks like the available options are based on the scripts in the applicable scripts directory.

Here is the doc that touches on it -

Thanks for your response!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.