twitter-dms
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTwitter/X DMs Skill
Twitter/X DMs Skill
Overview
概述
Automates Twitter/X Direct Message operations including sending DMs, managing conversations, handling message requests, and group DM management through browser automation.
通过浏览器自动化实现Twitter/X私信操作的自动化,包括发送私信、管理对话、处理消息请求以及群组私信管理。
Quick Install
快速安装
bash
curl -sSL https://canifi.com/skills/twitter-dms/install.sh | bashOr manually:
bash
cp -r skills/twitter-dms ~/.canifi/skills/bash
curl -sSL https://canifi.com/skills/twitter-dms/install.sh | bash或者手动安装:
bash
cp -r skills/twitter-dms ~/.canifi/skills/Setup
配置
Configure via canifi-env:
bash
undefined通过canifi-env进行配置:
bash
undefinedFirst, ensure canifi-env is installed:
First, ensure canifi-env is installed:
curl -sSL https://canifi.com/install.sh | bash
curl -sSL https://canifi.com/install.sh | bash
canifi-env set TWITTER_USERNAME "your-username"
canifi-env set TWITTER_PASSWORD "your-password"
undefinedcanifi-env set TWITTER_USERNAME "your-username"
canifi-env set TWITTER_PASSWORD "your-password"
undefinedPrivacy & Authentication
隐私与认证
Your credentials, your choice. Canifi LifeOS respects your privacy.
你的凭据,由你掌控。 Canifi LifeOS尊重你的隐私。
Option 1: Manual Browser Login (Recommended)
选项1:手动浏览器登录(推荐)
If you prefer not to share credentials with Claude Code:
- Complete the Browser Automation Setup using CDP mode
- Login to the service manually in the Playwright-controlled Chrome window
- Claude will use your authenticated session without ever seeing your password
如果你不想与Claude Code共享凭据:
- 使用CDP模式完成Browser Automation Setup
- 在Playwright控制的Chrome窗口中手动登录该服务
- Claude将使用你的已认证会话,且绝不会看到你的密码
Option 2: Environment Variables
选项2:环境变量
If you're comfortable sharing credentials, you can store them locally:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"Note: Credentials stored in canifi-env are only accessible locally on your machine and are never transmitted.
如果你愿意共享凭据,可以将其存储在本地:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"注意:存储在canifi-env中的凭据仅能在你的本地机器上访问,绝不会被传输。
Capabilities
功能
- Send direct messages to followers/following
- Create and manage group DMs
- Respond to message requests
- Search DM history
- Share tweets via DM
- Send images and GIFs in DMs
- React to messages
- Manage DM settings and filters
- 向关注者/已关注用户发送私信
- 创建和管理群组私信
- 回复消息请求
- 搜索私信历史
- 通过私信分享推文
- 在私信中发送图片和GIF
- 对消息进行React操作
- 管理私信设置和过滤器
Usage Examples
使用示例
Example 1: Send a DM
示例1:发送私信
User: "DM @techfriend about the conference next week"
Claude: I'll send that direct message.
- Navigate to twitter.com/messages
- Search for @techfriend
- Open or start conversation
- Send message about conference
- Confirm message deliveredUser: "DM @techfriend about the conference next week"
Claude: I'll send that direct message.
- Navigate to twitter.com/messages
- Search for @techfriend
- Open or start conversation
- Send message about conference
- Confirm message deliveredExample 2: Create Group DM
示例2:创建群组私信
User: "Create a Twitter group DM with @alex and @jordan for the podcast"
Claude: I'll create that group conversation.
- Click compose new message
- Add @alex and @jordan
- Name group "Podcast Discussion"
- Send initial message
- Confirm group createdUser: "Create a Twitter group DM with @alex and @jordan for the podcast"
Claude: I'll create that group conversation.
- Click compose new message
- Add @alex and @jordan
- Name group "Podcast Discussion"
- Send initial message
- Confirm group createdExample 3: Check Message Requests
示例3:查看消息请求
User: "Check my Twitter message requests"
Claude: I'll review your message requests.
- Navigate to message requests
- List pending message requests
- Summarize who's trying to reach you
- Await instruction to accept or declineUser: "Check my Twitter message requests"
Claude: I'll review your message requests.
- Navigate to message requests
- List pending message requests
- Summarize who's trying to reach you
- Await instruction to accept or declineExample 4: Share Tweet via DM
示例4:通过私信分享推文
User: "Share that viral tweet to @bestfriend via DM"
Claude: I'll share that tweet.
- Copy tweet link
- Open DM with @bestfriend
- Paste tweet link (embeds automatically)
- Add comment if requested
- Send messageUser: "Share that viral tweet to @bestfriend via DM"
Claude: I'll share that tweet.
- Copy tweet link
- Open DM with @bestfriend
- Paste tweet link (embeds automatically)
- Add comment if requested
- Send messageAuthentication Flow
认证流程
- Navigate to twitter.com/login via Playwright MCP
- Enter username/email from canifi-env
- Enter password
- Handle phone/email verification if prompted
- Complete 2FA if enabled (notify user via iMessage)
- Verify access to messages tab
- Maintain session cookies
- 通过Playwright MCP导航至twitter.com/login
- 从canifi-env中输入用户名/邮箱
- 输入密码
- 如有提示,处理电话/邮箱验证
- 若启用了双因素认证(2FA),完成验证(通过iMessage通知用户)
- 验证是否有权限访问私信标签页
- 维护会话Cookie
Error Handling
错误处理
- Login Failed: Try email instead of username, retry
- Session Expired: Re-authenticate automatically
- 2FA Required: iMessage for authentication code
- Verification Required: Notify user to check email/phone
- DM Restricted: User may not accept DMs from non-followers
- Rate Limited: Wait 15+ minutes before retry
- User Not Found: Verify username spelling
- Account Locked: Notify user to verify account
- 登录失败:尝试使用邮箱而非用户名,重试
- 会话过期:自动重新认证
- 需要2FA:通过iMessage获取验证码
- 需要验证:通知用户检查邮箱/电话
- 私信受限:用户可能不接受非关注者的私信
- 速率限制:等待15分钟以上再重试
- 用户未找到:验证用户名拼写
- 账户锁定:通知用户验证账户
Self-Improvement Instructions
自我改进说明
When encountering new X/Twitter DM features:
- Document new UI selectors
- Add support for new message types
- Log successful DM patterns
- Update for API/UI changes
当遇到新的X/Twitter私信功能时:
- 记录新的UI选择器
- 添加对新消息类型的支持
- 记录成功的私信模式
- 针对API/UI变更进行更新
Notes
注意事项
- DMs only possible with users who allow them
- Some accounts restrict DMs to followers
- X Premium may have different DM limits
- Message requests go to separate folder
- Twitter frequently changes UI/branding
- Rate limits are strictly enforced
- GIF sending uses Twitter's GIF search
- 仅能向允许接收私信的用户发送私信
- 部分账户仅允许关注者发送私信
- X Premium可能有不同的私信限制
- 消息请求会进入单独的文件夹
- Twitter经常更改UI/品牌标识
- 速率限制执行严格
- GIF发送使用Twitter的GIF搜索