Quick overview
This workflow runs daily to find Stripe subscriptions whose trials end soon, looks up each user’s recent usage in Google Sheets, drafts a personalized follow-up with OpenAI, and uses Gmail to request human approval before sending, then logs outcomes to Google Sheets and escalates based on Stripe status.
How it works
- Runs every day at 8:00 AM on a schedule.
- Fetches trialing subscriptions from the Stripe API and filters to those ending within the configured trial window.
- Reads the Usage tab from Google Sheets, matches usage by email, and classifies each trial user as high-usage or low-usage based on login and key-action thresholds.
- Uses OpenAI to draft a short follow-up email tailored to the user’s usage class and trial end date.
- Sends the draft to the owner via Gmail for Approve/Reject, and only sends the email to the customer if the owner approves.
- Appends the outcome (sent or rejected) to the Outcomes tab in Google Sheets.
- After the configured wait period, rechecks the subscription in Stripe and either logs converted or emails the owner an escalation and logs escalated.
Setup
- Add an HTTP Header Auth credential for Stripe (Bearer token) and ensure the workflow can call Stripe’s /v1/subscriptions list and retrieve endpoints.
- Add Google Sheets OAuth2 credentials, create a spreadsheet with Usage and Outcomes tabs, and set the spreadsheet ID and tab names in the CONFIG values.
- Add Gmail OAuth2 credentials and set owner_email in the CONFIG values for approval requests and escalation notifications.
- Add an OpenAI API credential and set the ai_model in the CONFIG values.
- Populate and maintain the Usage tab with email, logins_last_7d, and key_actions_last_7d so the workflow can classify users correctly.