✍️ Blog Post

OpenClaw for Sales & Marketing Automation: AI-Powered Workflows

22 min readMira

Sales and marketing teams waste hours on repetitive tasks: lead research, CRM updates, email follow-ups, social media posting, and reporting. OpenClaw transforms this manual work into automated AI workflows that run 24/7. Here's how to build custom sales & marketing agents that actually work.

What you'll build: A complete sales automation system that researches leads, updates your CRM, sends personalized emails, monitors social signals, and generates weekly reports — all automated with OpenClaw.

Why OpenClaw Beats Traditional Marketing Automation

Traditional tools like HubSpot or Marketo are rigid. They follow predefined rules. OpenClaw agents think, adapt, and make decisions:

  • Intelligent lead scoring based on real-time signals (website visits, social engagement, news mentions)
  • Dynamic email personalization that references recent company news or personal achievements
  • Multi-channel coordination — email, LinkedIn, Twitter, Slack notifications in one workflow
  • Natural language reporting that explains why metrics changed, not just what changed
  • No-code + code flexibility — start with skills, customize with TypeScript when needed

Core Components: What You'll Need

Here's the toolkit for sales & marketing automation:

Essential Skills

  • gog — Google Workspace (Gmail, Calendar, Drive)
  • github — For versioning automation scripts
  • slack — Team notifications and alerts
  • web_fetch — Lead research and news monitoring
  • cron — Scheduled workflows

MCP Servers (APIs)

  • 🔗 CRM: Salesforce, HubSpot, Pipedrive APIs
  • 🔗 Social: LinkedIn, Twitter/X, Facebook
  • 🔗 Analytics: Google Analytics, Mixpanel, Amplitude
  • 🔗 Communication: Twilio, SendGrid, Mailchimp
  • 🔗 Data: Clearbit, Hunter.io, Apollo.io

Building a Lead Research Agent

Let's start with a practical example: an agent that researches companies and key decision-makers.

1. Create the Research Skill

First, create a new skill directory:

mkdir -p ~/.openclaw/skills/lead-research
cd ~/.openclaw/skills/lead-research

Create SKILL.md:

# Lead Research Skill

## Description
Research companies and key decision-makers using web search, LinkedIn, and company databases.

## Tools
- web_search: Find company news and executives
- web_fetch: Scrape company websites
- exec: Run custom research scripts
- write: Save research findings

## Usage Examples

### Research a company:
```bash
openclaw research-company "Stripe" --depth=detailed
```

### Find decision-makers:
```bash
openclaw find-decision-makers "tech startup series B" --role=CTO --location=SF
```

### Monitor for news:
```bash
openclaw monitor-company-news "OpenAI" --frequency=daily
```

2. Create the Research Script

Create scripts/research-company.sh:

#!/bin/bash
# research-company.sh - Automated company research

COMPANY="$1"
DEPTH="$2"
if [ -z "$DEPTH" ]; then
  DEPTH="basic"
fi

echo "🔍 Researching $COMPANY ($DEPTH depth)"

# 1. Basic company info
echo "## Company Overview" > research.md
echo "- **Name:** $COMPANY" >> research.md

# 2. Web search for recent news
echo "Searching for recent news..."
NEWS=$(web_search query="$COMPANY funding round OR acquisition OR partnership" count=5)
echo "### Recent News" >> research.md
echo "$NEWS" >> research.md

# 3. LinkedIn search for executives (simplified)
if [ "$DEPTH" = "detailed" ]; then
  echo "Searching for executives..."
  echo "### Key Executives" >> research.md
  echo "- CEO: [Research needed]" >> research.md
  echo "- CTO: [Research needed]" >> research.md
fi

# 4. Company website analysis
echo "Analyzing website..."
WEBSITE=$(web_fetch url="https://$COMPANY.com" 2>/dev/null || echo "Website not accessible")
echo "### Website Analysis" >> research.md
echo "Homepage accessible: $( [ -n "$WEBSITE" ] && echo "Yes" || echo "No" )" >> research.md

echo "✅ Research saved to research.md"
cat research.md

CRM Integration Workflow

Now let's connect research to your CRM. We'll use a simple REST API pattern that works with any CRM.

1. Create a CRM MCP Server

Create ~/mcp-servers/crm-server/server.js:

// Simple CRM MCP Server
const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');

const server = new Server(
  {
    name: 'crm-server',
    version: '1.0.0',
  },
  {
    capabilities: {
      tools: {},
    },
  }
);

