LoopCLI

Marketing & Growth Templates

Workflow templates for marketing and growth teams who need to automate email campaigns, lead scoring, content distribution, and multi-channel campaigns—all from the terminal.

Resend Email Campaign Automation

Create automated email drip campaigns with Resend, tracking opens and clicks, and triggering follow-ups based on engagement.

Use Case

Automated welcome email sequence for new signups: send day 0, day 3, day 7 emails with personalized content based on user behavior.

Workflow Configuration

name: welcome-email-sequence
description: Automated 7-day welcome email campaign
trigger:
  type: webhook
  path: /webhooks/new-signup
steps:
  - 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": ["${webhook.email}"],
          "subject": "Welcome to ${COMPANY_NAME}! Let's Get Started",
          "html": "<h1>Welcome ${webhook.name}!</h1><p>We're excited to have you...</p>",
          "tags": [
            {"name": "campaign", "value": "welcome-sequence"},
            {"name": "day", "value": "0"}
          ]
        }
    output: day0_email

  - name: store_in_crm
    type: http
    config:
      method: POST
      url: https://your-project.supabase.co/rest/v1/leads
      headers:
        apikey: ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "email": "${webhook.email}",
          "name": "${webhook.name}",
          "source": "${webhook.source}",
          "campaign": "welcome-sequence",
          "last_email_sent": "day0",
          "created_at": "${timestamp}"
        }
    output: crm_record

  - name: schedule_day3_email
    type: http
    config:
      method: POST
      url: https://api.loopcli.com/v1/schedules
      headers:
        Authorization: Bearer ${LOOPCLI_API_KEY}
      body: |
        {
          "workflow": "send-day3-email",
          "scheduled_at": "${timestamp + 259200}",
          "data": {"email": "${webhook.email}", "name": "${webhook.name}"}
        }

  - name: track_event
    type: http
    config:
      method: POST
      url: https://api.posthog.com/capture/
      body: |
        {
          "api_key": "${POSTHOG_API_KEY}",
          "event": "welcome_email_sent",
          "distinct_id": "${webhook.email}",
          "properties": {
            "campaign": "welcome-sequence",
            "day": 0
          }
        }

Day 3 Follow-up Workflow

name: send-day3-email
description: Day 3 welcome sequence email
trigger:
  type: manual
steps:
  - name: check_user_activity
    type: http
    config:
      method: GET
      url: https://api.posthog.com/api/projects/${POSTHOG_PROJECT_ID}/persons/?email=${input.email}
      headers:
        Authorization: Bearer ${POSTHOG_API_KEY}
    output: activity

  - name: send_engaged_version
    type: http
    condition: activity.results[0].properties.logins > 0
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
      body: |
        {
          "from": "success@yourapp.com",
          "to": ["${input.email}"],
          "subject": "Great start ${input.name}! Here's what's next",
          "html": "<p>We noticed you've been exploring... Here are some advanced features...</p>"
        }

  - name: send_inactive_version
    type: http
    condition: activity.results[0].properties.logins == 0
    config:
      method: POST
      url: https://api.resend.com/emails
      headers:
        Authorization: Bearer ${RESEND_API_KEY}
      body: |
        {
          "from": "help@yourapp.com",
          "to": ["${input.email}"],
          "subject": "Need help getting started?",
          "html": "<p>We noticed you haven't logged in yet. Can we help?</p>"
        }

Lead Scoring & Qualification

Automatically score leads based on behavior, update CRM, and notify sales team of hot leads.

Use Case

Track user behavior (page views, feature usage, pricing page visits), calculate lead score, and alert sales when a lead reaches "hot" status.

Workflow Configuration

name: lead-scoring-engine
description: Real-time lead scoring and qualification
trigger:
  type: webhook
  path: /webhooks/user-activity
