From d83efbb5bcdba6baf04c7ded4f8ad6efc6f92e08 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 17 Mar 2026 03:19:45 -0700 Subject: [PATCH] feat(gateway): wire DingTalk into gateway setup and platform maps (#1690) Add DingTalk to: - hermes_cli/gateway.py: _PLATFORMS list with setup instructions, AppKey/AppSecret prompts, and Stream Mode setup guide - gateway/run.py: all platform-to-config-key maps, allowed users map, allow-all-users map, and toolset resolution maps --- gateway/run.py | 6 ++++++ hermes_cli/gateway.py | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/gateway/run.py b/gateway/run.py index b5fc8ee80..3791dd6b3 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1194,6 +1194,7 @@ class GatewayRunner: Platform.SMS: "SMS_ALLOWED_USERS", Platform.MATTERMOST: "MATTERMOST_ALLOWED_USERS", Platform.MATRIX: "MATRIX_ALLOWED_USERS", + Platform.DINGTALK: "DINGTALK_ALLOWED_USERS", } platform_allow_all_map = { Platform.TELEGRAM: "TELEGRAM_ALLOW_ALL_USERS", @@ -1205,6 +1206,7 @@ class GatewayRunner: Platform.SMS: "SMS_ALLOW_ALL_USERS", Platform.MATTERMOST: "MATTERMOST_ALLOW_ALL_USERS", Platform.MATRIX: "MATRIX_ALLOW_ALL_USERS", + Platform.DINGTALK: "DINGTALK_ALLOW_ALL_USERS", } # Per-platform allow-all flag (e.g., DISCORD_ALLOW_ALL_USERS=true) @@ -3064,6 +3066,7 @@ class GatewayRunner: Platform.SIGNAL: "hermes-signal", Platform.HOMEASSISTANT: "hermes-homeassistant", Platform.EMAIL: "hermes-email", + Platform.DINGTALK: "hermes-dingtalk", } platform_toolsets_config = {} try: @@ -3085,6 +3088,7 @@ class GatewayRunner: Platform.SIGNAL: "signal", Platform.HOMEASSISTANT: "homeassistant", Platform.EMAIL: "email", + Platform.DINGTALK: "dingtalk", }.get(source.platform, "telegram") config_toolsets = platform_toolsets_config.get(platform_config_key) @@ -4082,6 +4086,7 @@ class GatewayRunner: Platform.SIGNAL: "hermes-signal", Platform.HOMEASSISTANT: "hermes-homeassistant", Platform.EMAIL: "hermes-email", + Platform.DINGTALK: "hermes-dingtalk", } # Try to load platform_toolsets from config @@ -4106,6 +4111,7 @@ class GatewayRunner: Platform.SIGNAL: "signal", Platform.HOMEASSISTANT: "homeassistant", Platform.EMAIL: "email", + Platform.DINGTALK: "dingtalk", }.get(source.platform, "telegram") # Use config override if present (list of toolsets), otherwise hardcoded default diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index d1106ae67..138eeb25d 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -1124,6 +1124,24 @@ _PLATFORMS = [ "help": "Phone number to deliver cron job results and notifications to."}, ], }, + { + "key": "dingtalk", + "label": "DingTalk", + "emoji": "💬", + "token_var": "DINGTALK_CLIENT_ID", + "setup_instructions": [ + "1. Go to https://open-dev.dingtalk.com → Create Application", + "2. Under 'Credentials', copy the AppKey (Client ID) and AppSecret (Client Secret)", + "3. Enable 'Stream Mode' under the bot settings", + "4. Add the bot to a group chat or message it directly", + ], + "vars": [ + {"name": "DINGTALK_CLIENT_ID", "prompt": "AppKey (Client ID)", "password": False, + "help": "The AppKey from your DingTalk application credentials."}, + {"name": "DINGTALK_CLIENT_SECRET", "prompt": "AppSecret (Client Secret)", "password": True, + "help": "The AppSecret from your DingTalk application credentials."}, + ], + }, ]