Alerts and Webhooks
Notifications (Alerts)
Create a notification
1min
code examples curl location 'https //app amberflo io/notifications' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data raw '{ "name" "too many api calls", "description" "alert on too many api calls", "notificationtype" "usage", "meterid" "24ad0b40 a217 11eb b01a 19ff91d9370d", "cron" "", "frequency" "every 1h", "createprepaidcard" false, "prepaidprice" 0, "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01u390llbx/j4kltxm8c5xesscfzmjr2cj2", "webhookheaders" "", "webhookpayload" "", "email" \[ \[ "alert\@mycompany io" ] ], "emailtocustomer" false, "filter" "", "filterbytags" "", "groupbydimensions" \[ "" ], "customsubject" "", "thresholdcondition" "greater than", "thresholdvalue" 0, "range" "day", "customerfiltermode" " ", "customerid" "", "productplanid" "", "enabled" false }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "name" "too many api calls", "description" "alert on too many api calls", "notificationtype" "usage", "meterid" "24ad0b40 a217 11eb b01a 19ff91d9370d", "cron" "", "frequency" "every 1h", "createprepaidcard" false, "prepaidprice" 0, "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01u390llbx/j4kltxm8c5xesscfzmjr2cj2", "webhookheaders" "", "webhookpayload" "", "email" \[ \[ "alert\@mycompany io" ] ], "emailtocustomer" false, "filter" "", "filterbytags" "", "groupbydimensions" \[ "" ], "customsubject" "", "thresholdcondition" "greater than", "thresholdvalue" 0, "range" "day", "customerfiltermode" " ", "customerid" "", "productplanid" "", "enabled" false }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //app amberflo io/notifications", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //app amberflo io/notifications") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "name" "too many api calls", "description" "alert on too many api calls", "notificationtype" "usage", "meterid" "24ad0b40 a217 11eb b01a 19ff91d9370d", "cron" "", "frequency" "every 1h", "createprepaidcard" false, "prepaidprice" 0, "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01u390llbx/j4kltxm8c5xesscfzmjr2cj2", "webhookheaders" "", "webhookpayload" "", "email" \[ \[ "alert\@mycompany io" ] ], "emailtocustomer" false, "filter" "", "filterbytags" "", "groupbydimensions" \[ "" ], "customsubject" "", "thresholdcondition" "greater than", "thresholdvalue" 0, "range" "day", "customerfiltermode" " ", "customerid" "", "productplanid" "", "enabled" false }) response = https request(request) puts response read body import requests import json url = "https //app amberflo io/notifications" payload = json dumps({ "name" "too many api calls", "description" "alert on too many api calls", "notificationtype" "usage", "meterid" "24ad0b40 a217 11eb b01a 19ff91d9370d", "cron" "", "frequency" "every 1h", "createprepaidcard" false, "prepaidprice" 0, "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01u390llbx/j4kltxm8c5xesscfzmjr2cj2", "webhookheaders" "", "webhookpayload" "", "email" \[ \[ "alert\@mycompany io" ] ], "emailtocustomer" false, "filter" "", "filterbytags" "", "groupbydimensions" \[ "" ], "customsubject" "", "thresholdcondition" "greater than", "thresholdvalue" 0, "range" "day", "customerfiltermode" " ", "customerid" "", "productplanid" "", "enabled" false }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful response { "id" "", "name" "", "description" "", "notificationtype" "", "meterid" "", "cron" "", "frequency" "", "createprepaidcard" false, "prepaidprice" 0, "webhookurl" "", "webhookheaders" "", "webhookpayload" "", "email" \[ "" ], "emailtocustomer" false, "filter" "", "filterbytags" "", "groupbydimensions" \[ "" ], "customsubject" "", "thresholdcondition" "", "thresholdvalue" 0, "range" "", "customerfiltermode" "", "customerid" "", "productplanid" "", "enabled" false, "createtime" 0, "updatetime" 0 }