Metering & Billing Notifications let you configure automated webhook alerts that trigger when specific usage thresholds or billing events occur. Instead of polling for usage data, you define rules that trigger notification events to a channel of your choice when conditions are met.
Notifications
Use cases
The following table describes the use cases for notifications:
|
Use case |
Description |
|---|---|
| Entitlement enforcement |
Receive a webhook when a customer reaches a percentage of their entitlement allowance (for example, 80% or 100%) and take action in your system, such as restricting access or sending a warning to the customer.
See Enforcing entitlement limits for details. |
| Customer warnings | Notify customers before they reach their usage limits to avoid unexpected service interruptions or overage charges. |
| Sales alerts | Alert your sales team when a customer approaches or exceeds their plan limits to trigger an upgrade conversation. |
| Invoice events | Receive a webhook when an invoice is created, issued, or paid to trigger downstream processes such as ERP sync or custom delivery. |
How it works
The Metering & Billing Notifications system is built around three entities:
flowchart LR
Rule["Rule
(when to trigger)"]
Channel["Channel
(where to send)"]
Event["Event
(the notification sent)"]
Rule --> Event
Event --> Channel
- Rule: Defines the condition that triggers a notification. When the condition is met, Metering & Billing sends a notification event to all channels attached to the rule.
- Event: The notification payload delivered to your channel when a rule triggers. Events include details about the customer, entitlement, and the threshold that was crossed.
- Channel: Defines where to send notifications. Currently, Metering & Billing supports webhook channels. A single channel can be referenced by multiple rules.
Channels
A channel defines a delivery destination for notification events. Metering & Billing supports webhook channels, which send an HTTP POST request with a JSON payload to a URL of your choice.
Use webhook channels to:
- Integrate with Slack incoming webhooks
- Trigger threshold-based email alerts via your email provider
- Call an internal API to cut off a customer’s access
- Forward events to your data warehouse or alerting platform
Create a channel
To create a webhook channel in Konnect:
- In the Konnect sidebar, click Metering & Billing.
- In the Metering & Billing sidebar, click Settings.
- Click the Notifications tab.
- Click Create Channel.
- In the Name field, enter a name for the channel.
- In the URL field, enter the webhook URL to deliver notifications to.
- (Optional) Add custom HTTP headers if your endpoint requires authentication.
- Click Save.
Verify webhook requests
When exposing a webhook endpoint, make sure the sender is authenticated before you process the payload. Metering & Billing lets you add custom HTTP headers when you create the channel. A common pattern is to configure a shared secret in a custom header, for example Authorization: Bearer <secret> or X-Webhook-Secret: <secret>, and validate that value in your webhook handler for every delivery.
Reject requests with a missing or invalid authentication header by returning a 400 or 401 response, and only process the notification after the header value matches the secret you configured on the channel.
Rules
A rule defines the condition that triggers a notification. When the condition is met, Metering & Billing delivers a notification event to the channels specified in the rule.
Metering & Billing supports the following rule types:
|
Rule type |
Description |
|---|---|
| Entitlement balance threshold | Triggers when a customer’s entitlement balance crosses a specified percentage or absolute threshold. |
| Entitlement reset | Triggers when an entitlement is reset, either manually or automatically. |
| Invoice created | Triggers when a new invoice is created. |
| Invoice updated | Triggers when an invoice changes state. |
Notifications for gathering invoices are not currently supported.
Entitlement balance threshold rules
Use this rule type to trigger notifications when a customer’s metered entitlement usage reaches a threshold. This is the primary rule type for implementing entitlement enforcement and customer warnings.
To create an entitlement balance threshold rule:
- In the Konnect sidebar, click Metering & Billing.
- In the Metering & Billing sidebar, click Settings.
- Click the Notifications tab.
- Click Create Rule.
- In the Name field, enter a name for the rule.
- From the Type dropdown menu, select “Entitlement balance threshold”.
- From the Channels dropdown menu, select one or more channels to deliver the notification to.
- (Optional) From the Features dropdown menu, select features to scope the rule to.
- From the Thresholds settings, add one or more thresholds. Each threshold triggers a separate notification event.
- Click Save.
Notification events
When a rule condition is met, Metering & Billing delivers a notification event as an HTTP POST request to all channels attached to the rule. The event payload is a JSON object containing the following information:
|
Field |
Description |
|---|---|
id
|
Unique identifier for the notification event. |
type
|
The rule type that triggered this event, for example entitlements.balance.threshold.
|
rule
|
The rule configuration that triggered this event. |
subject
|
The customer subject that triggered this event. |
threshold
|
The specific threshold that was crossed. |
feature
|
The feature key associated with the entitlement. |
entitlement
|
The entitlement configuration, including type and allowance. |
value
|
The current usage value or balance at the time the event was triggered. |
timestamp
|
The time at which the threshold was crossed. |
Each notification event has a delivery state:
|
State |
Description |
|---|---|
PENDING
|
The event was created but sending hasn’t started. |
SENDING
|
The event is actively being transmitted to the channel. |
SUCCESS
|
The event was delivered successfully. |
FAILED
|
The event couldn’t be delivered. |
You can view past notification events in Konnect by navigating to Metering & Billing > Settings > Notifications and clicking the name of the rule.
Enforcing entitlement limits
Metering & Billing tracks entitlement balances and triggers notification events when thresholds are crossed, but it does not automatically block API traffic when a customer’s entitlement is exhausted.
To enforce entitlement limits today, configure a webhook notification rule and handle the incoming event in your own system:
- Create a webhook channel pointing to an endpoint you control.
- Create an entitlement balance threshold rule with a threshold at 100% for the feature you want to enforce.
- In your webhook handler, take action when the event is received. For example:
- Remove the Consumer from a Kong Gateway Consumer Group that has access to the API.
- Return a
403 Forbiddenresponse from your application layer. - Update a feature flag in your system to disable access for the customer.
- (Optional) Add a second threshold at 80% to send a warning to the customer before access is cut off.