Skip to main content

DingTalk Setup

Overview

DingTalk connects Anyy to DingTalk conversations through the DingTalk stream adapter. The adapter supports direct messages, group chats, lifecycle startup, and live-smoke checks.

Prerequisites

  • A DingTalk app or robot with the credentials Anyy needs.
  • client_id.
  • client_secret.
  • Optional robot or bot identifiers when your deployment needs them.
  • DingTalk permissions for receiving and sending messages in the target chats.

Setup

Create credentials

Create the DingTalk app/robot in DingTalk's developer console. Keep the client secret in Anyy secret storage.

Configure Anyy

anyy setup channels dingtalk \
--set client_id=ding-client-id \
--secret client_secret='ding-client-secret' \
--write-config

Optional fields:

channels:
dingtalk:
bot_user_id: "bot-user-id"
bot_staff_id: "bot-staff-id"
robot_code: "robot-code"

Setup defaults:

FieldDefault
account_idwork
dm_policypairing
group_policymention
send_chunk_chars3800

Start Gateway

anyy gateway start
anyy channels reload

Run doctor checks

anyy channels doctor dingtalk

Access Policy

Direct messages

The setup default is dm_policy: pairing. Use allowlist and DingTalk sender ids in allow_from for a restricted deployment.

Groups

The default group_policy: mention means group messages need to mention the bot or match configured mention patterns before Anyy answers.

Use allow_groups with group_policy: allowlist to restrict group chats.

Admins

DingTalk channel policy controls which messages enter the runtime. Command authorization is shared across messaging channels.

Sessions

Each accepted DingTalk conversation maps to an Anyy session. Duplicate message ids are filtered by the adapter.

Media Support

Inbound media

DingTalk does not advertise inbound media support in the current adapter.

Outbound media

DingTalk sends text/markdown replies. It does not advertise native outbound media.

Commands

Use the shared messaging commands. In groups, mention Anyy when group policy requires it.

Cron Delivery

anyy cron create \
--name "DingTalk standup" \
--schedule "0 9 * * *" \
--prompt "Send the standup reminder" \
--delivery-target current_user_default \
--delivery-channel dingtalk

Troubleshooting

  • Stream does not start: check client_id and client_secret_ref.
  • Group message ignored: check group_policy, mention text, and allow_groups.
  • Bot echoes itself: set the bot identifiers available for your DingTalk app.
  • Doctor passes but send fails: verify the DingTalk app has send permission in the target chat.