dingtalk-bridge
Claude CodeからDingTalkのグループチャットへMarkdown形式などでメッセージを送信したり、@メンションを受け取って自動実行したり、24時間稼働のStreamボットを構築したりできるDingTalk連携を円滑にするSkill。
📜 元の英語説明(参考)
DingTalk group chat bridge for Claude Code. Send markdown/text messages to DingTalk groups, receive @mentions and auto-execute via Claude CLI, run a 24/7 Stream bot. Triggers: dingtalk, send dingtalk, dingtalk bot, dingtalk message, send group message, 钉钉, 发群消息, 钉钉机器人
🇯🇵 日本人クリエイター向け解説
Claude CodeからDingTalkのグループチャットへMarkdown形式などでメッセージを送信したり、@メンションを受け取って自動実行したり、24時間稼働のStreamボットを構築したりできるDingTalk連携を円滑にするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o dingtalk-bridge.zip https://jpskill.com/download/19651.zip && unzip -o dingtalk-bridge.zip && rm dingtalk-bridge.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19651.zip -OutFile "$d\dingtalk-bridge.zip"; Expand-Archive "$d\dingtalk-bridge.zip" -DestinationPath $d -Force; ri "$d\dingtalk-bridge.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
dingtalk-bridge.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
dingtalk-bridgeフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 4
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
DingTalk Bridge Skill
Claude CodeとDingTalkグループチャットをDingTalk Stream SDK + OpenAPI経由で連携させます。
機能
| 機能 | 説明 |
|---|---|
| Markdownを送信 | リッチなMarkdownメッセージをDingTalkグループに送信します |
| テキストを送信 | プレーンテキストメッセージを送信します |
| ストリームボット | 24時間365日稼働するリスナー: @メンションを受信し、claude -pで実行し、結果を返信します |
| 会話の自動検出 | 最初の@メンション時に会話IDを自動保存します |
| キープアライブ | 20秒ごとのWebSocket pingでDingTalkの30分タイムアウトを防ぎます |
| クラッシュリカバリ | 切断時に指数関数的バックオフ(5秒から60秒)で再接続を試みます |
クイックスタート
1. インストール
bash "$CLAUDE_SKILL_DIR/scripts/install.sh"
このスクリプトは以下の処理を行います。
- Pythonの依存関係(
dingtalk_stream、websockets)をインストールします - DingTalkのApp KeyとSecretの入力を求めます(または環境変数から読み取ります)
config.jsonを生成します- 会話の状態を保存するための
data/ディレクトリを作成します - オプションで、24時間365日稼働のためのmacOS LaunchAgentを作成します
2. 設定
環境変数で認証情報を設定することをお勧めします。
export DINGTALK_APP_KEY="your_app_key"
export DINGTALK_APP_SECRET="your_app_secret"
export DINGTALK_WORKDIR="/path/to/your/project" # オプション
または、スキルディレクトリ内のconfig.jsonを編集してください(config.example.jsonを参照)。
3. 会話IDの取得
ボットがメッセージを送信するには会話IDが必要です。2つの方法があります。
自動(推奨): ストリームボットを起動し、DingTalkグループでボットを@メンションします。会話IDは自動的に保存されます。
手動: 既にopenConversationIdとrobotCodeをお持ちの場合:
mkdir -p "$CLAUDE_SKILL_DIR/data"
echo '{"openConversationId":"YOUR_ID","robotCode":"YOUR_ROBOT_CODE"}' > "$CLAUDE_SKILL_DIR/data/conv.json"
コマンド
メッセージの送信
# Markdown (デフォルト)
python3 "$CLAUDE_SKILL_DIR/src/send.py" "**Bold** message with markdown"
# カスタムタイトル付き
python3 "$CLAUDE_SKILL_DIR/src/send.py" --title "Alert" "Server is down!"
# プレーンテキスト
python3 "$CLAUDE_SKILL_DIR/src/send.py" --text "Plain text message"
ストリームボットの起動
python3 "$CLAUDE_SKILL_DIR/src/stream_bot.py"
このボットは以下の処理を行います。
- ストリームプロトコルを介してDingTalkに接続します
- ボットが追加されているグループ内のすべての@メンションをリッスンします
- メッセージの内容を
claude -p "<message>" --continueで実行します - 結果をMarkdownメッセージとして返信します
Pythonモジュールとしての使用
import sys
sys.path.insert(0, "/path/to/dingtalk-bridge/src")
from send import send_markdown, send_text
send_markdown("Daily Report", "**Sent:** 50\n**Opened:** 18\n**Clicked:** 7")
send_text("Simple notification")
設定リファレンス
| 設定キー | 環境変数 | デフォルト | 説明 |
|---|---|---|---|
app_key |
DINGTALK_APP_KEY |
(必須) | DingTalk App Key |
app_secret |
DINGTALK_APP_SECRET |
(必須) | DingTalk App Secret |
conv_file |
DINGTALK_CONV_FILE |
<skill>/data/conv.json |
会話メタデータへのパス |
workdir |
DINGTALK_WORKDIR |
cwd | claude CLIの作業ディレクトリ |
claude_bin |
DINGTALK_CLAUDE_BIN |
claude |
claudeバイナリへのパス |
max_reply |
DINGTALK_MAX_REPLY |
3000 |
返信の最大長(文字数) |
keepalive |
DINGTALK_KEEPALIVE |
20 |
WebSocketキープアライブ間隔(秒) |
DingTalkアプリのセットアップ(前提条件)
- DingTalk Open Platformにアクセスします
- 企業内部アプリ(企业内部应用)を作成します
- ロボット機能(机器人)を有効にします
- メッセージ受信モードをストリーム(Stream 模式)に設定します
- App KeyとApp Secretをコピーします
- ボットをグループチャットに追加します
テストの実行
python3 "$CLAUDE_SKILL_DIR/tests/test_dingtalk.py"
アーキテクチャ
dingtalk-bridge/
├── SKILL.md # このファイル
├── config.example.json # 設定例
├── config.json # あなたの設定 (gitignored)
├── data/
│ └── conv.json # 自動保存された会話メタデータ
├── src/
│ ├── __init__.py
│ ├── config.py # 設定ローダー (環境変数 > ファイル > デフォルト)
│ ├── send.py # メッセージ送信 (OpenAPI)
│ └── stream_bot.py # ストリームボット (受信 + 実行 + 返信)
├── scripts/
│ └── install.sh # ワンコマンドセットアップ
└── tests/
└── test_dingtalk.py # 回帰テスト 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
DingTalk Bridge Skill
Bridges Claude Code with DingTalk group chat via the DingTalk Stream SDK + OpenAPI.
Capabilities
| Feature | Description |
|---|---|
| Send Markdown | Send rich markdown messages to a DingTalk group |
| Send Text | Send plain text messages |
| Stream Bot | 24/7 listener: receive @mentions, execute via claude -p, reply with results |
| Auto Conv Discovery | Conversation ID auto-saved on first @mention |
| Keepalive | 20s WebSocket ping prevents DingTalk 30-min timeout |
| Crash Recovery | Exponential backoff (5s to 60s) on disconnect |
Quick Start
1. Install
bash "$CLAUDE_SKILL_DIR/scripts/install.sh"
The script will:
- Install Python dependencies (
dingtalk_stream,websockets) - Prompt for your DingTalk App Key & Secret (or read from env)
- Generate
config.json - Create
data/directory for conversation state - Optionally create a macOS LaunchAgent for 24/7 operation
2. Configure
Set credentials via environment variables (recommended):
export DINGTALK_APP_KEY="your_app_key"
export DINGTALK_APP_SECRET="your_app_secret"
export DINGTALK_WORKDIR="/path/to/your/project" # optional
Or edit config.json in the skill directory (see config.example.json).
3. Get Conversation ID
The bot needs a conversation ID to send messages. Two ways:
Auto (recommended): Start the Stream bot, then @mention it in a DingTalk group. The conv ID is saved automatically.
Manual: If you already have the openConversationId and robotCode:
mkdir -p "$CLAUDE_SKILL_DIR/data"
echo '{"openConversationId":"YOUR_ID","robotCode":"YOUR_ROBOT_CODE"}' > "$CLAUDE_SKILL_DIR/data/conv.json"
Commands
Send a message
# Markdown (default)
python3 "$CLAUDE_SKILL_DIR/src/send.py" "**Bold** message with markdown"
# With custom title
python3 "$CLAUDE_SKILL_DIR/src/send.py" --title "Alert" "Server is down!"
# Plain text
python3 "$CLAUDE_SKILL_DIR/src/send.py" --text "Plain text message"
Start the Stream Bot
python3 "$CLAUDE_SKILL_DIR/src/stream_bot.py"
The bot will:
- Connect to DingTalk via Stream protocol
- Listen for all @mentions in groups where the bot is added
- Execute the message content via
claude -p "<message>" --continue - Reply with the result as a markdown message
Use as Python module
import sys
sys.path.insert(0, "/path/to/dingtalk-bridge/src")
from send import send_markdown, send_text
send_markdown("Daily Report", "**Sent:** 50\n**Opened:** 18\n**Clicked:** 7")
send_text("Simple notification")
Configuration Reference
| Config Key | Env Var | Default | Description |
|---|---|---|---|
app_key |
DINGTALK_APP_KEY |
(required) | DingTalk App Key |
app_secret |
DINGTALK_APP_SECRET |
(required) | DingTalk App Secret |
conv_file |
DINGTALK_CONV_FILE |
<skill>/data/conv.json |
Conversation metadata path |
workdir |
DINGTALK_WORKDIR |
cwd | Working directory for claude CLI |
claude_bin |
DINGTALK_CLAUDE_BIN |
claude |
Path to claude binary |
max_reply |
DINGTALK_MAX_REPLY |
3000 |
Max reply length (chars) |
keepalive |
DINGTALK_KEEPALIVE |
20 |
WebSocket keepalive interval (seconds) |
DingTalk App Setup (Prerequisites)
- Go to DingTalk Open Platform
- Create an Enterprise Internal App (企业内部应用)
- Enable Robot capability (机器人)
- Set message receive mode to Stream (Stream 模式)
- Copy the App Key and App Secret
- Add the bot to a group chat
Running Tests
python3 "$CLAUDE_SKILL_DIR/tests/test_dingtalk.py"
Architecture
dingtalk-bridge/
├── SKILL.md # This file
├── config.example.json # Example configuration
├── config.json # Your config (gitignored)
├── data/
│ └── conv.json # Auto-saved conversation metadata
├── src/
│ ├── __init__.py
│ ├── config.py # Config loader (env > file > defaults)
│ ├── send.py # Send messages (OpenAPI)
│ └── stream_bot.py # Stream bot (receive + execute + reply)
├── scripts/
│ └── install.sh # One-command setup
└── tests/
└── test_dingtalk.py # Regression tests 同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (4,758 bytes)
- 📎 LICENSE (1,064 bytes)
- 📎 README.md (9,755 bytes)
- 📎 scripts/install.sh (3,494 bytes)