Walkthrough of Alert Types

The following alert (aka. notification) types can be created using the Alerts UI Dashboard or Alerts API.

Usage

Usage is a scheduled alert.

  1. Specify using a cron expression (some cron examples).
  2. Set the range (hour, day, week, month).
  3. Select the meter by setting the meterId. It can found by calling the [Meter Definition API].(https://docs.amberflo.io/reference/get_meters) or UI Dashboard
  4. Select the thresholdCondition and set the thresholdValue

When the trigger condition is evaluated at the scheduled time, it will evaluate the condition against the current meter usage by calling the Usage API. If the condition is true for a customer, 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": "usage-alert",
    "meterId" : "4d1ca680-4974-11ec-ad9b-e1ce3f8b2ad3",
    "cron": "0 0 * * 0",
    "webhookUrl": "https://hooks.slack.com/services/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3",
    "email":"[email protected]",
    "thresholdCondition": "greater-than",
    "thresholdValue": "1000",
    "range":"day",
    "customerFilterMode": "per-customer",
    "enabled": false
}'

Prepaid Credits

This is a real time alert which applies to prepaid customers only. It fires an alert if a customer's prepaid credits are depleted so they can buy more credits.

  1. Set the prepaid limit thresholdValue
  2. The thresholdCondition is always less-than
  3. The range or time bucket is always the current billing cycle.

If the current prepaid value on the active invoice in the current billing cycle is below the thresholdValue for a customer, 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": "alert-for-prepaid",
    "notificationType": "prepaid",
    "email": ["[email protected]", "[email protected]"],
    "webhookUrl": "https://hooks.slack.com/services/T01HZB7A0M6/B01P3J0LE0H/OBRoTt8TmrJ2Zbv3bQAqH88",
    "thresholdValue": "1000",
    "customerFilterMode": "per-customer",
    "enabled": true
}'

Invoice

This is a real time alert which applies to customers with billing enabled by assigning them a pricing plan.

  1. Set the invoice total limit thresholdValue
  2. The thresholdCondition is always greater-than
  3. The range or time bucket is always the current billing cycle and applies to the active invoice.

If the current invoice total in the current billing cycle 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": "invoice-tracker",
    "notificationType": "invoice",
    "email": ["[email protected]"],
    "thresholdValue": "500",
    "customerFilterMode": "per-customer",
    "enabled": true
}'

Product Item Usage Limit

This is a real time alert which only applies to invoices having product items breakdown. Product items are linked to meters. This alert tracks the quantity or meter units for that meter as shown below on an invoice.

1181
  1. Select the meter by setting the meterId. It can found by calling the Meter Definition API or UI Dashboard
  2. Select the pricing plan by setting the productPlanId. This can be obtained from the Account Pricing API or UI Dashboard
  3. Set the meter units limit thresholdValue
  4. The thresholdCondition is always greater-than
  5. 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": ["[email protected]"],
    "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.

  1. Select the meter by setting the meterId. It can found by calling the Meter Definition API or UI Dashboard
  2. Select the pricing plan by setting the productPlanId. This can be obtained from the Account Pricing API or UI Dashboard
  3. Set the product item charge limit thresholdValue
  4. The thresholdCondition is always greater-than
  5. 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": ["[email protected]"],
    "thresholdValue": "200",
    "customerFilterMode": "per-customer",
    "meterId":"21b71110-ee51-11ec-ad99-5b1b04dba7a5",
    "enabled": true
}'

Undefined Customer

This is a scheduled alert triggered when some ingested records references a customer that has not been defined in Amberflo. Note that there is a cool down period of one hour 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": ["[email protected]"]
}'

Undefined Meter

This is a scheduled alert triggered when some ingested records references a meter that has not been defined in Amberflo. Note that there is a cool down period of one hour 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 Meter",
    "notificationType": "undefined-meter",
    "email": ["[email protected]"]
}'

What’s Next