一键导入
add-whatsapp
Add WhatsApp as a channel. Can replace other channels entirely or run alongside them. Uses QR code or pairing code for authentication.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add WhatsApp as a channel. Can replace other channels entirely or run alongside them. Uses QR code or pairing code for authentication.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
"自动化论文检索、翻译、导入和学习闭环系统。每日从 arXiv 检索论文、自动翻译标题和摘要、导入 Zotero、生成 Obsidian 笔记和学习报告。"
"生成各种类型的图表和流程图:流程图、时序图、类图、甘特图、思维导图等。支持 Mermaid、PlantUML、Graphviz 等格式。"
"GitHub CLI (gh) 自动化操作。管理仓库、Issues、Pull Requests、Workflows、Releases 等。支持所有 gh 命令。"
"深度反思学习过程,巩固知识,发现盲点,优化学习策略。基于笔记内容生成反思报告、学习建议、知识图谱。"
"从 arXiv 自动检索论文、翻译标题摘要、导入 Zotero、生成 Obsidian 笔记。支持关键词检索、自动去重、中文翻译。"
"生成论文学习报告:每日总结、每周总结、月度报告、季度报告、年度总结。统计学习进度、分析研究方向、追踪知识积累。"
| name | add-whatsapp |
| description | Add WhatsApp as a channel. Can replace other channels entirely or run alongside them. Uses QR code or pairing code for authentication. |
This skill configures WhatsApp for AcademiClaw. The channel code is already included in this minimal installation. This skill handles authentication, registration, and configuration.
Check if WhatsApp is already configured. If store/auth/ exists with credential files, skip to Phase 4 (Registration) or Phase 5 (Verify).
ls store/auth/creds.json 2>/dev/null && echo "WhatsApp auth exists" || echo "No WhatsApp auth"
Check whether the environment is headless (no display server):
[[ -z "$DISPLAY" && -z "$WAYLAND_DISPLAY" && "$OSTYPE" != darwin* ]] && echo "IS_HEADLESS=true" || echo "IS_HEADLESS=false"
Use AskUserQuestion to collect configuration. Adapt auth options based on environment:
If IS_HEADLESS=true AND not WSL → AskUserQuestion: How do you want to authenticate WhatsApp?
Otherwise (macOS, desktop Linux, or WSL) → AskUserQuestion: How do you want to authenticate WhatsApp?
If they chose pairing code:
AskUserQuestion: What is your phone number? (Include country code without +, e.g., 1234567890)
Verify the WhatsApp channel code is present:
test -f src/channels/whatsapp.ts && echo "WhatsApp channel code present" || echo "ERROR: WhatsApp channel code missing"
npm list @whiskeysockets/baileys 2>/dev/null && echo "Baileys installed" || echo "Installing Baileys..."
If not installed:
npm install @whiskeysockets/baileys qrcode qrcode-terminal
npm run build
Build must be clean before proceeding.
rm -rf store/auth/
For QR code in browser (recommended):
npx tsx setup/index.ts --step whatsapp-auth -- --method qr-browser
(Bash timeout: 150000ms)
Tell the user:
A browser window will open with a QR code.
- Open WhatsApp > Settings > Linked Devices > Link a Device
- Scan the QR code in the browser
- The page will show "Authenticated!" when done
For QR code in terminal:
npx tsx setup/index.ts --step whatsapp-auth -- --method qr-terminal
Tell the user:
- Open WhatsApp > Settings > Linked Devices > Link a Device
- Scan the QR code displayed in the terminal
For pairing code:
npx tsx setup/index.ts --step whatsapp-auth -- --method pairing-code --phone <their-phone-number>
(Bash timeout: 150000ms). Display PAIRING_CODE from output.
Tell the user:
A pairing code will appear. Enter it within 60 seconds — codes expire quickly.
- Open WhatsApp > Settings > Linked Devices > Link a Device
- Tap Link with phone number instead
- Enter the code immediately
If the code expires, re-run the command — a new code will be generated.
If failed: qr_timeout → re-run. logged_out → delete store/auth/ and re-run. 515 → re-run. timeout → ask user, offer retry.
test -f store/auth/creds.json && echo "Authentication successful" || echo "Authentication failed"
Channels auto-enable when their credentials are present — WhatsApp activates when store/auth/creds.json exists.
Sync to container environment:
mkdir -p data/env && cp .env data/env/env
Get the bot's WhatsApp number: node -e "const c=require('./store/auth/creds.json');console.log(c.me.id.split(':')[0].split('@')[0])"
AskUserQuestion: Is this a shared phone number (personal WhatsApp) or a dedicated number (separate device)?
AskUserQuestion: What trigger word should activate the assistant?
AskUserQuestion: What should the assistant call itself?
AskUserQuestion: Where do you want to chat with the assistant?
Shared number options:
Dedicated number options:
Self-chat: JID = your phone number with @s.whatsapp.net. Extract from auth credentials:
node -e "const c=JSON.parse(require('fs').readFileSync('store/auth/creds.json','utf-8'));console.log(c.me?.id?.split(':')[0]+'@s.whatsapp.net')"
DM with bot: Ask for the bot's phone number. JID = NUMBER@s.whatsapp.net
Group (solo, existing): Run group sync and list available groups:
npx tsx setup/index.ts --step groups
npx tsx setup/index.ts --step groups --list
The output shows JID|GroupName pairs. Present candidates as AskUserQuestion (names only, not JIDs).
npx tsx setup/index.ts --step register \
--jid "<jid>" \
--name "<chat-name>" \
--trigger "@<trigger>" \
--folder "whatsapp_main" \
--channel whatsapp \
--assistant-name "<name>" \
--is-main \
--no-trigger-required # Only for main/self-chat
For additional groups (trigger-required):
npx tsx setup/index.ts --step register \
--jid "<group-jid>" \
--name "<group-name>" \
--trigger "@<trigger>" \
--folder "whatsapp_<group-name>" \
--channel whatsapp
npm run build
Restart the service:
# macOS (launchd)
launchctl kickstart -k gui/$(id -u)/com.academiclaw
# Linux (systemd)
systemctl --user restart academiclaw
# Linux (nohup fallback)
bash start-academiclaw.sh
Tell the user:
Send a message to your registered WhatsApp chat:
- For self-chat / main: Any message works
- For groups: Use the trigger word (e.g., "@Andy hello")
The assistant should respond within a few seconds.
tail -f logs/academiclaw.log
QR codes expire after ~60 seconds. Re-run the auth command:
rm -rf store/auth/ && npx tsx setup/index.ts --step whatsapp-auth -- --method qr-browser
Codes expire in ~60 seconds. To retry:
rm -rf store/auth/ && npx tsx setup/index.ts --step whatsapp-auth -- --method pairing-code --phone <phone>
Enter the code immediately when it appears. Also ensure:
+ (e.g., 1234567890)This happens when two instances connect with the same credentials. Ensure only one NanoClaw process is running:
pkill -f "node dist/index.js"
# Then restart
Check:
ls store/auth/creds.jsonsqlite3 store/messages.db "SELECT * FROM registered_groups WHERE jid LIKE '%whatsapp%' OR jid LIKE '%@g.us' OR jid LIKE '%@s.whatsapp.net'"launchctl list | grep academiclaw (macOS) or systemctl --user status academiclaw (Linux)tail -50 logs/academiclaw.logIf running npm run dev while the service is active:
# macOS:
launchctl unload ~/Library/LaunchAgents/com.academiclaw.plist
npm run dev
# When done testing:
launchctl load ~/Library/LaunchAgents/com.academiclaw.plist
# Linux:
# systemctl --user stop academiclaw
# npm run dev
# systemctl --user start academiclaw