Blog
Trigger an AI Agent When a RevenueCat Subscription Expires
Tutorial
ยท
Quick answer: To trigger an AI agent when a RevenueCat subscription expires, add the RevenueCat Trigger to a BuildShip workflow and copy the endpoint URL from the trigger. In the RevenueCat Dashboard, open your project, go to Integrations, add a Webhook, paste that URL, and choose the environment (Sandbox or Production). Subscribe to Expiration and, if you also want failed renewals, Billing issue. Set an authorization secret in both RevenueCat and the triggerโs Auth Token field if you want the requests verified. When a subscription expires, the agent can update the userโs access in your own profile store and queue a win-back notification. A general chat agent cannot receive the webhook, change entitlements or leave a log of the run.

A mobile subscription often ends quietly. The period runs out at 02:11. If your process is a weekly export from RevenueCat, the user has already had days of a lapsed account, or days of features they should no longer have, before anyone notices. A chat agent can draft a win-back message if you paste in the customer, but it cannot receive the webhook, switch off a paid flag or send the notification from your app.
That is the job of an AI agent with a backend. The RevenueCat event is the trigger. The agent decides what to say and what to change. BuildShip keeps a log of both.
Why an expiry agent beats a weekly export
RevenueCat already normalises App Store and Play billing into a single stream of subscription events. The RevenueCat Trigger is how those events start a BuildShip workflow, instead of sitting in a dashboard until someone opens it.
A general chat agent cannot do this on its own:
It has no URL that RevenueCat can call.
It cannot update a feature flag in your user profile, write a win-back record or talk to your push provider.
It leaves no step-level log of which app user id expired or what you sent them.
The agent is useful because the next step is not a single template. A subscriber who used the app every day last week is a different conversation from one who barely opened it. A billing-issue event is not the same as a clean expiration: one may still be fixable with a card update, the other is already over. Cancellation is a third case. The subscriber has asked to stop, but the period may still be running, so this workflow should not treat a cancellation as an expiration unless you have decided that access should end immediately. The agent can look at usage and history in your own database, decide whether to queue a win-back, a billing reminder or a quiet downgrade, and write that decision down.
This is not the same job as the Stripe payment-failure agent. Stripe is web and invoicing. RevenueCat is in-app subscriptions. Keep them as separate workflows, even if both end in a message to the customer.
What the RevenueCat Trigger actually does
The RevenueCat Trigger receives webhook events from your RevenueCat project, verifies them if you have set an Auth Token, and parses the body so your workflow can use it.
Unlike some other BuildShip payment triggers, this one does not create the webhook for you. RevenueCatโs webhook is a manual integration. BuildShipโs trigger docs, and the guide to creating triggers, treat it that way: you copy the endpoint and paste it into RevenueCat.
Once it is set up, the trigger returns two useful objects:
request: the incoming query, headers and body.output: the parsed payload from the webhook body.
You map those into workflow inputs with Get Data after a test event. There is no output mapping on the trigger itself. Writes to your database, RevenueCat or a notification service happen in later nodes.
The events you can subscribe to in RevenueCat include Initial purchase, Renewal, Product change, Cancellation, Billing issue, Non-renewing purchase, Uncancellation, Transfer, Subscription paused, Expiration, Subscription extended, Invoice issuance and Temporary entitlement grant. For this agent, start with Expiration. Add Billing issue if you also want a path for a charge that failed while the subscription is still in term. Leave the rest off unless you have a clear job for them in this same workflow.
A concrete case: expire access, then queue a win-back
Take an app that keeps its own user profile, with a plan field and a features list, because the client reads those from your backend, not only from RevenueCat entitlements. When a subscription expires, two things need to happen quickly: paid features should turn off, and a good customer should get a chance to come back.
Here is the path I would build:
RevenueCat sends an Expiration event (or a Billing issue, if you subscribed to that too) to the webhook URL.
The RevenueCat Trigger starts the workflow and maps the parsed
outputto inputs, including the event type and the app user id.A Branch node continues only for Expiration and Billing issue. Anything else that slips through should stop, so a renewal never turns features off.
The workflow loads the user profile and a short usage summary from your database: last active date, plan name, and whether they have been billed before.
For Expiration, a script or Branch node sets the profileโs paid features to the free set, and writes
expired(or similar) on the plan field. Do this in code. Do not let the model decide who still has access.An AI step writes a short win-back notification, or a billing-repair message if the event was a billing issue, using only the usage and plan you already loaded. It must not invent a discount you do not offer.
If the account looks worth a win-back, the workflow queues that message through your push or email provider and writes a
winback_queuedrow with the event, the copy and apendingstatus. A quiet or long-inactive account can skip the message and only record the downgrade.If a win-back row for this expiration already exists, do not queue a second notification.
The model is there for the wording and the โis this worth a message?โ judgement, within rules you set. The entitlement change and the queue write are ordinary backend work.

