Coda API 技能:自动化文档与数据管理 - Openclaw Skills

作者:互联网

2026-04-15

AI快讯

什么是 Coda API 技能?

Coda API 技能旨在提供对 Coda 工作区的深度编程访问。通过利用 Coda REST API v1,此 Openclaw Skills 项目允许开发人员自动化文档的整个生命周期,从初始创建和结构设置到表格内复杂的数据操作。无论您是管理行、触发按钮还是审核公式,此技能都弥补了手动文档编辑与自动化工作流之间的鸿沟。

它以开发人员的生产力为核心,简化了与 Coda 层级数据模型的交互。它提供了一种结构化的方式来处理文档 ID、管理权限以及探索文档架构,而无需导航 Web 界面。这使其成为构建依赖 Coda 作为前端或数据库的自定义集成或数据管道的理想解决方案。

下载入口:https://github.com/openclaw/skills/tree/main/skills/0x7466/coda

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install coda

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 coda。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Coda API 技能 应用场景

  • 从标准化模板自动创建定期项目文档。
  • 使用批量更新操作在外部数据库和 Coda 表格之间同步数据。
  • 将触发 Coda 自动化和按钮作为大型 CI/CD 或 DevOps 管道的一部分。
  • 将 Coda 表格数据导出为 CSV 或 JSON,以便进行离线分析或二级备份。
  • 同时跨多个文档批量更新行状态。
Coda API 技能 工作原理
  1. 该技能使用存储在 CODA_API_TOKEN 环境变量中由用户提供的 API 令牌与 Coda 进行身份验证。
  2. 通过 Python CLI 工具发布命令,该工具将用户意图映射到特定的 Coda REST API v1 端点。
  3. 对于数据检索,该技能会自动处理分页和速率限制,确保大型文档的稳定数据流。
  4. 处理写入操作(如插入行),通常返回请求 ID 以进行异步跟踪。
  5. 内置安全机制会拦截破坏性命令,在删除文档或更改权限之前需要用户明确确认。

Coda API 技能 配置指南

要在 Openclaw Skills 生态系统中使用此技能,您必须安装 Python 3.7+ 和 requests 库。请按照以下步骤进行配置:

  1. 从 Coda 官网 https://coda.io/account 的 API 设置中获取您的 API 令牌。
  2. 配置您的环境变量:
export CODA_API_TOKEN="your_token_here"
  1. 运行 CLI 工具以验证连接性:
python scripts/coda_cli.py docs list

Coda API 技能 数据架构与分类体系

Coda API 技能根据 Coda 资源层级组织数据。输出通常以 JSON 对象或格式化表格的形式返回:

资源 关键元数据 操作
文档 文档 ID, 标题, 所有者 列出, 创建, 删除, 发布
页面 页面 ID, 名称, 父级 ID 列出, 获取结构
表格 表格 ID, 名称, 列列表 列出, 获取架构
行 ID, 列值 插入, 更新/插入, 更新, 删除
自动化 按钮 ID, 动作类型 触发/推送
公式 公式名称, 值 列出, 审核
name: coda
description: General-purpose Coda document manager via REST API v1. Supports listing/creating/updating/deleting docs, managing tables/rows/pages, triggering automations, and exploring doc structure. Requires CODA_API_TOKEN environment variable. Delete operations require explicit confirmation; publishing and permission changes require explicit user intent.

Coda API Skill

Interact with the Coda REST API v1 to manage docs, tables, rows, pages, and automations.

When to Use

Use this skill when the user wants to:

  • List, search, create, or delete Coda docs
  • Read from or write to tables (insert, upsert, update, delete rows)
  • Explore doc structure (pages, tables, columns, formulas, controls)
  • Trigger automations (push buttons)
  • Export doc content or analytics

When NOT to Use

  • Do NOT use for general document editing advice unrelated to the API
  • Do NOT use for Pack development (this skill covers Doc management, not Pack creation)
  • Do NOT use for operations requiring Doc Maker permissions unless confirmed the user has them

Prerequisites

  1. API Token: Set environment variable CODA_API_TOKEN with your Coda API token
    • Get token at: https://coda.io/account -> API Settings
  2. Python 3.7+ with requests library installed
  3. Permissions: Some operations (create doc, update doc title, create page) require Doc Maker role in the workspace

CLI Tool Usage

The skill includes a Python CLI tool at scripts/coda_cli.py:

# Setup
export CODA_API_TOKEN="your_token_here"

# List docs
python scripts/coda_cli.py docs list --query "Project"

# Get doc info
python scripts/coda_cli.py docs get 

