dingtalk_channel_connect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

钉钉 Channel 自动连接(可视浏览器)

DingTalk Channel Auto Connection (Visual Browser)

此 skill 用于通过可视浏览器自动化完成钉钉应用创建与 CoPaw channel 绑定。
This skill is used to automate the creation of DingTalk applications and binding with CoPaw channels via a visual browser.

强制规则

Mandatory Rules

  1. 必须使用可视浏览器模式启动:
json
{"action": "start", "headed": true}
  1. 遇到登录关卡必须暂停:
    • 若页面出现登录界面(如
      登录
      、扫码登录、手机号/密码登录),立即停止自动操作。
    • 明确提示用户先手动登录,再等待用户回复“登录好了/继续”。
    • 未收到用户确认前,不得继续执行后续步骤。
  2. 任何应用配置变更都必须新建版本并发布后才生效:
    • 配置完机器人相关信息后一定要发布机器人
    • 不论是新建应用还是修改应用信息(名称、描述、图标、机器人配置等),最终都必须执行“创建新版本 + 发布”
    • 若未完成发布,不得宣称配置已生效。
  1. Must start in visual browser mode:
json
{"action": "start", "headed": true}
  1. Must pause when encountering login barriers:
    • If a login interface appears on the page (such as "Login", QR code login, phone number/password login), stop automatic operations immediately.
    • Clearly prompt the user to log in manually first, then wait for the user to reply "Logged in/Continue".
    • Do not proceed with subsequent steps until receiving user confirmation.
  2. Any application configuration changes must take effect only after creating a new version and publishing it:
    • Be sure to publish the bot after configuring the bot-related information
    • Whether creating a new application or modifying application information (name, description, icon, bot configuration, etc.), you must finally execute "Create new version + Publish".
    • Do not claim that the configuration has taken effect if publishing is not completed.

执行前显著确认(必须先做)

Pre-execution Confirmation (Mandatory)

在开始自动化点击前,先向用户发起一次“配置确认”,明确告知可自定义项、图片规范、默认值。建议使用如下结构化确认:
  1. 让用户可自定义以下字段:
    • 应用名称
    • 应用描述
    • 机器人图标图片链接或本地路径
    • 机器人消息预览图链接或本地路径
  2. 明确告知图片规范(显著提示):
    • 机器人图标:仅支持 JPG/PNG,
      240*240px
      以上,
      1:1
      2MB
      以内,无圆角。
    • 机器人消息预览图:格式
      png/jpeg/jpg
      ,不超过
      2MB
  3. 明确告知默认值(用户不指定时自动采用):
    • 应用名称:
      CoPaw
    • 应用描述:
      Your personal assistant
    • 机器人图标:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • 机器人消息预览图:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
  4. 若用户未给任何自定义值,必须先明确回复:
    • “将全部采用默认设置(CoPaw / Your personal assistant / 默认图片)后继续执行。”
Before starting automated clicks, initiate a "configuration confirmation" to the user, clearly informing them of customizable items, image specifications, and default values. It is recommended to use the following structured confirmation:
  1. Allow users to customize the following fields:
    • Application name
    • Application description
    • Bot icon image link or local path
    • Bot message preview image link or local path
  2. Clearly inform of image specifications (prominent prompt):
    • Bot icon: Only JPG/PNG supported, above
      240*240px
      ,
      1:1
      aspect ratio, within
      2MB
      , no rounded corners.
    • Bot message preview image: Format
      png/jpeg/jpg
      , no larger than
      2MB
      .
  3. Clearly inform of default values (automatically adopted if user does not specify):
    • Application name:
      CoPaw
    • Application description:
      Your personal assistant
    • Bot icon:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • Bot message preview image:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
  4. If the user does not provide any custom values, must clearly reply:
    • "Will continue with all default settings (CoPaw / Your personal assistant / default images)."

图片上传策略(link/path 都支持)

