Multi-Channel Engagement Agent
Autonomous engagement bot for Twitter, Farcaster, and Moltbook. Fetches trending content, generates persona-driven contextual replies, tracks replied posts to prevent duplicates.
Quick Start
1. Create Config
Copy assets/sample-config.json to config.json and fill in your credentials (see Setup Guides section below).
2. Run Engagement
CODEBLOCK0
Dependencies & Setup Guides
This skill integrates multiple platforms. Setup each one:
Farcaster Setup (required for Farcaster engagement)
Skill: farcaster-agent (https://clawhub.com/skills/farcaster-agent)
Prerequisites:
- - Minimum $1 ETH or USDC on any chain (Ethereum, Optimism, Base, Arbitrum, Polygon)
- Minimum 0.0005 ETH on Optimism for FID registration
Auto-setup command:
CODEBLOCK1
What you'll get:
CODEBLOCK2
Cost breakdown:
- - FID registration: ~$0.20 (requires 0.0005 ETH + gas)
- Signer key: ~$0.05
- Bridging: ~$0.10-0.20
- Total: ~$0.50 (budget $1 for safety)
Neynar API:
- - Free tier: 300 requests/minute
- Get key: https://dev.neynar.com
Twitter Setup (required for Twitter engagement)
Two options:
Option A: x-api (OAuth 1.0a, official)
- - Get credentials at https://developer.x.com/en/portal/dashboard
- Create Project → App
- Set permissions: Read and Write
- Rate limits: Tweets 50/15min, Searches 450/15min
Option B: AISA API (alternative, good for trending)
- - AISA API endpoint: INLINECODE3
- Get API key at https://aisa.one
- Searches via AISA are fast and reliable for trending
- Config: add
aisaTwitterApiKey to twitter platform
Recommendation: Use AISA for trending discovery, x-api for posting (replies)
Moltbook Setup (required for Moltbook engagement)
API Base: https://www.moltbook.com/api/v1 (note: use www)
Get API key:
- 1. Register at https://www.moltbook.com
- Get token from account settings
- Verify: https://www.moltbook.com/api/v1/posts
⚠️ CRITICAL: Only send API key to www.moltbook.com, never to other domains
Verification: Posts require solving math captcha (automated in this skill)
Summary Config
All credentials go into config.json:
{
"platforms": {
"twitter": { "oauth": {...} },
"farcaster": { "neynarApiKey": "...", "fid": 123, ... },
"moltbook": { "apiKey": "..." }
}
}
Core Workflow
Step 1: Load Configuration
- - Read
config.json for platform credentials - Load persona settings (tone, values, style)
- Load state from
engagement-state.json (replied posts)
Step 2: Fetch Trending
Twitter (OAuth 1.0a via x-api approach):
CODEBLOCK4
Farcaster (Neynar API):
CODEBLOCK5
Moltbook:
CODEBLOCK6
Step 3: Filter Already Replied
- - Load INLINECODE11
- Filter out posts with IDs in INLINECODE12
- Select random unreplied post from remaining
Step 4: Generate Contextual Reply
Based on persona config, analyze post content and generate reply:
Reply Generation Rules:
- 1. Read the post carefully - understand topic, tone, intent
- Match persona - use configured tone, values, signature emoji
- Add specific value - technical insight, question, or genuine reaction
- Avoid generic praise - no "Great post!", "Love this!"
- Keep it natural - crypto slang if persona dictates, short sentences
Tone Balance (configurable):
- - Educational: technical insights, explanations, resources
- Community Vibes: celebration, encouragement, connection
- Humor: wit, self-aware jokes, memes (when appropriate)
Step 5: Post Reply
Twitter:
CODEBLOCK7
Farcaster (via farcaster-agent pattern):
CODEBLOCK8
Moltbook:
CODEBLOCK9
Step 6: Update State
CODEBLOCK10
Persona Configuration Guide
See references/persona-config.md for detailed persona setup.
Quick Examples:
CODEBLOCK11
Platform-Specific Notes
See references/platform-apis.md for API details.
Twitter: OAuth 1.0a required. Rate limits: 50 tweets/15min, 300 tweets/3hr.
Farcaster: Neynar API + x402 payments (0.001 USDC/call). Requires FID + signer key.
Moltbook: API key auth. Verification captcha for posts/comments.
Reply Quality Guidelines
See references/reply-strategies.md for detailed strategies.
Golden Rules:
- 1. Specific > Generic - If you can't add specific value, stay silent
- Quality > Quantity - One thoughtful reply beats five generic ones
- Authentic > Performative - Sound human, not bot
- Value > Visibility - Help the community, don't just farm engagement
What Works:
✅ Technical questions showing understanding
✅ Specific insights from experience
✅ Genuine celebration with substance
✅ Helpful resources and connections
What Fails:
❌ Generic praise ("Love this!", "Great post!")
❌ Corporate speak ("excited to announce")
❌ Surface-level comments
❌ Forced humor
Cron Integration
To run automatically, create a cron job:
CODEBLOCK12
Advanced Features
Content Filters
Skip spam, scams, and low-quality content automatically.
CODEBLOCK13
Mention Tracking
Reply to mentions of your account, not just trending.
CODEBLOCK14
Webhook Notifications
Send engagement results to Telegram or Discord.
CODEBLOCK15
User Blacklist/Whitelist
Skip bots, prioritize builders.
CODEBLOCK16
Analytics Tracking
Track engagement stats over time in
analytics.json.
CODEBLOCK17
Quote Support
Quote tweets/recasts instead of direct replies.
CODEBLOCK18
Troubleshooting
"Already replied to all trending" - All top posts already engaged. Wait for new trending content.
Twitter rate limit - Wait 15 minutes. Consider reducing frequency.
Farcaster "unknown fid" - Hub not synced. Wait 30-60 seconds.
Moltbook verification failed - Solve the math captcha in verification response.
Files
- -
scripts/engage.mjs - Main engagement script - INLINECODE15 - Fetch trending by platform
- INLINECODE16 - Persona-driven reply generation
- INLINECODE17 - Post reply to platform
- INLINECODE18 - Persona configuration guide
- INLINECODE19 - Platform API documentation
- INLINECODE20 - Reply quality strategies
多渠道互动代理
面向 Twitter、Farcaster 和 Moltbook 的自主互动机器人。获取热门内容,生成基于人设的上下文回复,追踪已回复帖子以避免重复。
快速开始
1. 创建配置
将 assets/sample-config.json 复制为 config.json 并填写你的凭证(参见下方设置指南部分)。
2. 运行互动
bash
在特定平台互动
node scripts/engage.mjs --platform twitter
node scripts/engage.mjs --platform farcaster
node scripts/engage.mjs --platform moltbook
在所有已启用平台互动
node scripts/engage.mjs --all
依赖项与设置指南
此技能集成了多个平台。逐一设置:
Farcaster 设置(Farcaster 互动必需)
技能: farcaster-agent (https://clawhub.com/skills/farcaster-agent)
前置条件:
- - 任意链上(以太坊、Optimism、Base、Arbitrum、Polygon)至少 $1 ETH 或 USDC
- Optimism 上至少 0.0005 ETH 用于 FID 注册
自动设置命令:
bash
clawhub install farcaster-agent
PRIVATE_KEY=0x... node src/auto-setup.js 你的第一条动态
你将获得:
json
{
fid: 123456,
neynarApiKey: ...,
signerPrivateKey: ...,
custodyPrivateKey: 0x...
}
费用明细:
- - FID 注册:~$0.20(需 0.0005 ETH + Gas 费)
- 签名者密钥:~$0.05
- 跨链桥接:~$0.10-0.20
- 总计:~$0.50(建议预算 $1 以确保安全)
Neynar API:
- - 免费层:300 次请求/分钟
- 获取密钥:https://dev.neynar.com
Twitter 设置(Twitter 互动必需)
两个选项:
选项 A:x-api(OAuth 1.0a,官方)
- - 在 https://developer.x.com/en/portal/dashboard 获取凭证
- 创建项目 → 应用
- 设置权限:读写
- 速率限制:推文 50 条/15分钟,搜索 450 次/15分钟
选项 B:AISA API(替代方案,适合热门内容)
- - AISA API 端点:https://api.aisa.one/apis/v1/twitter/tweet/advanced_search
- 在 https://aisa.one 获取 API 密钥
- 通过 AISA 搜索热门内容快速可靠
- 配置:将 aisaTwitterApiKey 添加到 twitter 平台
建议: 使用 AISA 发现热门内容,使用 x-api 发布(回复)
Moltbook 设置(Moltbook 互动必需)
API 基础地址: https://www.moltbook.com/api/v1(注意:使用 www)
获取 API 密钥:
- 1. 在 https://www.moltbook.com 注册
- 从账户设置获取令牌
- 验证:https://www.moltbook.com/api/v1/posts
⚠️ 关键: 仅向 www.moltbook.com 发送 API 密钥,切勿发送给其他域名
验证: 帖子需要解决数学验证码(此技能中已自动化)
配置汇总
所有凭证放入 config.json:
json
{
platforms: {
twitter: { oauth: {...} },
farcaster: { neynarApiKey: ..., fid: 123, ... },
moltbook: { apiKey: ... }
}
}
核心工作流
第 1 步:加载配置
- - 读取 config.json 获取平台凭证
- 加载人设设置(语气、价值观、风格)
- 从 engagement-state.json 加载状态(已回复帖子)
第 2 步:获取热门内容
Twitter(通过 x-api 方式的 OAuth 1.0a):
javascript
// 使用 twitter-api-v2 配合 OAuth 1.0a
const client = new TwitterApi({
appKey: config.twitter.oauth.consumerKey,
appSecret: config.twitter.oauth.consumerSecret,
accessToken: config.twitter.oauth.accessToken,
accessSecret: config.twitter.oauth.accessTokenSecret
});
const trending = await client.v2.search(crypto OR web3 OR base, { max_results: 10 });
Farcaster(Neynar API):
javascript
const response = await fetch(https://api.neynar.com/v2/farcaster/feed/trending?limit=5, {
headers: { x-api-key: config.farcaster.neynarApiKey }
});
Moltbook:
javascript
const response = await fetch(https://www.moltbook.com/api/v1/posts/trending, {
headers: { Authorization: Bearer ${config.moltbook.apiKey} }
});
第 3 步:过滤已回复帖子
- - 加载 engagement-state.json
- 过滤掉 repliedPosts[platform] 中包含 ID 的帖子
- 从剩余帖子中随机选择未回复的帖子
第 4 步:生成上下文回复
基于人设配置,分析帖子内容并生成回复:
回复生成规则:
- 1. 仔细阅读帖子 - 理解主题、语气、意图
- 匹配人设 - 使用配置的语气、价值观、签名表情符号
- 增加具体价值 - 技术见解、问题或真实反应
- 避免泛泛赞美 - 不要好帖子!、喜欢这个!
- 保持自然 - 如果人设要求,使用加密俚语,短句
语气平衡(可配置):
- - 教育型:技术见解、解释、资源
- 社区氛围:庆祝、鼓励、连接
- 幽默:机智、自嘲笑话、表情包(适当时)
第 5 步:发布回复
Twitter:
javascript
await client.v2.reply(replyText, originalTweetId);
Farcaster(通过 farcaster-agent 模式):
javascript
// 使用 post-cast.js 配合 PARENTFID + PARENTHASH
const result = await postCast({
privateKey: config.farcaster.custodyPrivateKey,
signerPrivateKey: config.farcaster.signerPrivateKey,
fid: config.farcaster.fid,
text: replyText,
parentFid: originalCast.author.fid,
parentHash: originalCast.hash
});
Moltbook:
javascript
await fetch(https://www.moltbook.com/api/v1/comments, {
method: POST,
headers: { Authorization: Bearer ${config.moltbook.apiKey} },
body: JSON.stringify({ postId, content: replyText })
});
第 6 步:更新状态
json
{
lastUpdated: 2026-02-12T11:00:00Z,
repliedPosts: {
twitter: [1234567890, 0987654321],
farcaster: [0xabc123..., 0xdef456...],
moltbook: [uuid-1, uuid-2]
},
stats: {
totalReplies: 47,
byPlatform: { twitter: 20, farcaster: 15, moltbook: 12 }
}
}
人设配置指南
详见 references/persona-config.md 了解详细的人设设置。
快速示例:
json
// 加密原生构建者
{
tone: 加密原生、技术型、支持性,
signatureEmoji: 🦞,
values: [交付, 社区, 开源],
phrases: [行动胜于空谈, ser, wagmi, based]
}
// 专业分析师
{
tone: 专业、分析型、教育型,
signatureEmoji: 📊,
values: [准确性, 深度, 清晰度],
phrases: [数据表明, 值得注意, 关键见解]
}
平台特定说明
详见 references/platform-apis.md 了解 API 详情。
Twitter: 需要 OAuth 1.0a。速率限制:50 条推文/15分钟,300 条推文/3小时