Webhooks
Only available in OpenMeter CloudOpenMeter webhooks enable you to report aggregated usage to external systems like billing and CRMs to keep your data in sync.
Webhooks can run every minute
, hour
, or day
and be filtered by both subject
and usage
.
Configuring Webhooks
OpenMeter Cloud has a UI to configure webhooks.
Setting up a webhook via API that reports the daily usage looks as:
Note how we use the optional filter
property here only to report usage greater than 100
.
Filtering is possible on both subject
and usage
. Available filters are: $gt
, $gte
, $lt
, $lte
, $eq
, $ne
, $in
and $nin
.
You can filter for specific subjects as filter: { subject: { $in: ["customer-1", "customer-2"] } }
.
Example Webhook Payload
Webhooks are delivered as JSON payloads to your webhook endpoint.
We deliver a separate webhook for each subject. The usage
array contains the aggregated usage for the subject.
If the report defines a group by the usage property, it will contain a separate entry for each group.
Consuming Webhooks
To deliver and verify webhooks we use the Svix webhook service. You can read more about veryfing payloads. Let's see the following Next.js example that verifies the webhook signature and logs the payload.
OpenMeter Cloud also gives you visibility into webhook delivery and errors.
Webhook Authentication
OpenMeter uses a signature to ensure the security and the authenticity of all of the webhooks. While signatures are the recommended way to secure your webhook endpoint, in environments where you can't verify the webhook signature, you can use HTTP Basic Authentication or Firewalls (IP blocking) to secure your webhook endpoint.
Read more about alternative webhook authentication and veryfing payloads on our webhook partner Svix's site.