SuperAPI AI Directory

dingtalk-ai-table

Office & productivity

View repository

Updated 10-15 14:39

About this skill

DingTalk AI Table skill

Responsible for all operations of DingTalk AI Table (.able format multi-dimensional tables). This document is thestrategy guide, containing only decision logic and workflows. For the complete API request format, see "references/api.md lookup index" at the end of the document.

Core concepts

  • AI Table(.able file): multi-dimensional table, using the Notable API (/v1.0/notable),nota regular spreadsheet
  • base_id: the nodeId of the AI Table file, extracted from the share link https://alidocs.dingtalk.com/i/nodes/<base_id> extraction
  • Worksheet (Sheet): a single table within the table, containing fields and records
  • Field: column definition, with a name and type (text、number、date)
  • Record: data row; infields , usefield name(not ID) as the key
  • operatorId: the unionId parameter required by all APIs, automatically converted via dt_helper.sh --to-unionid automatically converted

Workflow (before each execution)

  1. First identify the task type for this run → for example: list worksheets, create field, query records, update record, delete record
  2. Validate the required configuration for this task → via bash scripts/dt_helper.sh --get KEY read; validate only what is required for this task
  3. Collect only the missing configuration → if something is missing,ask the user at onceall missing values, use bash scripts/dt_helper.sh --set KEY=VALUE write
  4. Get Token / operatorId → directly call bash scripts/dt_helper.sh, no need to care about token retrieval and caching details
  5. Execute the operation → for any command containing variable substitution, pipes, or multi-line logic, write it to /tmp/<task>.sh then bash /tmp/<task>.sh execute. Do not paste multi-line commands directly into the terminal (the terminal tool will truncate them), and do not use <<'EOF' syntax (heredoc will likewise be truncated in the tool, causing variables to be lost)

Validate configuration per task (must be done first)

  • Required for all tasks:DINGTALK_APP_KEY、DINGTALK_APP_SECRET、DINGTALK_MY_USER_ID
  • Involving any AI Table API call: must have DINGTALK_MY_OPERATOR_ID(if missing, first use bash scripts/dt_helper.sh --to-unionid automatically convert and write back)
  • Worksheet/field/record-related operations: must have DINGTALK_AI_TABLE_BASE_ID(if missing, ask the user to provide the AI Table link and extract /nodes/<base_id>)

Rule: before passing "configuration validation for this task", do not proceed to the API call step.

Credentials must not be printed in full in the output; when confirming, show only the first 4 characters + ****

Required configuration

Configuration key Required Description How to obtain
DINGTALK_APP_KEY ✅ App AppKey DingTalk Open Platform → App Management → Credential Information
DINGTALK_APP_SECRET ✅ App AppSecret Same as above
DINGTALK_MY_USER_ID ✅ The current user's enterprise employee ID (userId) Admin console → Contacts → Member management → Click the name to view
DINGTALK_MY_OPERATOR_ID ✅ The current user's unionId (operatorId) First time, automatically converted and written by bash scripts/dt_helper.sh --to-unionid Auto-convert and write in
DINGTALK_AI_TABLE_BASE_ID ✅ The AI table's nodeId Extracted from the AI table share link /nodes/<id> Extract

Identity identifier description

Identifier Description
userId(= staffId) Enterprise internal employee ID, which can be viewed via Admin console -> Contacts -> Member management -> Click the name
unionId Cross-enterprise/cross-application unique identifier, which can be obtained via bash scripts/dt_helper.sh --to-unionid <userid> Obtain

Execute script template

#!/bin/bash
set -e
HELPER="./scripts/dt_helper.sh"
NEW_TOKEN=$(bash "$HELPER" --token)
OPERATOR_ID=$(bash "$HELPER" --get DINGTALK_MY_OPERATOR_ID)
BASE_ID=$(bash "$HELPER" --get DINGTALK_AI_TABLE_BASE_ID)

# 在此追加具体 API 调用,例如列出工作表:
SHEETS=$(curl -s -X GET "https://api.dingtalk.com/v1.0/notable/bases/${BASE_ID}/sheets?operatorId=${OPERATOR_ID}" \
  -H "x-acs-dingtalk-access-token: $NEW_TOKEN")
echo "工作表列表: $SHEETS"

Token expiration handling: dt_helper only caches by time and cannot detect if a token is revoked early. If the API returns 401 (invalid/expired token), use --nocache to skip the cache and force re-acquisition:

NEW_TOKEN=$(bash "$HELPER" --token --nocache)

references/api.md lookup index

After determining what to do, use the following command to extract the complete API details of the corresponding section from references/api.md (request format, parameter descriptions, return value examples):

grep -A 20 "^## 1. 列出工作表" references/api.md
grep -A 15 "^## 2. 查询单个工作表" references/api.md
grep -A 30 "^## 3. 创建工作表" references/api.md
grep -A 15 "^## 4. 删除工作表" references/api.md
grep -A 25 "^## 5. 列出字段" references/api.md
grep -A 28 "^## 6. 创建字段" references/api.md
grep -A 15 "^## 7. 更新字段" references/api.md
grep -A 15 "^## 8. 删除字段" references/api.md
grep -A 25 "^## 9. 新增记录" references/api.md
grep -A 40 "^## 10. 查询记录列表" references/api.md
grep -A 18 "^## 11. 更新记录" references/api.md
grep -A 15 "^## 12. 删除记录" references/api.md
grep -A 10 "^## 错误码" references/api.md
grep -A 6  "^## 所需应用权限" references/api.md