← 返回 Skills 市场
moroiser

Douyin Messager | 抖音私信助手

作者 Morois · GitHub ↗ · v1.1.5 · MIT-0
cross-platform ✓ 安全检测通过
2988
总下载
13
收藏
16
当前安装
7
版本数
在 OpenClaw 中安装
/install douyin-messager
功能描述
Send Douyin DMs, reply, and check chat history through browser automation. 自动发送抖音私信、回复消息、查看聊天记录。
使用说明 (SKILL.md)

Douyin Messager | 抖音私信助手

通过浏览器自动化发送抖音私信、获取聊天记录。

前置要求 | Prerequisites

使用本技能前请先确认以下条件。

条件 说明
Browser profile 必须使用 openclaw profile(已通过 browser 工具启动并登录抖音)
登录状态 抖音账号已在 openclaw profile 中保持登录态

为什么需要 openclaw profile?

本技能通过在抖音页面执行 DOM JavaScript(querySelectorclipboard、键盘事件等)实现消息发送。这些操作需要浏览器环境持有有效的抖音登录会话。

  • openclaw profile 由 OpenClaw 启动和管理,独立于 Morois 的日常浏览器 profile
  • 技能仅在抖音域名(douyin.com)内执行 DOM 操作,无法访问其他网站
  • 任何对外发送操作均需用户明确确认,不会自动发送

⚠️ 执行前必须确认

  1. 用户已登录抖音账号(通常已登录,可目测判断)

xdg-open 弹窗:只在 Linux 下存在,Windows/macOS 不需要检查。

  • Windows:shell=powershellos=Windows_NT跳过 xdg-open 检查
  • Linux:shell=bash询问用户是否关闭了弹窗

发送私信流程

步骤 1:打开抖音

  1. 打开抖音主页 → browser action=open profile=openclaw targetUrl=https://www.douyin.com/
  2. xdg-open 弹窗在这步出现(因为打开了抖音主页)
    • Linux:shell=bash询问用户弹窗是否关闭
      • 弹窗未关闭 → 等待用户关闭 → 确认后再继续
      • 弹窗已关闭或无弹窗 → 继续步骤 2
    • Windows/macOS:跳过弹窗检查
  3. 继续步骤 2

步骤 2:打开私信面板

方式 A:置顶联系人(最快)

  1. 获取快照找到私信按钮,点击打开私信面板
  2. 在私信列表中找目标用户名(注意:列表只显示最近联系人,不滚动看不到中间部分)
  3. 点击目标 → 打开聊天窗口

方式 B:搜索用户(普适)

  1. 点击顶栏搜索框,输入用户名
  2. 在搜索结果中找到目标(优先选有"相互关注"标识的),点击进入主页
  3. 点击主页的"私信"按钮 → 私信面板自动打开

注意:私信面板是动态浮层,每次快照后元素 ref 会变化。优先用 JS evaluate 定位元素,少用 ref 点击。

步骤 3:用 JS 操作 Draft.js 输入框

私信输入框是 Draft.js 富文本编辑器(contenteditable),不是普通 input,不能用 type 指令直接操作。

第一步:找到编辑器

browser action=act request={"kind": "evaluate", "fn": "() => { const all = document.querySelectorAll('*'); let panel = null; for (const el of all) { const r = el.getBoundingClientRect(); if (r.width >= 300 && r.width \x3C= 400 && r.height >= 400 && r.height \x3C= 700 && r.left >= 870 && r.left \x3C= 1010) { if (el.textContent.includes('\x3C目标用户名>') && el.textContent.includes('发送消息')) { panel = el; break; } } } if (!panel) return 'panel not found'; const editor = panel.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; return 'found'; }"}

如果返回 panel not found,说明私信面板未打开,重新执行步骤 2。

第二步:用剪贴板粘贴(绕过 Draft.js 事件拦截)

browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; (editor.parentElement || editor).focus(); navigator.clipboard.writeText('消息内容').then(() => document.execCommand('paste')); return 'ok'; }"}
browser action=act request={"kind": "wait", "timeMs": 300}

第三步:确认已写入

browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; return editor.textContent.includes('消息内容') ? 'ok' : 'not written'; }"}

第四步:发送(Enter 键)

browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; editor.dispatchEvent(new KeyboardEvent('keydown', {key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true})); return 'sent'; }"}
browser action=act request={"kind": "wait", "timeMs": 1000}

步骤 4:确认发送成功

