Remind account managers 60 days before a renewal
Post to Slack and open a CRM task 60 days before a contract renews, from Supabase, once per contract term, so no renewal reaches its last week unnoticed.
- Supabase
- Slack
- Any REST API
- Renewals
- once per contract term
The trigger
One read-only SELECT against Supabase. Rowfire polls it for new rows, and the rule fires once per contract term.
SELECT c.id AS contract_id,
c.ends_at::date AS term_ends_on,
a.id AS account_id,
a.name AS account,
c.annual_value,
c.currency,
m.full_name AS account_manager,
m.email AS account_manager_email,
c.ends_at - interval '60 days' AS renewal_due_at
FROM contracts c
JOIN accounts a ON a.id = c.account_id
LEFT JOIN profiles m ON m.id = a.account_manager_id
WHERE c.status = 'active'
AND c.renewed_at IS NULL
AND c.cancelled_at IS NULL
AND a.is_test = falseA contract’s end date sits in a column from the day it is signed. Nothing in the app runs when that date gets close, so the renewal shows up when someone remembers to sort a spreadsheet by end date, or when the customer’s invoice does. Sixty days is enough time to talk about seats and price. Six is not.
The query lists every active contract that hasn’t renewed or been cancelled,
with a computed clock: renewal_due_at, 60 days before ends_at. The key is
contract_id together with term_ends_on, so each term of a contract counts
as one thing. The rule fires once per contract term: once this year, and
once again next year after the end date moves.
A contract that renews or cancels before its 60-day mark drops out of the
query and never fires. Test accounts are filtered out. Tables without a schema
are read as public, which is where an app on Supabase usually keeps them.
Table and column names are a sketch; adapt them to your schema.
The Slack side
Bind a Slack action that posts to #renewals, with the row’s columns in the
message:
{{ account }} renews on {{ term_ends_on }}: {{ annual_value }} {{ currency }} a year. Account manager: {{ account_manager }}.
A task in your CRM
A channel message is easy to scroll past. If your CRM has a REST API for tasks, add it as an integration (its base URL, its auth and a create-task call), then add a second rule on the same trigger:
POST /tasks
{"subject": "Renewal: {{ account }}", "due_date": "{{ term_ends_on }}", "owner_email": "{{ account_manager_email }}", "account_id": "{{ account_id }}"}
Each rule keeps its own count, so the Slack post and the task fire independently, and one can stay in shadow while the other is live.
A longer runway for large contracts
Bigger contracts often need more than 60 days. That is a second trigger with
interval '120 days' and a filter on c.annual_value, with its own rule and
its own channel. The 60-day rule keeps running for everyone else.
Backtest the rules over the last few months to see how many renewals each would have flagged, then watch them in shadow before they go live. For a related warning about an account’s size, see alert sales when an account nears its seat limit, or try a trigger on the live demo.
Questions
Nothing happens in the app 60 days before a renewal. How does this fire?
The clock is computed in the query: renewal_due_at, 60 days before ends_at. When a poll sees renewal_due_at pass for a row that still matches, the rule fires.
The same contract renews every year. Will it fire again next year?
Yes, once. The key is contract_id together with term_ends_on, so each term is one thing. A new end date is a new key; the same term never fires twice.
Will renewals already inside the 60-day window fire when I switch it on?
No. The poller starts every trigger at now, so history never fires. A backtest shows what the rule would have done over past days, without sending anything.
Does Rowfire need my Supabase database password?
No. It sends the query to Supabase's read-only query endpoint, which runs it as Supabase's read-only user. You connect with OAuth (Projects: Read and Database: Read) or a personal access token.