# Create doc
python scripts/coda_cli.py docs create --title "My New Doc"

# List tables in doc
python scripts/coda_cli.py tables list 

# List rows in table
python scripts/coda_cli.py rows list  

# Insert row
python scripts/coda_cli.py rows insert   --data '{"Name": "Task 1", "Status": "Done"}'

# Update row
python scripts/coda_cli.py rows update    --data '{"Status": "In Progress"}'

# Delete row (requires confirmation)
python scripts/coda_cli.py rows delete   

# List pages
python scripts/coda_cli.py pages list 

# Trigger automation (push button)
python scripts/coda_cli.py automations trigger  

# Force delete without confirmation (use with caution)
python scripts/coda_cli.py docs delete  --force

Workflow Guidelines

1. Doc ID Extraction

Coda doc IDs can be extracted from browser URLs:

  • URL: https://coda.io/d/_dAbCDeFGH/Project-Tracker
  • Doc ID: AbCDeFGH (remove _d prefix)

The CLI tool accepts both full URLs and raw IDs.

2. Rate Limit Handling

The API has strict rate limits:

  • Read: 100 requests per 6 seconds
  • Write (POST/PUT/PATCH): 10 requests per 6 seconds
  • Write doc content: 5 requests per 10 seconds
  • List docs: 4 requests per 6 seconds

The CLI tool automatically implements exponential backoff for 429 responses.

3. Asynchronous Operations

Write operations return HTTP 202 with a requestId. The CLI tool optionally polls for completion using --wait flag.

4. Safety Guardrails

Delete Operations (rows, docs, pages, folders):

  • Always requires explicit user confirmation in interactive mode
  • Use --force flag only in automation/scripts
  • Shows preview of what will be deleted

Publishing (docs publish):

  • Requires explicit --confirm-publish flag
  • Cannot be combined with --force

Permissions (acl commands):

  • Requires explicit --confirm-permissions flag for any changes
  • Read operations (list permissions) are always allowed

Automation Triggers:

  • Allowed without special flags but logged
  • User should be aware that automations may trigger notifications or external actions

5. Pagination

List commands support:

  • --limit: Maximum results (default 25, max varies by endpoint)
  • --page-token: For fetching subsequent pages
  • CLI auto-follows pages with --all flag

Common Patterns

Batch Row Operations

# Insert multiple rows from JSON file
python scripts/coda_cli.py rows insert-batch   --file rows.json

# Upsert rows (update if exists, insert if not) using key columns
python scripts/coda_cli.py rows upsert   --file rows.json --keys "Email"

Sync Between Docs

# Export from source
python scripts/coda_cli.py rows list   --format json > export.json

# Import to destination
python scripts/coda_cli.py rows insert-batch   --file export.json

Explore Structure

# Get full doc structure
python scripts/coda_cli.py docs structure 

# List all formulas
python scripts/coda_cli.py formulas list 

# List all controls
python scripts/coda_cli.py controls list 

Error Handling

Common HTTP status codes:

  • 400: Bad request (invalid parameters)
  • 401: Invalid/expired API token
  • 403: Insufficient permissions (need Doc Maker role)
  • 404: Resource not found
  • 429: Rate limited (implement backoff)
  • 202: Accepted but not yet processed (async operation)

Security Considerations

  1. Token Storage: Never commit CODA_API_TOKEN to version control
  2. Token Scope: The token has full access to all docs the user can access
  3. Workspace Restrictions: Creating docs requires Doc Maker role in target workspace
  4. Data Exposure: Row data may contain sensitive information; handle exports carefully

Examples

List and Filter Docs

python scripts/coda_cli.py docs list --is-owner --query "Project"

Create Doc from Template

python scripts/coda_cli.py docs create --title "Q4 Planning" --source-doc "template-doc-id"

Update Row Status

python scripts/coda_cli.py rows update AbCDeFGH grid-xyz row-123 r
  --data '{"Status": "Complete", "Completed Date": "2024-01-15"}'

Delete Multiple Rows (with confirmation)

python scripts/coda_cli.py rows delete-batch AbCDeFGH grid-xyz r
  --filter '{"Status": "Archived"}' r
  --confirm "Delete all archived rows?"

Export Table to CSV

python scripts/coda_cli.py rows list AbCDeFGH grid-xyz --format csv > export.csv

Reference

  • API Documentation: https://coda.io/developers/apis/v1
  • OpenAPI Spec: https://coda.io/apis/v1/openapi.yaml
  • Rate Limits: https://coda.io/developers/apis/v1#section/Rate-Limiting

相关推荐