获取快照,检查私信列表中是否出现 消息内容 · 刚刚


获取对方回复

滚动到底部

browser action=act request={"kind": "evaluate", "fn": "() => { const panel = document.querySelector('[class*=\"w5duGc5Q\"], [class*=\"RoMuFUzT\"]'); if (!panel) return 'panel not found'; panel.scrollTop = panel.scrollHeight; return 'scrolled'; }"}

截图确认

browser action=screenshot

新消息气泡在可视区域底部之外,先滚动再截图。


完整示例(方式 A:置顶联系人)

# 1. 打开抖音
browser action=open profile=openclaw targetUrl=https://www.douyin.com/
browser action=act request={"kind": "wait", "timeMs": 2000}

# 2. 打开私信面板(JS 点击私信按钮)
browser action=act request={"kind": "evaluate", "fn": "() => { const all = document.querySelectorAll('*'); for (const el of all) { if ((el.textContent || '').trim() === '私信' && el.getBoundingClientRect().width \x3C 100) { el.click(); return 'clicked'; } } return 'not found'; }"}
browser action=act request={"kind": "wait", "timeMs": 800}

# 3. 在私信列表中点击目标
browser action=act request={"kind": "evaluate", "fn": "() => { const all = document.querySelectorAll('[class*=\"w5duGc5Q\"], [class*=\"RoMuFUzT\"]'); for (const p of all) { const r = p.getBoundingClientRect(); if (r.width === 500 && Math.abs(r.left - 1006) \x3C 50) { const items = p.querySelectorAll('[class*=\"cursor-pointer\"]'); for (const item of items) { if ((item.textContent || '').includes('\x3C目标用户名>')) { item.click(); return 'clicked target'; } } } } return 'not found'; }"}
browser action=act request={"kind": "wait", "timeMs": 800}

# 4. 粘贴消息
browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; (editor.parentElement || editor).focus(); navigator.clipboard.writeText('你好').then(() => document.execCommand('paste')); return 'ok'; }"}
browser action=act request={"kind": "wait", "timeMs": 300}

# 5. 发送
browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); editor.dispatchEvent(new KeyboardEvent('keydown', {key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true})); return 'sent'; }"}
browser action=act request={"kind": "wait", "timeMs": 1000}

# 6. 确认
browser action=snapshot

完整示例(方式 B:搜索用户)

# 1. 打开抖音
browser action=open profile=openclaw targetUrl=https://www.douyin.com/
browser action=act request={"kind": "wait", "timeMs": 2000}

# 2. 搜索目标用户名
browser action=act request={"kind": "evaluate", "fn": "() => { const input = document.querySelector('input[type=\"text\"]'); if (!input) return 'input not found'; input.focus(); input.value = '\x3C目标用户名>'; input.dispatchEvent(new Event('input', {bubbles: true})); return 'typed'; }"}
browser action=act request={"kind": "evaluate", "fn": "() => { const btns = document.querySelectorAll('button'); for (const b of btns) { if ((b.textContent || '').includes('搜索')) { b.click(); return 'search clicked'; } } return 'not found'; }"}
browser action=act request={"kind": "wait", "timeMs": 2000}

# 3. 在结果中点击目标主页(选有"相互关注"标识的条目)
browser action=snapshot
# 找到目标条目后点击进入主页

# 4. 点击主页"私信"按钮
browser action=act request={"kind": "evaluate", "fn": "() => { const btns = document.querySelectorAll('button'); for (const b of btns) { if ((b.textContent || '').trim() === '私信') { b.click(); return 'clicked'; } } return 'not found'; }"}
browser action=act request={"kind": "wait", "timeMs": 800}

