抖音私信发送
name: douyin-send-message
by calvin-dean · published 2026-04-01
$ claw add gh:calvin-dean/calvin-dean-douyin-send-message---
name: douyin-send-message
description: 在抖音网页版发送私信消息。当用户想发送抖音私信、提醒续火花、或者提到"抖音发消息"、"发抖音私信"、"douyin send message"时触发。支持快速查找联系人、自动发送并关闭页面。
---
# 抖音私信发送
参数
调用时传入两个参数(由调用方实时提供,不要写死):
执行步骤
Step 1: 打开私信列表页面
browser(action="open", url="https://www.douyin.com/chat", profile="openclaw")
browser(action="act", kind="wait", timeMs=2000, targetId="<pageId>")Step 2: 查找并点击目标联系人
**用一条 snapshot 搞定查找(默认 snapshot 包含 ref,速度较快):**
browser(action="snapshot", targetId="<pageId>")在结果中找到目标联系人的 listitem ref(格式:`listitem [ref=e数字]`,在联系人名字元素附近)。
然后直接点击 ref:
browser(action="act", ref="<ref>", kind="click", targetId="<pageId>")
browser(action="act", kind="wait", timeMs=1000, targetId="<pageId>")Step 3: 输入并发送
browser(action="act", kind="evaluate", fn="() => { var msg = 'MESSAGE_CONTENT'; var inputs = document.querySelectorAll('[contenteditable=\"true\"]'); for (var input of inputs) { var rect = input.getBoundingClientRect(); if (rect.width > 0 && rect.height > 0) { input.focus(); for (var i = 0; i < msg.length; i++) { document.execCommand('insertText', false, msg[i]); } return 'OK'; } } return 'No input'; }", targetId="<pageId>")
browser(action="act", kind="press", key="Enter", targetId="<pageId>")
browser(action="act", kind="wait", timeMs=1000, targetId="<pageId>")Step 4: 关闭页面
browser(action="close", targetId="<pageId>")关键 DOM(2026-03-22 验证)
执行流程(最优步骤数)
1. `open` → 等 2s
2. `snapshot`(默认,含 ref)→ 找到联系人的 `listitem ref`
3. `click` ref → 等 1s
4. `evaluate` 输入 → `press` Enter → 等 1s
5. `close`
**总计 5 个 browser 操作**,平均总耗时约 40-60 秒(主要瓶颈在浏览器工具自身延迟,无法进一步优化)。
注意事项
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...