// Tool: Create or update contact
server.setRequestHandler('tools/call', async (request) => {
  const { name, params } = request;
  
  if (name === 'create_contact') {
    const { email, firstName, lastName, company, title } = params.arguments;
    
    // Here you would call your actual CRM API
    // Example with a mock API:
    const contact = {
      id: 'contact_' + Date.now(),
      email,
      firstName,
      lastName,
      company,
      title,
      createdAt: new Date().toISOString()
    };
    
    return {
      content: [
        {
          type: 'text',
          text: `Created contact: ${firstName} ${lastName} (${email}) at ${company}`
        }
      ]
    };
  }
  
  if (name === 'update_contact') {
    const { contactId, updates } = params.arguments;
    return {
      content: [
        {
          type: 'text',
          text: `Updated contact ${contactId} with: ${JSON.stringify(updates)}`
        }
      ]
    };
  }
  
  throw new Error(`Unknown tool: ${name}`);
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
}

main().catch(console.error);

2. Automated Lead-to-CRM Workflow

Create a cron job that runs daily to process new leads:

// ~/.openclaw/cron/lead-processing.json
{
  "name": "Daily Lead Processing",
  "schedule": {
    "kind": "cron",
    "expr": "0 9 * * *", // 9 AM daily
    "tz": "America/Los_Angeles"
  },
  "payload": {
    "kind": "agentTurn",
    "message": "Process new leads from yesterday: 1) Research each company, 2) Find decision-makers, 3) Create CRM contacts, 4) Send personalized email sequence, 5) Post summary to Slack #leads"
  },
  "sessionTarget": "isolated",
  "delivery": {
    "mode": "announce",
    "channel": "slack",
    "to": "#sales-automation"
  }
}

Email Sequence Automation

Personalized email sequences that reference actual company events:

// email-sequence.js
const { google } = require('googleapis');

async function sendPersonalizedEmail(contact, companyResearch) {
  const gmail = google.gmail({ version: 'v1', auth });
  
  const subject = `Following up re: ${companyResearch.recentNews?.title || 'your company'}`;
  
  const emailBody = `
Hi ${contact.firstName},

I saw that ${contact.company} recently ${companyResearch.recentNews?.summary || 'made some interesting moves'}.

As someone who works with ${companyResearch.industry || 'tech companies'}, I thought you might be interested in how we're helping similar companies with [your value prop].

Would you be open to a 15-minute chat next week?

Best,
[Your Name]
`;
  
  const message = [
    'Content-Type: text/html; charset=utf-8',
    'MIME-Version: 1.0',
    `To: ${contact.email}`,
    `Subject: ${subject}`,
    '',
    emailBody
  ].join('\n');
  
  const encodedMessage = Buffer.from(message)
    .toString('base64')
    .replace(/\+/g, '-')
    .replace(/\//g, '_')
    .replace(/=+$/, '');
  
  await gmail.users.messages.send({
    userId: 'me',
    requestBody: {
      raw: encodedMessage
    }
  });
  
  console.log('✅ Email sent to ' + contact.email);
}

// Schedule follow-ups
const followUpSchedule = [
  { days: 3, template: 'follow_up_1' },
  { days: 7, template: 'check_in' },
  { days: 14, template: 'final_touch' }
];

Social Media & News Monitoring

Monitor for signals that indicate buying intent:

// monitoring-agent.js
const triggers = [
  {
    name: 'Funding Announcement',
    search: 'series A OR series B OR raised funding',
    action: 'add_to_high_intent_list'
  },
  {
    name: 'Leadership Change',
    search: 'new CTO OR hired VP OR joined as',
    action: 'send_congrats_email'
  },
  {
    name: 'Product Launch',
    search: 'launched OR announced OR released',
    action: 'send_relevant_case_study'
  }
];

async function monitorCompanies(companies) {
  for (const company of companies) {
    console.log('🔍 Monitoring ' + company);
    
    for (const trigger of triggers) {
      const results = await web_search({
        query: `${company} ${trigger.search}`,
        count: 3,
        freshness: 'week'
      });
      
      if (results.length > 0) {
        console.log('🚨 Trigger: ' + trigger.name + ' for ' + company);
        await takeAction(trigger.action, { company, results });
        
        // Post to Slack
        await slack.send({
          channel: '#sales-signals',
          text: '🚨 ' + trigger.name + ' detected for ' + company + ': ' + results[0].title
        });
      }
    }
  }
}

// Run every 4 hours
setInterval(() => monitorCompanies(targetAccounts), 4 * 60 * 60 * 1000);

Analytics & Reporting

The final piece: automated reporting that explains what happened and why.

// weekly-report.js
async function generateWeeklyReport() {
  const weekStart = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
  
  const report = {
    summary: await analyzePerformance(),
    topLeads: await getTopLeads(),
    emailMetrics: await getEmailStats(),
    socialSignals: await getSocialEngagement(),
    recommendations: await generateRecommendations()
  };
  
  // Generate natural language summary
  const nlSummary = await openai.chat.completions.create({
    model: 'gpt-4',
    messages: [
      {
        role: 'system',
        content: 'You are a sales analyst. Summarize this data in 3 bullet points with actionable insights.'
      },
      {
        role: 'user',
        content: JSON.stringify(report, null, 2)
      }
    ]
  });
  
  // Post to Slack and email stakeholders
  await slack.send({
    channel: '#sales-reports',
    blocks: [
      {
        type: 'header',
        text: {
          type: 'plain_text',
          text: '📊 Weekly Sales Report'
        }
      },
      {
        type: 'section',
        text: {
          type: 'mrkdwn',
          text: nlSummary.choices[0].message.content
        }
      }
    ]
  });
  
  console.log('✅ Weekly report generated and distributed');
}

// Schedule for Monday 9 AM
cron.schedule('0 9 * * 1', generateWeeklyReport);

Putting It All Together: Complete Workflow

Here's how the complete system works:

  1. 9:00 AM Daily: Lead research agent runs, finds 20 new prospects
  2. 9:30 AM: CRM contacts created, personalized emails queued
  3. Every 4 hours: Social media monitoring checks for signals
  4. 3:00 PM: Follow-up emails sent to leads from 3 days ago
  5. Monday 9:00 AM: Weekly report generated with AI insights

Time saved: This system replaces ~15 hours/week of manual work. For a sales team of 5, that's 75 hours/month — nearly two full work weeks recovered.

Getting Started: Your First 30 Minutes

Don't try to build everything at once. Start small:

30-Minute Quick Start

  1. 1Install the gog skill: clawhub install gog
  2. 2Create a simple lead research script (copy the example above)
  3. 3Set up one cron job for daily research
  4. 4Test with 5 target companies, refine based on results

FAQ: Common Questions

Q: How much does this cost to run?

A: OpenClaw itself is open source. The main costs are API calls (OpenAI, Google, etc.) and hosting. For a basic sales automation setup, expect $20-50/month in API costs. Compare that to $100+/user/month for traditional sales automation tools.

Q: Do I need to know how to code?

A: Basic scripting helps, but you can start with existing skills from ClawHub. Many sales automation patterns are available as pre-built skills. As you hit limits, you can customize with JavaScript/TypeScript.

Q: How do I handle compliance (GDPR, CAN-SPAM)?

A: Build compliance checks into your workflows. For example: "Before sending email, check if contact is in EU and has opt-in." OpenClaw's decision-making ability lets you add these rules naturally.

Q: Can this integrate with [my specific tool]?

A: Yes — through MCP servers. If a tool has an API, you can build an MCP server for it in under an hour. See our guide on building custom MCP servers.

Q: What's the biggest mistake beginners make?

A: Trying to automate everything at once. Start with one workflow (like lead research), get it working perfectly, then expand. Small wins build confidence and reveal the real bottlenecks.

Next Steps & Resources

Ready to build your own sales automation system? Here's where to go next:

Ready to build?

Get the OpenClaw Starter Kit — config templates, 5 production-ready skills, deployment checklist. Go from zero to running in under an hour.

$14 $6.99

Get the Starter Kit →

Also in the OpenClaw store

🗂️
Executive Assistant Config
Buy
Calendar, email, daily briefings on autopilot.
$6.99
🔍
Business Research Pack
Buy
Competitor tracking and market intelligence.
$5.99
Content Factory Workflow
Buy
Turn 1 post into 30 pieces of content.
$6.99
📬
Sales Outreach Skills
Buy
Automated lead research and personalized outreach.
$5.99

Get the free OpenClaw quickstart guide

Step-by-step setup. Plain English. No jargon.

Written by Mira — I build and use OpenClaw daily to automate Visiting Media's sales, content, and operations. This isn't theory — it's what actually works in production.

Questions or need help with your implementation? DM me on Twitter or start a discussion on GitHub.