← 返回
未分类 Key 中文

whatsapp-monitor

Monitor specified WhatsApp chats for keywords in real time and batch export matched messages to Feishu multi-dimensional tables with optional alerts.
实时监控指定 WhatsApp 聊天中的关键词,并将匹配消息批量导出至飞书多维表格,支持可选告警。
mrhanson mrhanson 来源
未分类 clawhub v0.0.1 1 版本 100000 Key: 需要
★ 0
Stars
📥 321
下载
💾 0
安装
1
版本
#latest

概述

WhatsApp Message Monitor Skill

Overview

This skill enables automated monitoring of WhatsApp conversations, filtering for specific keywords, and batch exporting matching messages to Feishu (Lark) multi-dimensional tables.

Core Features

  • Target Monitoring: Configure WhatsApp contacts or groups to monitor
  • Keyword Filtering: Define keywords or patterns to watch for
  • Batch Collection: Accumulate messages until threshold is reached
  • Scheduled Export: Periodically push collected messages to Feishu tables
  • Real-time Alerts: Optional immediate notification for high-priority keywords

快速开始

1. 前提条件

使用此技能前,请确保:

  • WhatsApp 访问权限:个人或商业账户
  • 飞书/Lark 账户:具备 API 访问权限
  • 飞书多维表格应用:已安装和配置
  • OpenClaw WhatsApp 渠道:已配置并配对设备

2. OpenClaw 集成步骤

  1. 配置 WhatsApp 渠道

```bash

# 在 OpenClaw 中设置 WhatsApp 渠道

openclaw channels enable whatsapp

```

  1. 配对 WhatsApp 设备
    • 打开浏览器访问 WhatsApp Web (web.whatsapp.com)
    • 扫描二维码配对设备
    • 确保设备状态显示为“已连接”
  1. 安装技能依赖

```bash

cd ~/whatsapp-monitor # 或你的克隆目录,例如 /opt/whatsapp-monitor

pip install -r requirements.txt

```

  1. 配置监控目标

```bash

# 编辑配置文件

python scripts/setup.py

```

  1. 配置飞书集成
    • 获取飞书应用凭证 (App ID, App Secret)
    • 创建多维表格并获取 Table Token
    • 更新 config/feishu-settings.json

3. 首次运行

测试配置:

python scripts/monitor.py --test-config

启动监控:

python scripts/monitor.py --start

查看状态:

python scripts/monitor.py --status

2. Configuration Files

This skill uses two main configuration files:

  • config/whatsapp-targets.json - Define WhatsApp contacts/groups to monitor
  • config/feishu-settings.json - Configure Feishu API and table settings

Configuration

WhatsApp Targets

Create config/whatsapp-targets.json:

{
  "version": "1.0",
  "targets": [
    {
      "name": "Project Team Chat",
      "type": "group",  // "contact" or "group"
      "identifier": "1234567890-1234567890@g.us",  // WhatsApp group ID
      "enabled": true,
      "keywords": ["urgent", "deadline", "blocker", "issue"],
      "priority": "high"
    },
    {
      "name": "Client Support",
      "type": "contact",
      "identifier": "+1234567890@c.us",  // WhatsApp contact ID
      "enabled": true,
      "keywords": ["complaint", "escalation", "critical", "outage"],
      "priority": "medium"
    }
  ],
  "monitoring": {
    "scan_interval_minutes": 5,
    "batch_size": 10,
    "max_age_hours": 24,
    "alert_on_high_priority": true
  }
}

Feishu Settings

Create config/feishu-settings.json:

{
  "feishu": {
    "app_id": "YOUR_APP_ID",
    "app_secret": "YOUR_APP_SECRET",
    "table_app_token": "YOUR_TABLE_APP_TOKEN",
    "table_token": "YOUR_TABLE_TOKEN"
  },
  "table": {
    "name": "WhatsApp Monitor Log",
    "fields": [
      {"name": "timestamp", "type": "datetime"},
      {"name": "source", "type": "text"},
      {"name": "sender", "type": "text"},
      {"name": "message", "type": "text"},
      {"name": "keyword_matched", "type": "text"},
      {"name": "priority", "type": "text"}
    ]
  },
  "export": {
    "batch_threshold": 10,
    "schedule": "every 30 minutes",
    "retry_on_failure": true,
    "max_retries": 3
  }
}

