RevenueCat logo
Cloudflare D1 logo

Workflow template

Log RevenueCat subscription cancellations and expirations in D1

Keep a D1 record for each cancellation or expiration, keyed by its RevenueCat event ID.

How it works

Record RevenueCat cancellations and expirations in D1

1 Trigger · 1 Filter · 1 Action
RevenueCat1 · Trigger

Any Subscription Event

Start the Workflow when any subscription event occurs.

FastHook2 · Filter

Only cancellations and expirations

Continue only when the configured conditions match the incoming record.

Cloudflare D13 · Action

Insert the subscription event once

Run a statement with bound values, or send a batch. Each row in the results uses the column names from your query.

Before activation

Set up your workflow

  1. Create the subscription events table

    In the destination D1 database, run CREATE TABLE IF NOT EXISTS subscription_churn (event_id TEXT PRIMARY KEY, event_type TEXT, customer_id TEXT, product_id TEXT, event_timestamp_ms INTEGER, cancel_reason TEXT, environment TEXT).

  2. Connect RevenueCat and select the D1 database

    Connect the RevenueCat project in the trigger. In “Insert the subscription event once”, connect Cloudflare D1 and select the database that contains subscription_churn. The filter forwards cancellations and expirations that have a RevenueCat event ID.

  3. Check an event against a test database

    Use a RevenueCat sandbox cancellation or expiration. Check the D1 row for its event ID, type and environment. Processing the same event ID again should leave one row.

Explore connected apps