# 5. 粘贴 + 发送(与方式 A 相同)
browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); if (!editor) return 'editor not found'; (editor.parentElement || editor).focus(); navigator.clipboard.writeText('你好').then(() => document.execCommand('paste')); return 'ok'; }"}
browser action=act request={"kind": "wait", "timeMs": 300}
browser action=act request={"kind": "evaluate", "fn": "() => { const editor = document.querySelector('.public-DraftEditor-content'); editor.dispatchEvent(new KeyboardEvent('keydown', {key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true})); return 'sent'; }"}
browser action=act request={"kind": "wait", "timeMs": 1000}
安全使用建议
This skill appears to do what it says (automate Douyin DMs) and does not ask for extra credentials or installs. Before using: (1) test with a throwaway Douyin account to confirm behavior and avoid accidental messages; (2) be aware it will overwrite your clipboard when pasting messages; (3) the skill runs arbitrary JS in the pages it opens—make sure the agent is limited to https://www.douyin.com/ so it doesn’t read other sites you may have open; (4) browser paste actions may require user permission or gestures in some browsers; (5) if you are uncomfortable with automated access to your logged-in browser session, do not install. If you want greater safety, run this only in an isolated browser/profile or with an account that has no sensitive contacts.
功能分析
Type: OpenClaw Skill Name: douyin-messager Version: 1.1.5 The skill bundle provides instructions for automating Douyin (TikTok China) direct messaging using browser automation. It uses JavaScript evaluation to interact with the platform's Draft.js editor, including simulating clipboard operations and keyboard events to send messages. The logic is transparent, focused entirely on the stated purpose of a messaging assistant, and contains no evidence of data exfiltration, credential theft, or malicious prompt injection in SKILL.md.
能力评估
Purpose & Capability
Name/description (send Douyin DMs) match the runtime instructions: opening douyin.com, locating the DM panel, pasting into the Draft.js editor, sending, scrolling, and taking screenshots. No environment variables, external services, or installs are requested that would be unrelated to browser automation.
Instruction Scope
Instructions perform DOM-wide searches (document.querySelectorAll('*')), evaluate arbitrary JS in the page, use navigator.clipboard.writeText + document.execCommand('paste'), dispatch synthetic keyboard events, and take screenshots. These are appropriate for browser automation, but they do (a) overwrite the clipboard and (b) can read/inspect any content visible on the opened page. Ensure the agent is constrained to douyin.com and that you accept clipboard overwrite and browser automation permissions.
Install Mechanism
Instruction-only skill with no install spec and no code files — lowest-risk install mechanism. Nothing is downloaded or written to disk.
Credentials
No environment variables, credentials, or config paths are requested. The skill asks the user to be logged into Douyin (reasonable and expected) and does not declare or require unrelated secrets.
Persistence & Privilege
always is false and the skill does not request persistent system-wide changes. It does execute actions in the browser at runtime but does not modify other skills or system configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install douyin-messager
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /douyin-messager 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.5
1. Fix display name to proper format: Douyin Messager | 抖音私信助手. 修复显示名称为正确格式。
v1.1.4
Fix subprocess.run(shell=True) in record_audio.py for security compliance. 修复 record_audio.py 中 subprocess.run(shell=True) 调用,提升安全性。
v1.1.3
Improve cross-platform behavior with automatic Windows/macOS detection. 优化跨平台行为,新增 Windows/macOS 自动识别。 Make DM panel navigation more reliable with JS-based targeting. 用 JS 定位提升 DM 面板导航稳定性。 Fix Draft.js input by switching to clipboard paste + Enter dispatch. 通过剪贴板粘贴 + Enter 派发修复 Draft.js 输入兼容性。 Support both pinned-contact and search-based messaging flows. 同时支持置顶联系人与搜索用户两种发信流程。 Add full end-to-end examples for both methods. 新增两套完整可跑通的端到端示例。 Clean up outdated footer metadata. 清理过时的页脚元数据。
v1.1.2
Refined skill wording and publishing readiness. 优化技能表述并整理为更适合发布的版本。
v1.1.1
Optimized triggers for higher sensitivity: added douyin dm, message, chat, history keywords. 优化激活词提高灵敏度:增加 douyin dm、message、chat、history 等关键词。
v1.1.0
Standardize name and description format
v1.0.0
首个版本:支持抖音私信发送、获取聊天记录、处理 xdg-open 弹窗问题
元数据
Slug douyin-messager
版本 1.1.5
许可证 MIT-0
累计安装 17
当前安装数 16
历史版本数 7
常见问题

Douyin Messager | 抖音私信助手 是什么?

Send Douyin DMs, reply, and check chat history through browser automation. 自动发送抖音私信、回复消息、查看聊天记录。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2988 次。

如何安装 Douyin Messager | 抖音私信助手?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install douyin-messager」即可一键安装,无需额外配置。

Douyin Messager | 抖音私信助手 是免费的吗?

是的,Douyin Messager | 抖音私信助手 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Douyin Messager | 抖音私信助手 支持哪些平台?

Douyin Messager | 抖音私信助手 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Douyin Messager | 抖音私信助手?

由 Morois(@moroiser)开发并维护,当前版本 v1.1.5。

💬 留言讨论