Turn access off in code. Use the model for the message, not for who still has the paid plan.
Set up the trigger
In BuildShip, create a workflow, open the Connect tab and add RevenueCat Trigger.
Click the URL icon on the trigger and copy the endpoint URL.
In the RevenueCat Dashboard, open your project. Under Integrations, add an integration, then under RevenueCat core tools choose Webhooks and create a new webhook.
Give it a name you will recognise, such as โBuildShip expiry agentโ. Paste the endpoint URL into Webhook URL.
Optionally set an Authorization Header Value, and put the same secret in the triggerโs Auth Token field. If you set it on one side, set it on the other. If you set it on neither, RevenueCat will send the webhook without that check.
Choose Sandbox while you test, or Production when you ship.
Select Expiration. Add Billing issue if this workflow should also handle a failed charge. Do not tick every event โto be safeโ.
Send a test event from RevenueCat, or expire a sandbox subscriber, then click Get Data in BuildShip and map the parsed
outputfields you need, especially the event type and the app user id.
Keep sandbox and production as separate, obvious setups. You do not want a test agent notifying real users. RevenueCat also lets you send a test event from the webhook settings. Use that for the first Get Data pass, then expire a sandbox subscriber so you can see a full payload, including the app user id your profile lookup will need.
Build the expiry agent
Filter the event first. A single webhook can be configured for several events. The first Branch in the workflow should read the event type from the parsed output and continue only on Expiration or Billing issue.
Change access in code. Look up the user by app user id and update the profile. Paid features go off on Expiration. A Billing issue may keep access until the term ends, and instead set a billing_issue flag your app already knows how to show. Write those rules in a script or Branch node, then log what you changed.
Draft the message, with limits. Add an AI node (keyless nodes run on your BuildShip credits, or you can bring your own provider key):
> You write short in-app notifications. Using only the plan name, last active date and event type provided, write one notification of no more than 140 characters. For an expiration, invite the user back without inventing a discount. For a billing issue, ask them to update their payment method. Do not mention features they did not have. If last active is older than 60 days, reply with SKIP and a one-line reason.
Queue, do not send twice. If the model returns SKIP, write the downgrade (or the billing flag) and stop. Otherwise, call your push or email provider and store the copy with pending or sent. Use the app user id plus the event timestamp or a RevenueCat event id, if you mapped one, as a key so a retried webhook does not send two messages.
Keep RevenueCat and your profile in view. This workflow updates your own store, because that is what the app reads. If you also need to grant or revoke a promotional entitlement in RevenueCat, do that in a later, explicit step, and log it. Do not hide a RevenueCat write inside the prompt.
If you would rather not wire the canvas by hand, click Build with AI to open Compass and describe the flow in plain language. It builds on your actual canvas, so you can still test and edit every step. For a longer win-back sequence, the workflow can hand off to an AI agent built with Agent Max.

The entitlement write and the notification queue are the point of the agent.

Leave unused events off. A renewal should never take the same path as an expiration.
Test it, ship it and watch one expiry through
In RevenueCat sandbox, expire a test subscriber, or send a test Expiration webhook.
Confirm Get Data shows the parsed output, the profileโs paid features turned off, and a win-back row appeared or was skipped for a documented reason.
Send the same event again and confirm you do not get a second notification.
Repeat with a Billing issue test if you subscribed to it, and confirm access was not removed by mistake.
Click Ship, then point the production webhook at the production workflow only when the sandbox path is right.
Open the logging panel at the bottom of the workspace to see what happened. You can switch from the Workflow view to the Node view to read the logs for a single step, and test runs show live logs as they happen. Production logs usually show up within about 45 seconds, and the refresh icon loads them straight away. To add your own messages, use the Log Message to Console node, or call logging.log inside any nodeโs code.
See the logging docs and the node failure docs for retries. Use version history before you change a live win-back prompt.
Built for teams that run this in production
Expiry workflows touch access and messages, so a few things matter beyond the first test:
Full code access. Open any node to read or change its JavaScript or TypeScript.
Team access control. Role-based access lets you decide who can view a workflow, who can edit it and who can ship it.
Your own Google Cloud. Workflows run on Google Cloud, and you can run them in your own Google Cloud project as an enterprise option.
A log per subscriber. When someone asks why a user lost a feature or received a message, you can open the run and see the event, the profile write and the copy.
For the wider pattern of starting an agent from a payment event rather than from a timer, see Why AI Agents Need Listeners, Not Cron Jobs. If your other product bills through Stripe, use the failed-payment guide for that stack, not this one.
FAQ
Can I trigger an AI agent from a RevenueCat webhook?
Yes. Add the RevenueCat Trigger, copy its endpoint URL, and create a webhook in the RevenueCat Dashboard that points at that URL. Subscribe to the events you care about. An AI node in the same workflow can then use the parsed output to decide on a win-back or a billing message, while your other nodes update access.
Does BuildShip create the RevenueCat webhook for you?
No. You paste the triggerโs endpoint into RevenueCat under Integrations, Webhooks. That is deliberate: RevenueCatโs webhook setup is manual. After you save it, send a test event and use Get Data in BuildShip.
Which events should I subscribe to for this agent?
Start with Expiration. Add Billing issue if you want a separate path for a failed charge. Avoid selecting every event in production, so a renewal or a product change does not run the expiry logic.
Should I set an Auth Token?
Yes, if you can. Set the same secret as the Authorization Header Value in RevenueCat and as the Auth Token on the trigger. If you leave both empty, RevenueCat still sends the webhook, but you lose that verification check.
How do I test this without expiring a real subscriber?
Use the Sandbox environment on the webhook, and RevenueCatโs sandbox subscribers or test webhook tools. Keep the trigger and the workflow pointed at sandbox data until you are ready to ship a production webhook.
How much does it cost to try?
BuildShip plans start with a 7-day trial, and a card is required to start it. See the pricing page for plans and credits.
Start building
Start your 7-day trial (a card is required), add the RevenueCat Trigger, and send a sandbox Expiration event. If you are building subscription operations for a larger team, talk to us about enterprise.





