Skip to content

feat(channels): add DingTalk Stream mode adapter#353

Open
tuzkier wants to merge 1 commit intoRightNow-AI:mainfrom
tuzkier:feat/dingtalk-stream
Open

feat(channels): add DingTalk Stream mode adapter#353
tuzkier wants to merge 1 commit intoRightNow-AI:mainfrom
tuzkier:feat/dingtalk-stream

Conversation

@tuzkier
Copy link

@tuzkier tuzkier commented Mar 6, 2026

Summary

Adds a WebSocket-based DingTalk Stream channel adapter as an alternative to the existing webhook-based DingTalk adapter.

DingTalk Stream Mode uses a long-lived WebSocket connection to the DingTalk Gateway, eliminating the need for a public webhook endpoint.

Changes

  • openfang-types: add DingTalkStreamConfig struct and wire into ChannelsConfig alongside the existing DingTalkConfig
  • openfang-channels: implement DingTalkStreamAdapter — WebSocket connection management, auto-reconnect with exponential backoff, ping/pong keepalive, access token refresh, outbound via batchSend API
  • openfang-api: register dingtalk_stream in the channel registry, is_channel_configured, and channel_config_values; wire adapter startup in channel_bridge.rs
  • openfang-cli: add dingtalk_stream entry to the TUI channels list

Configuration

[channels.dingtalk_stream]
app_key_env = "DINGTALK_APP_KEY"       # Enterprise Internal App Key
app_secret_env = "DINGTALK_APP_SECRET" # Enterprise Internal App Secret
robot_code_env = "DINGTALK_ROBOT_CODE" # optional, defaults to app_key

Requires an Enterprise Internal App in the DingTalk Open Platform with Stream Mode enabled. No public endpoint or webhook URL needed.

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

Notes

  • The existing [channels.dingtalk] webhook adapter is unchanged
  • Both adapters can coexist
  • Includes unit tests for adapter creation and backoff behavior

Adds a WebSocket-based DingTalk Stream channel adapter as an alternative
to the existing webhook-based DingTalk adapter.

DingTalk Stream Mode uses a long-lived WebSocket connection to the
DingTalk Gateway, eliminating the need for a public webhook endpoint.

Changes:
- `openfang-types`: add `DingTalkStreamConfig` struct and wire into
  `ChannelsConfig` alongside the existing `DingTalkConfig`
- `openfang-channels`: implement `DingTalkStreamAdapter` (WebSocket
  connection management, ping/pong, token refresh, send via batchSend API)
- `openfang-api`: register `dingtalk_stream` in the channel registry,
  `is_channel_configured`, and `channel_config_values`
- `openfang-api`: wire adapter startup in `channel_bridge.rs`
- `openfang-cli`: add `dingtalk_stream` entry to the TUI channels list

Configuration:
```toml
[channels.dingtalk_stream]
app_key_env = "DINGTALK_APP_KEY"      # Enterprise Internal App Key
app_secret_env = "DINGTALK_APP_SECRET" # Enterprise Internal App Secret
robot_code_env = "DINGTALK_ROBOT_CODE" # optional, defaults to app_key
```

Requires an Enterprise Internal App in the DingTalk Open Platform with
Stream Mode enabled. No public endpoint needed.

Made-with: Cursor
@GodGavin
Copy link

that is what i want,than u.hope it can be mergered soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

under-review PR is under review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants