LoopCLI

Founder & Solo Builder Templates

Workflow templates for founders and solo builders who need to automate customer onboarding, payment flows, analytics, and growth operations—all from the terminal.

Stripe Webhook → Supabase → Resend Onboarding

Automate customer onboarding when new subscriptions are created: store customer data in Supabase and trigger welcome email sequences via Resend.

Use Case

When a customer subscribes via Stripe, automatically create their account in Supabase, send a personalized welcome email, and trigger an onboarding email sequence.

Workflow Configuration

name: stripe-subscription-onboarding
description: Automated customer onboarding flow
trigger:
  type: webhook
  path: /webhooks/stripe
steps:
  - name: verify_stripe_signature
    type: http
    config:
      method: POST
      url: https://api.stripe.com/v1/events/${webhook.id}
      headers:
        Authorization: Bearer ${STRIPE_SECRET_KEY}
    output: event

  - name: create_customer_in_supabase
    type: http
    config:
      method: POST
      url: https://your-project.supabase.co/rest/v1/customers
      headers:
        apikey: ${SUPABASE_KEY}
        Authorization: Bearer ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "email": "${event.data.object.customer_email}",
          "stripe_customer_id": "${event.data.object.customer}",
          "subscription_id": "${event.data.object.id}",
          "plan": "${event.data.object.items.data[0].price.id}",
          "status": "active",
          "created_at": "${event.created}"
        }
    output: customer

  - name: send_welcome_email
    type: http
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
        Content-Type: application/json
      body: |
        {
          "from": "welcome@yourapp.com",
          "to": ["${event.data.object.customer_email}"],
          "subject": "Welcome to YourApp!",
          "html": "<h1>Welcome aboard!</h1><p>Thanks for subscribing. Here's how to get started...</p>"
        }
    output: welcome_email

  - name: trigger_onboarding_sequence
    type: http
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
        Content-Type: application/json
      body: |
        {
          "from": "onboarding@yourapp.com",
          "to": ["${event.data.object.customer_email}"],
          "subject": "Day 1: Getting Started Guide",
          "html": "<h2>Day 1: Let's Get You Set Up</h2><p>...</p>",
          "tags": [{"name": "sequence", "value": "onboarding-day-1"}]
        }

  - name: log_to_analytics
    type: http
    config:
      method: POST
      url: https://api.posthog.com/capture/
      headers:
        Content-Type: application/json
      body: |
        {
          "api_key": "${POSTHOG_API_KEY}",
          "event": "subscription_created",
          "distinct_id": "${customer.id}",
          "properties": {
            "email": "${event.data.object.customer_email}",
            "plan": "${event.data.object.items.data[0].price.id}",
            "amount": "${event.data.object.items.data[0].price.unit_amount}"
          }
        }

Setup Instructions

  1. Configure Stripe webhook:

    • Go to Stripe Dashboard → Developers → Webhooks
    • Add endpoint: https://your-hosted-loopcli.com/webhooks/stripe
    • Select events: customer.subscription.created
  2. Create the workflow:

    loopcli loop create stripe-subscription-onboarding
    
  3. Set your secrets:

    loopcli loop secrets set STRIPE_SECRET_KEY
    loopcli loop secrets set SUPABASE_KEY
    loopcli loop secrets set RESEND_API_KEY
    loopcli loop secrets set POSTHOG_API_KEY
    
  4. Deploy and activate:

    loopcli loop deploy stripe-subscription-onboarding --activate
    

Analytics Sync: PostHog → Google Sheets

Sync analytics data from PostHog to Google Sheets for weekly reporting, all from the terminal.

Use Case

Export weekly active users, conversion rates, and key metrics from PostHog to a Google Sheet for stakeholder reporting.

Workflow Configuration

name: analytics-weekly-sync
description: Sync PostHog analytics to Google Sheets
trigger:
  type: schedule
  cron: "0 9 * * 1"  # Every Monday at 9am
steps:
  - name: fetch_weekly_active_users
    type: http
    config:
      method: POST
      url: https://app.posthog.com/api/projects/${POSTHOG_PROJECT_ID}/insights/trend/
      headers:
        Authorization: Bearer ${POSTHOG_API_KEY}
        Content-Type: application/json
      body: |
        {
          "events": [{"id": "$pageview"}],
          "date_from": "-7d"
        }
    output: wau_data

  - name: fetch_conversion_rate
    type: http
    config:
      method: POST
      url: https://app.posthog.com/api/projects/${POSTHOG_PROJECT_ID}/insights/funnels/
      headers:
        Authorization: Bearer ${POSTHOG_API_KEY}
        Content-Type: application/json
      body: |
        {
          "events": [
            {"id": "signup_viewed"},
            {"id": "signup_completed"}
          ],
          "date_from": "-7d"
        }
    output: conversion_data

  - name: update_google_sheet
    type: http
    config:
      method: POST
      url: https://sheets.googleapis.com/v4/spreadsheets/${SHEET_ID}/values/A1:append?valueInputOption=USER_ENTERED
      headers:
        Authorization: Bearer ${GOOGLE_SHEETS_TOKEN}
        Content-Type: application/json
      body: |
        {
          "values": [
            [
              "${timestamp}",
              "${wau_data.result[0].count}",
              "${conversion_data.result[0].conversion_rate}%"
            ]
          ]
        }

  - name: notify_team
    type: http
    config:
      method: POST
      url: ${SLACK_WEBHOOK_URL}
      body: |
        {
          "text": "📊 Weekly analytics updated",
          "blocks": [
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Weekly Metrics*\n• WAU: ${wau_data.result[0].count}\n• Conversion: ${conversion_data.result[0].conversion_rate}%\n• <https://docs.google.com/spreadsheets/d/${SHEET_ID}|View Sheet>"
              }
            }
          ]
        }

Setup Instructions

  1. Get Google Sheets API credentials:

    • Enable Google Sheets API in Google Cloud Console
    • Create OAuth 2.0 credentials
    • Store the access token as GOOGLE_SHEETS_TOKEN
  2. Create the workflow:

    loopcli loop create analytics-weekly-sync
    
  3. Deploy with schedule:

    loopcli loop deploy analytics-weekly-sync --activate
    

Payment Failure Recovery

Automatically handle failed payments: update Supabase status, send recovery email via Resend, and downgrade account access.

Workflow Configuration

name: stripe-payment-failure
description: Handle failed payment attempts
trigger:
  type: webhook
  path: /webhooks/stripe-payment-failed
steps:
  - name: update_customer_status
    type: http
    config:
      method: PATCH
      url: https://your-project.supabase.co/rest/v1/customers?stripe_customer_id=eq.${webhook.data.object.customer}
      headers:
        apikey: ${SUPABASE_KEY}
        Authorization: Bearer ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "subscription_status": "past_due",
          "payment_failed_at": "${webhook.created}"
        }
    output: customer_update

  - name: send_payment_recovery_email
    type: http
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
        Content-Type: application/json
      body: |
        {
          "from": "billing@yourapp.com",
          "to": ["${webhook.data.object.customer_email}"],
          "subject": "Action Required: Update Your Payment Method",
          "html": "<h2>We couldn't process your payment</h2><p>Please update your payment method to continue your subscription.</p><a href='https://yourapp.com/billing'>Update Payment Method</a>"
        }

  - name: notify_admin
    type: http
    config:
      method: POST
      url: ${SLACK_WEBHOOK_URL}
      body: |
        {
          "text": "⚠️ Payment failed: ${webhook.data.object.customer_email}"
        }

Customer Feedback Pipeline

Capture customer feedback via webhook, store in Supabase, and trigger follow-up workflows.

Workflow Configuration

name: customer-feedback-pipeline
description: Process customer feedback and trigger actions
trigger:
  type: webhook
  path: /webhooks/feedback
steps:
  - name: store_feedback
    type: http
    config:
      method: POST
      url: https://your-project.supabase.co/rest/v1/feedback
      headers:
        apikey: ${SUPABASE_KEY}
        Authorization: Bearer ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "customer_email": "${webhook.email}",
          "score": ${webhook.score},
          "comment": "${webhook.comment}",
          "created_at": "${timestamp}"
        }
    output: feedback

  - name: notify_team_low_score
    type: http
    condition: webhook.score <= 3
    config:
      method: POST
      url: ${SLACK_WEBHOOK_URL}
      body: |
        {
          "text": "🚨 Low satisfaction score: ${webhook.score}/5",
          "blocks": [
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Customer:* ${webhook.email}\n*Score:* ${webhook.score}/5\n*Comment:* ${webhook.comment}"
              }
            }
          ]
        }

  - name: send_thank_you_email
    type: http
    condition: webhook.score >= 4
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
      body: |
        {
          "from": "thanks@yourapp.com",
          "to": ["${webhook.email}"],
          "subject": "Thanks for your feedback!",
          "html": "<p>We're glad you're enjoying YourApp! Would you mind leaving us a review?</p>"
        }

Getting Started

  1. Install LoopCLI:

    npm install -g loopcli
    
  2. Authenticate:

    loopcli auth login
    
  3. Initialize your project:

    loopcli project init
    
  4. Copy a template and customize:

    • Save YAML to loops/your-workflow.yaml
    • Update API endpoints and secrets
  5. Deploy:

    loopcli loop deploy your-workflow --activate
    

Need Help?

Related Documentation

Continue learning with these related topics