Alerts & Webhooks
Alert Types
11 min
the following alert (aka notification) types can be created using the alerts ui dashboard or create a notification docid\ f6y3dmmq5u0ffdwbcxkjq usage usage alerts are scheduled checks that trigger based on meter consumption specify using a cron expression ( some cron examples ) set the range ( hour , day , week , month ) select the meter by setting the meterid it can found by calling the \[meter definition api] ( get a list of meters ) or ui dashboard select the thresholdcondition and set the thresholdvalue at the defined schedule, amberflo calls the usage api to evaluate the condition against the current usage if the condition is met for a customer, the alert is triggered curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "usage alert", "meterid" "4d1ca680 4974 11ec ad9b e1ce3f8b2ad3", "cron" "0 0 0", "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01n83nqv6h/lma2syqdunv3a7clbbd9v3223", "email" "batman\@amberflo io", "thresholdcondition" "greater than", "thresholdvalue" "1000", "range" "day", "customerfiltermode" "per customer", "enabled" false }' prepaid credits this is a real time alert that applies only to prepaid customers it triggers when a customer's prepaid credits fall below a defined threshold, prompting them to top up set the thresholdvalue for the prepaid balance the thresholdcondition is always less than the evaluation is done for the current billing cycle if a customer's prepaid balance on the active invoice drops below the threshold, the alert will be fired curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "alert for prepaid", "notificationtype" "prepaid", "email" \["batman\@gmail com", "batman\@wayne io"], "webhookurl" "https //hooks slack com/services/t01hzb7a0m6/b01p3j0le0h/obrott8tmrj2zbv3bqaqh88", "thresholdvalue" "1000", "customerfiltermode" "per customer", "enabled" true }' invoice invoice alerts are real time and apply to customers with billing enabled through an assigned pricing plan set the thresholdvalue for the total invoice amount the thresholdcondition is always greater than the evaluation is based on the current billing cycle and applies to the active invoice if the total on a customer’s current invoice exceeds the set threshold, an alert is triggered curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "invoice tracker", "notificationtype" "invoice", "email" \["batman\@wayne io"], "thresholdvalue" "500", "customerfiltermode" "per customer", "enabled" true }' product item usage limit this real time alert is relevant only to invoices that include a breakdown by product items since product items are mapped to specific meters, the alert monitors meter unit consumption (or quantity) for a product item as displayed on the invoice select the meter by setting the meterid it can found by calling the meter definition api or ui dashboard select the pricing plan by setting the productplanid this can be obtained from the account pricing api or ui dashboard set the meter units limit thresholdvalue the thresholdcondition is always greater than the range or time bucket is always the current billing cycle if the meter units or quantity on the current invoice for the selected meter and pricing plan exceeds the thresholdvalue , then it will fire an alert curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "product item units tracker", "notificationtype" "product item units", "productplanid" "ff9c55a9 4796 480f ab77 2ae943ae1700", "email" \["batman\@wayne io"], "thresholdvalue" "100", "customerfiltermode" "per customer", "meterid" "21b71110 ee51 11ec ad99 5b1b04dba7a5", "enabled" true }' product item charge amount this is the same as product item usage limit , except it tracks the product item total charge on the current invoice instead of the meter units select the meter by setting the meterid it can found by calling the meter definition api or ui dashboard select the pricing plan by setting the productplanid this can be obtained from the account pricing api or ui dashboard set the product item charge limit thresholdvalue the thresholdcondition is always greater than the range or time bucket is always the current billing cycle if the total product item total charge on the current invoice for the selected meter and pricing plan exceeds the thresholdvalue , then it will fire an alert curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "product item price tracker", "notificationtype" "product item price", "productplanid" "ff9c55a9 4796 480f ab77 2ae943ae1700", "email" \["batman\@wayne io"], "thresholdvalue" "200", "customerfiltermode" "per customer", "meterid" "21b71110 ee51 11ec ad99 5b1b04dba7a5", "enabled" true }' undefined customer this scheduled alert is triggered when ingested records reference a customer that does not exist in amberflo to prevent alert fatigue, there is a one hour cool down period between alerts of this type curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "undefined customer", "notificationtype" "undefined customer", "email" \["batman\@wayne io"] }' undefined meter this scheduled alert is triggered when ingested records reference a meter that has not been defined in amberflo like the undefined customer alert, it includes a one hour cool down period between notifications curl location request post 'https //app amberflo io/notification' \\ \ header 'content type application/json' \\ \ header 'x api key xyz' \\ \ data raw '{ "name" "undefined meter", "notificationtype" "undefined meter", "email" \["batman\@wayne io"] }'