Image Upload Strategy (Both link/path Supported)

  1. 若用户提供本地路径,直接用于上传。
  2. 若用户提供图片 link,先下载到本地临时文件,再执行上传。
  3. 上传动作顺序必须是:
    • 先点击页面上传入口(触发 chooser)
    • 再调用
      file_upload
      传入本地路径数组(
      paths_json
  4. 若上传报错且判断为图片规格不符合(尺寸、比例、大小、格式):
    • 立即暂停自动化
    • 明确让用户手动上传符合规范的图片
    • 用户确认“已上传/继续”后,从当前步骤继续后续流程
  1. If the user provides a local path, use it directly for upload.
  2. If the user provides an image link, first download it to a local temporary file, then perform the upload.
  3. The upload action sequence must be:
    • First click the page upload entry (trigger chooser)
    • Then call
      file_upload
      with the local path array (
      paths_json
      )
  4. If upload fails and it is judged to be due to non-compliant image specifications (size, aspect ratio, file size, format):
    • Immediately pause automation
    • Clearly ask the user to manually upload a compliant image
    • After the user confirms "Uploaded/Continue", resume the process from the current step

上传动作实战经验

Practical Experience with Upload Actions

  1. file_upload
    paths_json
    必须是“JSON 字符串数组”,注意转义:
json
{
  "action": "file_upload",
  "paths_json": "[\"xxx.png\"]",
  "frame_selector": "iframe[src*=\"/fe/app?isHideOuterFrame=true\"]"
}
  1. 若页面在 iframe 内,建议优先带上
    frame_selector
    ,否则可能出现找不到上传控件或 chooser 未触发。
  2. 上传前必须先点击上传入口;若直接
    file_upload
    会报:
    • No chooser. Click upload then file_upload.
  3. 机器人图标区域的常见结构特征可用于定位(示例):
    • text: "* 机器人图标"
    • button: "使用应用图标"
    • button: "avatar"
      (通常内部有
      img "avatar"
  4. 当 snapshot 中同时出现“使用应用图标”和“avatar”时,优先点击
    avatar
    按钮触发上传,再执行
    file_upload
  1. The
    paths_json
    of
    file_upload
    must be a "JSON string array", note the escaping:
json
{
  "action": "file_upload",
  "paths_json": "[\"xxx.png\"]",
  "frame_selector": "iframe[src*=\"/fe/app?isHideOuterFrame=true\"]"
}
  1. If the page is within an iframe, it is recommended to include
    frame_selector
    first, otherwise the upload control may not be found or the chooser may not be triggered.
  2. Must click the upload entry before uploading; if directly using
    file_upload
    , the following error will be reported:
    • No chooser. Click upload then file_upload.
  3. Common structural features of the bot icon area can be used for positioning (example):
    • text: "* Bot Icon"
    • button: "Use Application Icon"
    • button: "avatar"
      (usually contains
      img "avatar"
      internally)
  4. When both "Use Application Icon" and "avatar" appear in the snapshot, prioritize clicking the
    avatar
    button to trigger upload, then execute
    file_upload
    .

自动化流程

Automation Workflow

步骤 1:打开钉钉开发者后台

Step 1: Open DingTalk Developer Backend

  1. 可视模式启动浏览器(
    headed: true
  2. 打开
    https://open-dev.dingtalk.com/
  3. 调用
    snapshot
    判断是否需要登录
若需要登录,使用如下话术暂停:
检测到需要登录钉钉开发者后台。我已暂停自动操作,请先在弹出的浏览器中完成登录。完成后回复“继续”,我再从当前页面接着执行。
  1. Start the browser in visual mode (
    headed: true
    )
  2. Open
    https://open-dev.dingtalk.com/
  3. Call
    snapshot
    to determine if login is required
If login is required, pause with the following message:
Detected that login to DingTalk Developer Backend is required. I have paused automatic operations. Please complete login in the popped-up browser first. Reply "Continue" after completion, and I will proceed from the current page.

步骤 2:创建企业内部应用

Step 2: Create Internal Enterprise Application

用户确认登录后继续:
  1. 进入创建路径:
    • 应用开发 -> 企业内部应用 -> 钉钉应用 -> 创建应用
  2. 填写应用信息(优先使用用户自定义,否则使用默认值):
    • 应用名称:默认
      CoPaw
    • 应用描述:默认
      Your personal assistant
  3. 保存并创建应用
若页面文案或结构与预期不一致,重新
snapshot
,按可见文本语义重新定位元素。
Continue after user confirms login:
  1. Enter the creation path:
    • Application Development -> Internal Enterprise Applications -> DingTalk Applications -> Create Application
  2. Fill in application information (prioritize user-defined values, otherwise use defaults):
    • Application name: Default
      CoPaw
    • Application description: Default
      Your personal assistant
  3. Save and create the application
If the page copy or structure is inconsistent with expectations, re-call
snapshot
and re-locate elements based on visible text semantics.

步骤 3:添加机器人能力并发布

Step 3: Add Bot Capabilities and Publish

  1. 点击应用能力中的添加应用能力,找到机器人并添加
  2. 机器人配置右侧的switch按钮切换为打开
  3. 填写机器人名称机器人简介机器人描述
  4. 上传机器人图标(用户自定义或默认图):
    • 点击机器人图标下面的图片
    • 默认图链接:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • 若为 link,先下载到本地再上传
    • 若提示图片不合规,暂停并让用户手动上传合规图片后继续
  5. 上传机器人消息预览图(用户自定义或默认图):
    • 点击机器人消息预览图下面的图片
    • 默认图链接:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • 若为 link,先下载到本地再上传
    • 若提示图片不合规,暂停并让用户手动上传合规图片后继续
  6. 确认消息接收模式设置为
    Stream 模式
  7. 选择发布,此时会有进一步弹出的确认页面,选择发布。注意:一定要发布机器人之后再进行下一步
  1. Click Add Application Capabilities in Application Capabilities, find Bot and add it
  2. Toggle the switch button on the right of Bot Configuration to on
  3. Fill in Bot Name, Bot Introduction and Bot Description
  4. Upload Bot Icon (user-defined or default image):
    • Click the image below the bot icon
    • Default image link:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • If it is a link, download to local first then upload
    • If prompted with non-compliant image, pause and ask user to manually upload a compliant image before continuing
  5. Upload Bot Message Preview Image (user-defined or default image):
    • Click the image below the bot message preview image
    • Default image link:
      https://img.alicdn.com/imgextra/i4/O1CN01M0iyHF1FVNzM9qjC0_!!6000000000492-2-tps-254-254.png
    • If it is a link, download to local first then upload
    • If prompted with non-compliant image, pause and ask user to manually upload a compliant image before continuing
  6. Confirm that the message receiving mode is set to
    Stream mode
  7. Select Publish, a further confirmation page will pop up, select Publish. Note: Be sure to publish the bot before proceeding to the next step

步骤 4:创建版本并发布

Step 4: Create and Publish Version

  1. 打开
    应用发布 -> 版本管理与发布
  2. 创建新版本(每次配置变更后都要创建)
  3. 填写版本描述,应用可见范围选择全部员工
  4. 按页面提示完成发布,此时会有新的弹窗出现,选择确认发布
  5. 只有看到发布成功状态,才可继续执行后续步骤/给用户“已生效”结论
  1. Open
    Application Release -> Version Management and Release
  2. Create a new version (must be created after each configuration change)
  3. Fill in the version description, select all employees for application visibility scope
  4. Complete the release as prompted by the page, a new pop-up will appear, select Confirm Publish
  5. Only proceed to subsequent steps/give the user the "effective" conclusion after seeing the release success status

步骤 5:获取凭证

Step 5: Obtain Credentials

  1. 打开
    基础信息 -> 凭证与基础信息
  2. 告知用户
    Client ID
    (AppKey)和
    Client Secret
    (AppSecret)在该页面上。不主动进行修改,引导用户自行绑定
  1. Open
    Basic Information -> Credentials and Basic Information
  2. Inform the user that
    Client ID
    (AppKey) and
    Client Secret
    (AppSecret) are on this page. Do not modify them actively, guide the user to bind them on their own

CoPaw 绑定方式

CoPaw Binding Methods

拿到凭证后,引导用户选择以下任一方式:
  1. 控制台前端配置:
    • CoPaw console 中进入
      控制 -> 频道 -> DingTalk
    • 填入
      Client ID
      Client Secret
  2. 配置文件方式:
json
"dingtalk": {
  "enabled": true,
  "bot_prefix": "[BOT]",
  "client_id": "你的 Client ID",
  "client_secret": "你的 Client Secret"
}
路径:
~/.copaw/config.json
,位于
channels.dingtalk
下。
After obtaining the credentials, guide the user to choose one of the following methods:
  1. Console front-end configuration:
    • Enter
      Control -> Channels -> DingTalk
      in CoPaw console
    • Fill in
      Client ID
      and
      Client Secret
  2. Configuration file method:
json
"dingtalk": {
  "enabled": true,
  "bot_prefix": "[BOT]",
  "client_id": "Your Client ID",
  "client_secret": "Your Client Secret"
}
Path:
~/.copaw/config.json
, under
channels.dingtalk
.

凭证交付要求(强制)

Credential Delivery Requirements (Mandatory)

  1. agent 只负责引导用户进入凭证页、获取并展示
    Client ID
    与真实
    Client Secret
  2. agent 不主动改
    console
    配置、不主动改
    ~/.copaw/config.json
  3. 必须提示用户按以下两种方式之一手动填写:
    • 控制台前端:
      控制 -> 频道 -> DingTalk
    • 配置文件:编辑
      ~/.copaw/config.json
      channels.dingtalk
      字段
  1. The agent is only responsible for guiding the user to the credential page, obtaining and displaying
    Client ID
    and the real
    Client Secret
    .
  2. The agent shall not modify the
    console
    configuration or
    ~/.copaw/config.json
    actively.
  3. Must prompt the user to fill in manually in one of the following two ways:
    • Console front-end:
      Control -> Channels -> DingTalk
    • Configuration file: Edit the
      channels.dingtalk
      field in
      ~/.copaw/config.json

Browser 工具调用模式

Browser Tool Calling Mode

默认按以下顺序执行:
  1. start
    with
    headed: true
  2. open
  3. snapshot
  4. click
    /
    type
    /
    select_option
    /
    press_key
    as needed
  5. frequent
    snapshot
    after page transitions
  6. stop
    when done
Execute in the following order by default:
  1. start
    with
    headed: true
  2. open
  3. snapshot
  4. click
    /
    type
    /
    select_option
    /
    press_key
    as needed
  5. frequent
    snapshot
    after page transitions
  6. stop
    when done

稳定性与恢复策略

Stability and Recovery Strategy

  • 优先使用最新
    snapshot
    ref
    ;仅在必要时使用
    selector
  • 每次关键点击或跳转后,使用短等待(
    wait_for
    )并立即重新
    snapshot
  • 若中途会话失效或要求重新登录,必须再次暂停,待用户登录后从当前步骤继续。
  • 若因租户权限、管理员审批等阻塞自动化,明确说明卡点,并请用户手动完成该步骤后再续跑。
  • Prioritize using the
    ref
    from the latest
    snapshot
    ; use
    selector
    only when necessary.
  • After each critical click or jump, use a short wait (
    wait_for
    ) and immediately re-call
    snapshot
    .
  • If the session expires or re-login is required midway, must pause again, and resume from the current step after the user logs in.
  • If automation is blocked due to tenant permissions, administrator approval, etc., clearly explain the bottleneck, and ask the user to complete the step manually before resuming.