Notify customers at 90% of their quota
Send a Braze event when a customer's usage in PostgreSQL passes 90% of their plan quota, at most once a month, so a push or email campaign can warn them.
- PostgreSQL
- Braze
- Any REST API
- Product
- once per account per month
The trigger
One read-only SELECT against PostgreSQL. Rowfire polls it for new rows, and the rule fires once per account per month.
SELECT a.id AS account_id,
a.name AS account,
u.used,
a.quota,
round(100.0 * u.used / a.quota) AS percent_used,
u.measured_at
FROM usage_snapshots u
JOIN accounts a ON a.id = u.account_id
WHERE a.quota > 0
AND u.used >= 0.9 * a.quotaThis is a derived event: no single line of code marks the moment usage crosses 90%. The query computes it from data you already store. Table and column names here are a sketch; adapt them to your schema.
The clock is measured_at and the key is account_id. Once per account per
month means one warning per billing cycle, however many snapshots stay above
the line.
Where it goes
- Braze
track_eventwithexternal_idset to{{ account_id }}and an event name likequota_90_percent. A campaign triggered by that custom event sends the push or email, withpercent_usedas an event property. - Your own push provider’s API, configured as an integration, with the same columns in its request body.
Run it in shadow first: the recorded requests show exactly which customers would have been warned. For the account side of the same idea, see seat-limit alerts for sales.
Questions
Why not send the push from the application?
Usage usually crosses 90% inside a metering job or a batch import, not in a request your app handles. The threshold is a derived condition, which a query states in one line.
Can it go to our own push provider instead of Braze?
Yes. Any REST API can be an integration: set its base URL, auth and request body, and bind it to the same trigger.