steps:
  - name: fetch_user_data
    type: http
    config:
      method: GET
      url: https://your-project.supabase.co/rest/v1/leads?email=eq.${webhook.email}
      headers:
        apikey: ${SUPABASE_KEY}
    output: user

  - name: calculate_score
    type: cli
    config:
      command: |
        python3 <<EOF
        score = ${user.score || 0}

        # Activity scoring
        if '${webhook.event}' == 'pricing_page_viewed':
            score += 15
        elif '${webhook.event}' == 'demo_requested':
            score += 30
        elif '${webhook.event}' == 'integration_page_viewed':
            score += 10
        elif '${webhook.event}' == 'docs_viewed':
            score += 5

        # Frequency bonus
        if ${webhook.session_count} > 5:
            score += 10

        # Company size bonus
        if ${webhook.company_size} > 50:
            score += 20

        print(score)
        EOF
    output: new_score

  - name: update_lead_score
    type: http
    config:
      method: PATCH
      url: https://your-project.supabase.co/rest/v1/leads?email=eq.${webhook.email}
      headers:
        apikey: ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "score": ${new_score.stdout},
          "last_activity": "${webhook.event}",
          "updated_at": "${timestamp}"
        }

  - name: notify_sales_hot_lead
    type: http
    condition: new_score.stdout >= 80
    config:
      method: POST
      url: ${SLACK_WEBHOOK_SALES}
      body: |
        {
          "text": "🔥 Hot lead alert!",
          "blocks": [
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Hot Lead Qualified*\n• Email: ${webhook.email}\n• Score: ${new_score.stdout}\n• Recent Activity: ${webhook.event}\n• Company: ${webhook.company}\n• Sessions: ${webhook.session_count}"
              }
            },
            {
              "type": "actions",
              "elements": [
                {
                  "type": "button",
                  "text": {"type": "plain_text", "text": "View in CRM"},
                  "url": "https://yourcrm.com/leads/${user.id}"
                }
              ]
            }
          ]
        }

  - name: create_salesforce_task
    type: http
    condition: new_score.stdout >= 80
    config:
      method: POST
      url: https://yourinstance.salesforce.com/services/data/v52.0/sobjects/Task/
      headers:
        Authorization: Bearer ${SALESFORCE_TOKEN}
        Content-Type: application/json
      body: |
        {
          "Subject": "Follow up with hot lead: ${webhook.email}",
          "Priority": "High",
          "Status": "Not Started",
          "Description": "Lead score: ${new_score.stdout}. Recent activity: ${webhook.event}"
        }

Social Media Cross-Posting

Publish content across multiple social platforms from a single workflow.

Use Case

When you publish a new blog post, automatically create posts on Twitter, LinkedIn, and Facebook with platform-optimized formats.

Workflow Configuration

name: social-media-cross-post
description: Publish to multiple social platforms
trigger:
  type: webhook
  path: /webhooks/new-blog-post
steps:
  - name: post_to_twitter
    type: http
    config:
      method: POST
      url: https://api.twitter.com/2/tweets
      headers:
        Authorization: Bearer ${TWITTER_BEARER_TOKEN}
        Content-Type: application/json
      body: |
        {
          "text": "📝 New blog post: ${webhook.title}\n\n${webhook.excerpt}\n\nRead more: ${webhook.url}"
        }
    output: twitter

  - name: post_to_linkedin
    type: http
    config:
      method: POST
      url: https://api.linkedin.com/v2/ugcPosts
      headers:
        Authorization: Bearer ${LINKEDIN_TOKEN}
        Content-Type: application/json
      body: |
        {
          "author": "urn:li:person:${LINKEDIN_PERSON_ID}",
          "lifecycleState": "PUBLISHED",
          "specificContent": {
            "com.linkedin.ugc.ShareContent": {
              "shareCommentary": {
                "text": "${webhook.title}\n\n${webhook.excerpt}"
              },
              "shareMediaCategory": "ARTICLE",
              "media": [
                {
                  "status": "READY",
                  "originalUrl": "${webhook.url}"
                }
              ]
            }
          },
          "visibility": {
            "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
          }
        }
    output: linkedin

  - name: post_to_facebook
    type: http
    config:
      method: POST
      url: https://graph.facebook.com/v18.0/${FACEBOOK_PAGE_ID}/feed
      headers:
        Content-Type: application/json
      body: |
        {
          "message": "${webhook.title}\n\n${webhook.excerpt}",
          "link": "${webhook.url}",
          "access_token": "${FACEBOOK_PAGE_TOKEN}"
        }
    output: facebook

  - name: track_posts
    type: http
    config:
      method: POST
      url: https://your-project.supabase.co/rest/v1/social_posts
      headers:
        apikey: ${SUPABASE_KEY}
        Content-Type: application/json
      body: |
        {
          "blog_post_url": "${webhook.url}",
          "twitter_id": "${twitter.data.id}",
          "linkedin_id": "${linkedin.id}",
          "facebook_id": "${facebook.id}",
          "posted_at": "${timestamp}"
        }

Arcads.ai Video Campaign Pipeline

Automate AI-generated video ad creation with Arcads.ai, render videos, and upload to ad platforms.

Use Case

Generate personalized video ads using AI avatars, render multiple variations, and upload to Facebook Ads for testing.

Workflow Configuration

name: ai-video-ad-pipeline
description: Generate and deploy AI video ads
trigger:
  type: manual
