跳到正文
cccskills
免费在 GitHub 公开

addtocartfrombitable

从飞书Bitable表格获取商品信息(链接、规格、数量),然后通过浏览器自动化将其加入天猫/淘宝购物车。触发词:加购物车、Bitable商品、批量加购、采购表格。

中文简介正在准备中。当前显示原文说明。

集成工具Telegram
查看安装方法

包含的文件(2)

  • SKILL.md4.9 KB
  • scripts/index.js5.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

从 Bitable 加入购物车

从飞书多维表格读取商品信息,自动添加到淘宝/天猫购物车。

Bitable 表格要求

默认表格:https://somo-tech.feishu.cn/base/UIdIbPe2RaOQ1tsNIhlcB5ilngc

  • app_token: UIdIbPe2RaOQ1tsNIhlcB5ilngc
  • table_id: tblwMnggn0CuboHs

必需字段:

字段名类型说明
链接URL商品链接(从 field.link 取值)
采购规格Text要选择的规格文本,必须与页面上的规格选项完全匹配
数量Number购买数量

操作流程

1. 获取待处理记录

feishu_bitable_list_records(app_token, table_id, page_size=20)

筛选出有完整 链接、采购规格、数量 的记录。

2. 逐个处理商品

对每条记录执行:

2.1 提取信息

  • productUrl = record.fields.链接.link
  • productSpec = record.fields.采购规格
  • productQuantity = record.fields.数量

2.2 打开商品页面

browser.open(profile='openclaw', targetUrl=productUrl)

等待页面加载完成(约 3-5 秒)。

2.3 使用 evaluate 查找并点击规格

由于页面元素可能动态加载,直接使用 snapshot 可能无法找到。建议优先使用 evaluate 查找包含规格文本的元素并点击。

browser.act(profile='openclaw', request={
    kind: 'evaluate',
    fn: `(specText) => {
        // XPath 查找包含文本的元素
        const xpath = "//*[contains(text(), '" + specText + "')]";
        const result = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
        for (let i = 0; i < result.snapshotLength; i++) {
            const node = result.snapshotItem(i);
            // 尝试点击,如果失败则向上找 clickable 的父元素
            let target = node;
            while (target && target !== document.body) {
                // 检查常见的可点击标签或属性
                if (['A', 'BUTTON', 'LI'].includes(target.tagName) || target.getAttribute('role') === 'button' || target.className.includes('sku')) {
                    target.click();
                    return true;
                }
                target = target.parentElement;
            }
            // 实在不行点击节点本身
            node.click();
            return true;
        }
        return false;
    }`,
    args: [productSpec]
})

2.4 设置数量

同理,使用 evaluate 找到输入框并修改值:

browser.act(profile='openclaw', request={
    kind: 'evaluate',
    fn: `(qty) => {
        const inputs = document.querySelectorAll('input.text-amount, input.mui-amount-input, input[type=number]');
        for (let input of inputs) {
             // 简单的启发式规则:value 是 1 或不为空
             if (input.value) {
                input.value = qty;
                input.dispatchEvent(new Event('input', { bubbles: true }));
                input.dispatchEvent(new Event('change', { bubbles: true }));
                return true;
            }
        }
        return false;
    }`,
    args: [productQuantity]
})

2.5 点击加入购物车

找到"加入购物车"按钮并点击:

browser.act(profile='openclaw', request={
    kind: 'evaluate',
    fn: `() => {
        const buttons = document.querySelectorAll('a, button, div[role=button]');
        for (let btn of buttons) {
            const text = btn.innerText || btn.textContent;
            if (text && (text.includes('加入购物车') || text.includes('加入购物袋'))) {
                btn.click();
                return true;
            }
        }
        return false;
    }`
})

2.6 确认添加

等待 2-3 秒,检查是否出现成功提示或购物车数量变化。

3. 汇报结果

完成后通过 message 工具发送 Telegram 通知:

message(action='send', channel='telegram', to='telegram:1642489086', message='采购商品已加入购物车:\n- 商品1: ✅\n- 商品2: ✅\n...')

改进点:

  • 不再仅依赖 browser.snapshot 返回的静态文本 ref,而是利用 evaluate 在浏览器上下文中直接执行 DOM 操作,提高对动态页面和复杂结构的适应性。
  • 增加了针对规格选择、数量设置和加购按钮的具体 DOM 查找策略。

示例调用

用户说:"帮我把采购表格里的商品加入购物车"

  1. 读取 Bitable 记录
  2. 对每个有效记录执行加购流程 (优先使用 evaluate 策略)
  3. 汇报结果

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

name: 4d-compression-core version: 1.0.2 description: "把长内容压缩成结构化向量——节省 60-80% Token,保留核心信息" metadata: { "openclaw": { "emoji": "🌀", "requires": { "bins": ["jq", "awk"] }, "triggers": ["压缩", "4d",...

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

Use cheap, TEE-verified AI models from the 0G Compute Network as OpenClaw providers. Discover available models and compare pricing vs OpenRouter, verify provider integrity via hardware attestation (Intel TDX), manage your 0G wallet and sub-accounts, and configure models in OpenClaw with one workflow. Supports DeepSeek, GLM-5, Qwen, and other models available on the 0G marketplace.

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

Send and receive P2P messages using disposable numbers and PINs. No servers, no accounts. Use for human notifications, approval flows, and agent-to-agent communication.

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

0xarchive

免费

Query historical crypto market data from 0xArchive across Hyperliquid, Lighter.xyz, and HIP-3. Covers orderbooks, trades, candles, funding rates, open interest, liquidations, and data quality. Use when the user asks about crypto market data, orderbooks, trades, funding rates, or historical prices on Hyperliquid, Lighter.xyz, or HIP-3.

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

0xwork

免费

Find and complete paid tasks on the 0xWork decentralized marketplace (Base chain, USDC escrow). Use when: the agent wants to earn money/USDC by doing work, discover available tasks, claim a bounty, submit deliverables, check earnings or wallet balance, or set up as a 0xWork worker. Task categories: Writing, Research, Social, Creative, Code, Data. NOT for: posting tasks (use the website), managing the 0xWork platform, or frontend development.

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

Patterns and practices that dramatically accelerate development velocity. Covers parallel execution, automation, feedback loops, workflow optimization, and anti-pattern avoidance. Use when starting projects, planning sprints, optimizing workflows, or onboarding developers.

中文简介正在准备中。当前显示原文说明。

modbender/skill-library-mcp172026年9月28日 更新

查看 modbender 的全部技能

报告此技能的问题