Social Post
Post to Twitter and/or Farcaster with automatic character limit validation and image upload handling.
Features
- - ✅ Multi-account support - manage multiple Twitter accounts from one skill
- ✅ Auto-variation - avoid Twitter's duplicate content detection with
--vary flag - ✅ Post to Twitter only
- ✅ Post to Farcaster only
- ✅ Post to both platforms simultaneously
- ✅ Reply to tweets and casts - respond to specific posts on both platforms
- ✅ Draft preview - shows exactly what will be posted before confirmation
- ✅ Character/byte limit validation
- ✅ Image upload support (for posts and replies)
- ✅ Thread support - automatically split long text into numbered posts
- ✅ Link shortening - compress URLs using TinyURL (saves characters)
- ✅ Auto-truncate on overflow (optional)
Platform Limits
- - Twitter: 252 characters (280 with 10% safety buffer)
- Farcaster: 288 bytes (320 with 10% safety buffer)
Setup & Credentials
X/Twitter Setup
Required credentials (stored in /home/phan_harry/.openclaw/.env):
CODEBLOCK0
How to get credentials:
- 1. Apply for X Developer Account
- Go to https://developer.twitter.com/en/portal/dashboard
- Apply for Developer Access
- Wait for approval (usually 1-2 days)
- 2. Enable Consumption-Based Billing
- Set up payment method (credit card) in Developer Portal
-
No subscription tiers - you pay only for actual API usage
- Charged per API request (posts, reads, etc.)
- No monthly minimums or fees
- 3. Create an App
- In Developer Portal, create a new App
- Name: "Social Post Bot" (or any name)
- Set permissions to "Read and Write"
- 4. Generate Keys
- Consumer Key & Secret: In "Keys and tokens" tab
- Access Token & Secret: Click "Generate" under "Authentication Tokens"
- Save all 4 credentials securely
- 4. Add to .env file
CODEBLOCK1
Test your credentials:
CODEBLOCK2
Multi-Account Setup (Optional)
You can manage multiple Twitter accounts by adding additional credentials with custom prefixes.
Example: Adding a second account
CODEBLOCK3
Usage:
CODEBLOCK4
Naming convention:
- - Default account:
X_CONSUMER_KEY, X_CONSUMER_SECRET, etc. - Custom accounts:
{PREFIX}_API_KEY, {PREFIX}_API_KEY_SECRET, {PREFIX}_ACCESS_TOKEN, INLINECODE7 - Use lowercase prefix name in
--account flag
Farcaster Setup
Required credentials (stored in /home/phan_harry/.openclaw/farcaster-credentials.json):
CODEBLOCK5
How to get credentials:
- 1. Use farcaster-agent skill to create account
CODEBLOCK6
- 2. Or use existing credentials
- If you already have a Farcaster account
- Export your custody wallet private key
- Export your signer private key
- Manually create the JSON file
- 3. Fund the custody wallet (REQUIRED)
CODEBLOCK7
- 4. Verify setup
CODEBLOCK8
Security Notes:
- - ⚠️ Never share your private keys
- ⚠️ Credentials are stored as plain text - secure your system
- ⚠️
.env file should have 600 permissions (read/write owner only) - ⚠️ Back up your credentials securely
Usage
Posting
Text only
CODEBLOCK9
With image
CODEBLOCK10
Replying
Reply to Twitter
CODEBLOCK11
Reply to Farcaster
CODEBLOCK12
Reply to both platforms
CODEBLOCK13
Options
For post.sh (posting)
- -
--twitter - Post to Twitter only - INLINECODE14 - Post to Farcaster only
- INLINECODE15 - Twitter account to use (lowercase prefix from .env)
- INLINECODE16 - Auto-vary text to avoid duplicate content detection
- INLINECODE17 - Attach image
- INLINECODE18 - Split long text into numbered thread
- INLINECODE19 - Shorten URLs to save characters
- INLINECODE20 - Auto-truncate if over limit
- INLINECODE21 - Preview without posting
- INLINECODE22 - Skip confirmation prompt (auto-confirm)
For reply.sh (replying)
- -
--twitter <tweet_id> - Reply to Twitter tweet with this ID - INLINECODE25 - Reply to Farcaster cast with this hash
- INLINECODE26 - Twitter account to use (lowercase prefix from .env)
- INLINECODE27 - Attach image to reply
- INLINECODE28 - Shorten URLs to save characters
- INLINECODE29 - Auto-truncate if over limit
- INLINECODE30 - Preview without replying
- INLINECODE31 - Skip confirmation prompt (auto-confirm)
Examples
Posting Examples
CODEBLOCK14
Reply Examples
CODEBLOCK15
Draft Preview
The script now shows a draft preview before posting:
CODEBLOCK16
- - Interactive mode: Prompts for confirmation
- Non-interactive/automated: Use
--yes flag to skip prompt - Dry run: Use
--dry-run to preview without any posting
Requirements
- - Twitter credentials in
.env (XCONSUMERKEY, XCONSUMERSECRET, XACCESSTOKEN, XACCESSTOKEN_SECRET) - Farcaster credentials in INLINECODE35
- USDC on Base chain (custody wallet): 0.001 USDC per Farcaster cast
- For images:
curl, INLINECODE37
Costs
X/Twitter
- - 100% Consumption-based - NO subscription tiers (tiers have been eliminated)
- Pay per API request - charged for each call (post, read, etc.)
- No monthly fees, no minimums, no tier upgrades to worry about
- Automatic billing based on actual usage
- Payment via credit card through X Developer portal
- Uses OAuth 1.0a (no blockchain/USDC required)
- Requires approved X Developer account + enabled billing
Official pricing: https://developer.twitter.com/#pricing
Critical: X API completely eliminated subscription tiers (Basic, Pro, etc.). The model is now purely pay-per-use - you are charged only for the API requests you actually make.
Farcaster
Each Farcaster cast costs
0.001 USDC (paid via x402 protocol):
- - Deducted from custody wallet on Base chain
- Sent to Neynar Hub: INLINECODE38
- ~$1 USDC = 1000 casts
Check balance:
CODEBLOCK17
Fund wallet:
Send USDC to custody address on Base chain. Bridge from other chains if needed.
Image Hosting
- - Twitter: Direct upload via Twitter API
- Farcaster: Uploads to imgur for public URL (embeds automatically)
Error Handling
- - Shows character/byte count before posting
- Warns if exceeding limits
- Option to truncate or abort
- Validates credentials before attempting post
社交帖子
发布到Twitter和/或Farcaster,支持自动字符限制验证和图片上传处理。
功能特性
- - ✅ 多账户支持 - 通过一个技能管理多个Twitter账户
- ✅ 自动变体 - 使用--vary标志避免Twitter的重复内容检测
- ✅ 仅发布到Twitter
- ✅ 仅发布到Farcaster
- ✅ 同时发布到两个平台
- ✅ 回复推文和帖子 - 在两个平台上回复特定帖子
- ✅ 草稿预览 - 在确认前精确显示将要发布的内容
- ✅ 字符/字节限制验证
- ✅ 图片上传支持(适用于帖子和回复)
- ✅ 帖子串支持 - 自动将长文本拆分为编号帖子
- ✅ 链接缩短 - 使用TinyURL压缩URL(节省字符)
- ✅ 自动截断溢出内容(可选)
平台限制
- - Twitter: 252个字符(280个字符含10%安全缓冲)
- Farcaster: 288字节(320字节含10%安全缓冲)
设置与凭据
X/Twitter设置
所需凭据(存储在/home/phan_harry/.openclaw/.env中):
bash
XCONSUMERKEY=你的消费者密钥
XCONSUMERSECRET=你的消费者密钥密码
XACCESSTOKEN=你的访问令牌
XACCESSTOKEN_SECRET=你的访问令牌密码
X_USERNAME=你的用户名
XUSERID=你的用户ID
如何获取凭据:
- 1. 申请X开发者账号
- 访问 https://developer.twitter.com/en/portal/dashboard
- 申请开发者权限
- 等待审批(通常1-2天)
- 2. 启用按用量计费
- 在开发者门户中设置支付方式(信用卡)
-
无需订阅层级 - 仅按实际API使用量付费
- 按API请求计费(发布、读取等)
- 无月度最低消费或费用
- 3. 创建应用
- 在开发者门户中创建新应用
- 名称:社交帖子机器人(或任意名称)
- 设置权限为读取和写入
- 4. 生成密钥
- 消费者密钥和密码:在密钥和令牌选项卡中
- 访问令牌和密码:在认证令牌下点击生成
- 安全保存所有4个凭据
- 4. 添加到.env文件
bash
echo X
CONSUMERKEY=xxx >> ~/.openclaw/.env
echo X
CONSUMERSECRET=xxx >> ~/.openclaw/.env
echo X
ACCESSTOKEN=xxx >> ~/.openclaw/.env
echo X
ACCESSTOKEN_SECRET=xxx >> ~/.openclaw/.env
测试你的凭据:
bash
试运行(不会发布)
scripts/post.sh --twitter --dry-run 测试消息
多账户设置(可选)
你可以通过添加带有自定义前缀的额外凭据来管理多个Twitter账户。
示例:添加第二个账户
bash
使用自定义前缀添加凭据(例如 MYACCOUNT_)
echo MYACCOUNT
APIKEY=xxx >> ~/.openclaw/.env
echo MYACCOUNT
APIKEY_SECRET=xxx >> ~/.openclaw/.env
echo MYACCOUNT
ACCESSTOKEN=xxx >> ~/.openclaw/.env
echo MYACCOUNT
ACCESSTOKEN_SECRET=xxx >> ~/.openclaw/.env
使用方法:
bash
从默认账户发布(X_*)
scripts/post.sh --twitter 来自默认账户的消息
从自定义账户发布
scripts/post.sh --account myaccount --twitter 来自第二个账户的消息
从自定义账户回复
scripts/reply.sh --account myaccount --twitter TWEET_ID 来自第二个账户的回复
命名约定:
- - 默认账户:XCONSUMERKEY、XCONSUMERSECRET等
- 自定义账户:{PREFIX}APIKEY、{PREFIX}APIKEYSECRET、{PREFIX}ACCESSTOKEN、{PREFIX}ACCESSTOKENSECRET
- 在--account标志中使用小写前缀名称
Farcaster设置
所需凭据(存储在/home/phan_harry/.openclaw/farcaster-credentials.json中):
json
{
fid: 你的farcaster_id,
custodyAddress: 0x...,
custodyPrivateKey: 0x...,
signerPublicKey: 0x...,
signerPrivateKey: 0x...,
createdAt: 2026-01-01T00:00:00.000Z
}
如何获取凭据:
- 1. 使用farcaster-agent技能创建账户
bash
# 这将引导你完成:
# - 创建钱包
# - 注册FID
# - 添加签名密钥
# - 自动保存凭据
# 参见:/skills/farcaster-agent/SKILL.md
- 2. 或使用现有凭据
- 如果你已有Farcaster账户
- 导出你的托管钱包私钥
- 导出你的签名私钥
- 手动创建JSON文件
- 3. 为托管钱包充值(必需)
bash
# 检查当前余额
scripts/check-balance.sh
# 在Base链上向托管地址发送USDC
# 最低:0.1 USDC(约100条帖子)
# 推荐:1-5 USDC(1000-5000条帖子)
- 4. 验证设置
bash
# 检查凭据是否存在
ls -la ~/.openclaw/farcaster-credentials.json
# 检查钱包余额
scripts/check-balance.sh
# 测试发布(试运行)
scripts/post.sh --farcaster --dry-run 测试消息
安全注意事项:
- - ⚠️ 切勿分享你的私钥
- ⚠️ 凭据以明文存储 - 请保护你的系统安全
- ⚠️ .env文件应具有600权限(仅所有者可读写)
- ⚠️ 安全备份你的凭据
使用方法
发布
仅文本
bash
发布到两个平台
scripts/post.sh 你的消息
仅Twitter
scripts/post.sh --twitter 你的消息
仅Farcaster
scripts/post.sh --farcaster 你的消息
带图片
bash
带图片发布到两个平台
scripts/post.sh --image /path/to/image.jpg 你的说明
仅Twitter带图片
scripts/post.sh --twitter --image /path/to/image.jpg 说明
仅Farcaster带图片
scripts/post.sh --farcaster --image /path/to/image.jpg 说明
回复
回复Twitter
bash
回复推文
scripts/reply.sh --twitter TWEET_ID 你的回复
带图片回复
scripts/reply.sh --twitter TWEET_ID --image /path/to/image.jpg 带图片的回复
从URL获取推文ID:twitter.com/user/status/[TWEET_ID]
scripts/reply.sh --twitter 1234567890123456789 好观点!
回复Farcaster
bash
回复帖子
scripts/reply.sh --farcaster CAST_HASH 你的回复
带图片回复
scripts/reply.sh --farcaster 0xabcd1234... --image /path/to/image.jpg 带图片的回复
从URL获取帖子哈希:farcaster.xyz/~/conversations/[HASH]
scripts/reply.sh --farcaster 0xa1b2c3d4e5f6... 有趣的视角!
回复两个平台
bash
回复两个平台(如果你在两个平台上都有对应的ID)
scripts/reply.sh --twitter 123456 --farcaster 0xabcd... 精彩的讨论!
选项
对于post.sh(发布)
- - --twitter - 仅发布到Twitter
- --farcaster - 仅发布到Farcaster
- --account - 要使用的Twitter账户(来自.env的小写前缀)
- --vary - 自动变体文本以避免重复内容检测
- --image - 附加图片
- --thread - 将长文本拆分为编号帖子串
- --shorten-links - 缩短URL以节省字符
- --truncate - 超出限制时自动截断
- --dry-run