# Send Add to Cart from Bitable to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "addtocartfrombitable",
    "name": "Add to Cart from Bitable",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/Lorpha/addtocartfrombitable",
    "canonicalUrl": "https://clawhub.ai/Lorpha/addtocartfrombitable",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/addtocartfrombitable",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=addtocartfrombitable",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "scripts/index.js",
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "addtocartfrombitable",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-29T01:44:42.958Z",
      "expiresAt": "2026-05-06T01:44:42.958Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=addtocartfrombitable",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=addtocartfrombitable",
        "contentDisposition": "attachment; filename=\"addtocartfrombitable-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "addtocartfrombitable"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/addtocartfrombitable"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/addtocartfrombitable",
    "downloadUrl": "https://openagent3.xyz/downloads/addtocartfrombitable",
    "agentUrl": "https://openagent3.xyz/skills/addtocartfrombitable/agent",
    "manifestUrl": "https://openagent3.xyz/skills/addtocartfrombitable/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/addtocartfrombitable/agent.md"
  }
}
```
## Documentation

### 从 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 查找策略。

### 示例调用

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

读取 Bitable 记录
对每个有效记录执行加购流程 (优先使用 evaluate 策略)
汇报结果
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: Lorpha
- Version: 1.0.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-04-29T01:44:42.958Z
- Expires at: 2026-05-06T01:44:42.958Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/addtocartfrombitable)
- [Send to Agent page](https://openagent3.xyz/skills/addtocartfrombitable/agent)
- [JSON manifest](https://openagent3.xyz/skills/addtocartfrombitable/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/addtocartfrombitable/agent.md)
- [Download page](https://openagent3.xyz/downloads/addtocartfrombitable)