steps:
  - name: create_video_variations
    type: http
    config:
      method: POST
      url: https://api.arcads.ai/v1/videos
      headers:
        Authorization: Bearer ${ARCADS_API_KEY}
        Content-Type: application/json
      body: |
        {
          "script": "${VIDEO_SCRIPT}",
          "avatar": "${AVATAR_ID}",
          "variations": [
            {"variable": "product_name", "value": "${PRODUCT_NAME}"},
            {"variable": "discount", "value": "20%"},
            {"variable": "cta", "value": "Sign up today"}
          ]
        }
    output: video_job

  - name: wait_for_rendering
    type: cli
    config:
      command: sleep 180  # Wait 3 minutes for rendering

  - name: fetch_rendered_videos
    type: http
    config:
      method: GET
      url: https://api.arcads.ai/v1/videos/${video_job.job_id}
      headers:
        Authorization: Bearer ${ARCADS_API_KEY}
    output: videos

  - name: upload_to_facebook_ads
    type: http
    config:
      method: POST
      url: https://graph.facebook.com/v18.0/${FB_AD_ACCOUNT_ID}/advideos
      headers:
        Content-Type: application/json
      body: |
        {
          "file_url": "${videos.variations[0].url}",
          "access_token": "${FACEBOOK_ADS_TOKEN}"
        }
    output: fb_video

  - name: create_ad_creative
    type: http
    config:
      method: POST
      url: https://graph.facebook.com/v18.0/${FB_AD_ACCOUNT_ID}/adcreatives
      headers:
        Content-Type: application/json
      body: |
        {
          "name": "AI Video Ad - ${CAMPAIGN_NAME}",
          "object_story_spec": {
            "page_id": "${FB_PAGE_ID}",
            "video_data": {
              "video_id": "${fb_video.id}",
              "message": "${AD_COPY}"
            }
          },
          "access_token": "${FACEBOOK_ADS_TOKEN}"
        }
    output: creative

  - name: notify_team
    type: http
    config:
      method: POST
      url: ${SLACK_WEBHOOK_URL}
      body: |
        {
          "text": "✅ AI video ads created and uploaded",
          "blocks": [
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Video Campaign Ready*\n• Videos rendered: ${videos.variations.length}\n• Facebook creative: ${creative.id}\n• Ready to launch"
              }
            }
          ]
        }

Competitor Monitoring & Alerts

Monitor competitor pricing pages, blog posts, and feature launches, with automated alerts.

Workflow Configuration

name: competitor-monitoring
description: Track competitor changes
trigger:
  type: schedule
  cron: "0 */6 * * *"  # Every 6 hours
steps:
  - name: scrape_competitor_pricing
    type: cli
    config:
      command: |
        curl -s https://competitor.com/pricing | pup 'span.price text{}'
    output: pricing

  - name: check_pricing_change
    type: http
    config:
      method: GET
      url: https://your-project.supabase.co/rest/v1/competitor_tracking?company=eq.competitor&type=eq.pricing&order=created_at.desc&limit=1
      headers:
        apikey: ${SUPABASE_KEY}
    output: last_price

  - name: alert_pricing_change
    type: http
    condition: pricing.stdout != last_price[0].value
    config:
      method: POST
      url: ${SLACK_WEBHOOK_URL}
      body: |
        {
          "text": "💰 Competitor pricing changed!",
          "blocks": [
            {
              "type": "section",
              "text": {
                "type": "mrkdwn",
                "text": "*Competitor Pricing Update*\n• Company: Competitor Inc\n• Old price: ${last_price[0].value}\n• New price: ${pricing.stdout}\n• <https://competitor.com/pricing|View Page>"
              }
            }
          ]
        }

  - name: store_new_pricing
    type: http
    condition: pricing.stdout != last_price[0].value
    config:
      method: POST
      url: https://your-project.supabase.co/rest/v1/competitor_tracking
      headers:
        apikey: ${SUPABASE_KEY}
      body: |
        {
          "company": "competitor",
          "type": "pricing",
          "value": "${pricing.stdout}",
          "created_at": "${timestamp}"
        }

Getting Started

  1. Install LoopCLI:

    npm install -g loopcli
    
  2. Initialize project:

    loopcli project init
    
  3. Create your marketing workflow:

    loopcli loop create my-marketing-workflow
    
  4. Test locally:

    loopcli loop run my-marketing-workflow
    
  5. Deploy for automated execution:

    loopcli loop deploy my-marketing-workflow --activate
    

Need Help?

Related Documentation

Continue learning with these related topics