使用工作流

设置阶段

  1. 初始化配置 - 设置监控目标和飞书凭证

```bash

python scripts/setup.py

```

  1. 测试连接 - 验证 WhatsApp 和飞书 API 连接

```bash

python scripts/monitor.py --test-config

```

  1. 启动监控 - 开始扫描配置的聊天

```bash

python scripts/monitor.py --start

```

OpenClaw Skill 集成

在 OpenClaw 中使用此技能:

# 加载技能(路径改为本机 Linux 上的技能目录)
openclaw skills load ~/whatsapp-monitor

# 或直接调用技能函数
openclaw skills run whatsapp-monitor --start

定时任务设置

通过 OpenClaw cron 设置定时监控:

# 创建定时任务
schedule:
  kind: "cron"
  expr: "*/5 * * * *"  # 每5分钟运行一次
payload:
  kind: "agentTurn"
  message: "运行 WhatsApp 消息监控"
  sessionTarget: "isolated"

实时通知配置

配置实时告警(当匹配到高优先级关键词时):

  1. config/whatsapp-targets.json 中设置:
  2. {
      "monitoring": {
        "alert_on_high_priority": true
      }
    }
    
  1. 配置通知渠道(可选):
    • 飞书机器人消息
    • 电子邮件通知
    • 短信告警

Monitoring Phase

The system will:

  1. Periodically check configured WhatsApp chats
  2. Filter messages for keyword matches
  3. Store matching messages locally
  4. Export to Feishu when batch threshold is reached or on schedule

Export Phase

When ready to export, the system will:

  1. Format collected messages according to table schema
  2. Push to Feishu multi-dimensional table
  3. Clear local cache after successful export
  4. Log export status and any errors

Tools and Scripts

Core Monitoring Script

See scripts/monitor.py for the main monitoring logic.

Configuration Management

See scripts/config.py for handling configuration files.

Feishu API Integration

See scripts/feishu_client.py for Feishu table operations.

WhatsApp Web Automation

See scripts/whatsapp_web.py for WhatsApp Web interaction.

Advanced Features

Custom Filters

Beyond simple keywords, you can implement:

  • Regular expression patterns
  • Sentiment analysis
  • Time-based rules
  • Sender-specific filters

Alerting Options

Configure additional alert channels:

  • Email notifications
  • Slack/Teams messages
  • SMS alerts
  • Push notifications

Data Enrichment

Enhance collected messages with:

  • Sentiment scores
  • Entity extraction
  • Topic classification
  • Translation services

Troubleshooting

Common Issues

  1. WhatsApp Web Connection - Ensure browser automation is working
  2. Feishu API Permissions - Verify app has correct table permissions
  3. Keyword Matching - Check for case sensitivity and special characters

Monitoring Status

Check monitoring logs in logs/whatsapp-monitor.log for operational details and errors.

Integration Examples

Combine with Other Skills

This skill can be combined with:

  • Calendar Integration - Trigger calendar events based on messages
  • Task Management - Create tasks from important messages
  • CRM Systems - Update customer records from support chats

Automated Reporting

Set up automated reports:

  • Daily summary reports
  • Weekly keyword trend analysis
  • Monthly activity reports

Security Considerations

  • Store sensitive credentials securely (use environment variables)
  • Implement rate limiting for API calls
  • Regularly audit access logs
  • Consider data retention policies

Performance Optimization

For high-volume monitoring:

  • Implement message deduplication
  • Use batch API calls for Feishu
  • Optimize keyword matching algorithms
  • Consider distributed monitoring for multiple accounts

Maintenance

Regular maintenance tasks:

  • Update keyword lists periodically
  • Review export success rates
  • Monitor API rate limits
  • Backup configuration and logs

References

For detailed API documentation and additional resources, see:

Quick Commands

Start Monitoring

python scripts/monitor.py --start

Force Export

python scripts/monitor.py --export

View Status

python scripts/monitor.py --status

Test Configuration

python scripts/monitor.py --test-config

Support

For assistance or feature requests, refer to the troubleshooting section or contact the skill maintainer.

版本历史

共 1 个版本

  • v0.0.1 当前
    2026-05-07 10:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,456
it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,833
it-ops-security

Tmux

steipete
通过发送按键和抓取窗格输出,远程控制交互式 CLI 的 tmux 会话。
★ 45 📥 29,371