Platform adapters provide a unified interface for integrating Hermes Agent with messaging platforms (Telegram, Discord, WhatsApp, Slack, Signal, Email, Home Assistant, DingTalk, Matrix, Mattermost, SMS, Webhook, API Server, Feishu, Weixin, Bluebubbles, QQBot, Yuanbao, WeCom, Teams, Google Chat, IRC, LINE, SimplexChat, Photon/iMessage). Each adapter normalizes platform-specific message formats, handles media attachments, manages authentication, and translates between standard markdown and platform-specific formatting conventions.
For information about the gateway service that orchestrates these adapters, see 7.1 Gateway Architecture For session management and routing logic, see 7.3 Session and Media Management
Platform adapters follow a common inheritance pattern where all concrete implementations extend BasePlatformAdapter gateway/platforms/base.py333-350 This abstract base class defines the contract for connecting to platforms, sending/receiving messages, and handling media.
Sources: gateway/platforms/base.py333-350 plugins/platforms/telegram/adapter.py156-168 plugins/platforms/slack/adapter.py43-60 gateway/platforms/api_server.py84-91 gateway/platforms/webhook.py147-157 gateway/platforms/weixin.py58-68 gateway/platforms/signal.py200-210 plugins/platforms/photon/adapter.py100-110 plugins/platforms/teams/adapter.py100-110 plugins/platforms/google_chat/adapter.py100-110 gateway/relay/adapter.py100-110
The BasePlatformAdapter class gateway/platforms/base.py333-904 defines the core interface that all platform adapters must implement.
| Method | Purpose | Returns |
|---|---|---|
connect() | Establish connection to platform, start receiving messages gateway/platforms/base.py352-358 | bool (success) |
disconnect() | Close connection and cleanup resources gateway/platforms/base.py360-366 | None |
send(chat_id, content, ...) | Send a text message to a chat gateway/platforms/base.py368-386 | SendResult |
get_chat_info(chat_id) | Retrieve chat metadata (name, type) gateway/platforms/base.py461-467 | Dict[str, Any] |
| Method | Default Behavior | Override Purpose |
|---|---|---|
edit_message() | Returns success=False | Platform-specific message editing gateway/platforms/base.py400-415 |
send_typing() | No-op | Show typing indicator gateway/platforms/base.py388-398 |
send_image() | Fallback to text URL | Native image attachments gateway/platforms/base.py420-435 |
format_message() | Return content as-is | Platform-specific markdown conversion gateway/platforms/base.py440-450 |
Sources: gateway/platforms/base.py352-467
Platform adapters normalize diverse message formats into a common MessageEvent structure gateway/platforms/base.py272-318
Sources: gateway/platforms/base.py272-318 plugins/platforms/telegram/adapter.py156-168 plugins/platforms/discord/adapter.py121-137 plugins/platforms/slack/adapter.py45-60
The MessageEvent dataclass gateway/platforms/base.py272-318 provides a unified representation:
message.text vs message.caption).Platform adapters download media to local cache directories to avoid ephemeral URL expiration.
| Function | Purpose | Returns |
|---|---|---|
cache_image_from_bytes | Save image bytes to cache gateway/platforms/base.py58-73 | str (absolute path) |
cache_audio_from_bytes | Save audio bytes to cache gateway/platforms/base.py160-175 | str |
cache_video_from_bytes | Save video bytes to cache gateway/platforms/base.py220-235 | str |
cache_document_from_bytes | Save document bytes to cache gateway/platforms/base.py240-255 | str |
Sources: gateway/platforms/base.py58-255
The TelegramAdapter uses python-telegram-bot plugins/platforms/telegram/adapter.py4-8
_await_with_thread_deadline to handle initialization timeouts independently of the event loop plugins/platforms/telegram/adapter.py80-97_dump_loop_blocked_diagnostics to identify synchronous blocking calls plugins/platforms/telegram/adapter.py59-79_redact_telegram_error_text to mask secrets in transport errors plugins/platforms/telegram/adapter.py28-39sendAudio (MP3/M4A) and sendVoice (Opus/OGG) based on file extension and is_voice flag gateway/platforms/base.py147-150Sources: plugins/platforms/telegram/adapter.py1-151 gateway/platforms/base.py147-150
The DiscordAdapter uses discord.py plugins/platforms/discord/adapter.py6-10
_abort_discord_websocket_transport to force-close hung aiohttp transports plugins/platforms/discord/adapter.py183-200_DISCORD_NONCONVERSATIONAL_HISTORY_MESSAGE_PATTERNS regexes to recognize status bumps from older versions plugins/platforms/discord/adapter.py79-99_read_url_image_with_redirect_guard prevents SSRF by re-checking every redirect target for image URLs plugins/platforms/discord/adapter.py141-176Sources: plugins/platforms/discord/adapter.py1-200 plugins/platforms/discord/adapter.py141-176
The SlackAdapter uses slack-bolt with Socket Mode plugins/platforms/slack/adapter.py4-9
render_blocks and sanitize_blocks for rich UI components plugins/platforms/slack/adapter.py62-65_wrap_markdown_tables and _align_table to render CJK-aware monospace tables in Slack's mrkdwn plugins/platforms/slack/adapter.py142-208_THREAD_ROOT_IMAGE_MAX) plugins/platforms/slack/adapter.py114-119ignored_channels tests/gateway/test_slack.py116-154Sources: plugins/platforms/slack/adapter.py1-208 tests/gateway/test_slack.py116-154
The APIServerAdapter gateway/platforms/api_server.py2-23 provides an OpenAI-compatible interface.
ResponseStore (SQLite-backed LRU) to maintain conversation state across stateless HTTP requests gateway/platforms/api_server.py91-132/p/<profile>/ URL prefixes for reaching secondary profiles gateway/platforms/api_server.py30-37reasoning_effort for compatible models gateway/platforms/api_server.py193-194_redact_api_error_text ensures sensitive information is removed from API error responses tests/gateway/test_api_server.py64-85Sources: gateway/platforms/api_server.py1-194 tests/gateway/test_api_server.py91-164 tests/gateway/test_api_server.py64-85
The WebhookAdapter gateway/platforms/webhook.py1-31 receives POSTs from external services.
None for DEFAULT_HOST to bind both IPv4 and IPv6 families gateway/platforms/webhook.py81-99X-Webhook-Signature-V2 which binds a timestamp into the signed data for replay protection gateway/platforms/webhook.py26-31_is_loopback_host for safety-rail purposes gateway/platforms/webhook.py115-125webhook_subscriptions.json gateway/platforms/webhook.py166-167Sources: gateway/platforms/webhook.py1-125 gateway/platforms/webhook.py166-167
The WeixinAdapter gateway/platforms/weixin.py2-11 connects to WeChat personal accounts via Tencent's iLink Bot API.
_aes128_ecb_encrypt and _pkcs7_pad for the media delivery protocol gateway/platforms/weixin.py175-183_make_ssl_connector with certifi to verify Tencent's iLink servers on platforms with outdated system CA stores gateway/platforms/weixin.py119-136_random_wechat_uin for protocol compliance gateway/platforms/weixin.py202-205Sources: gateway/platforms/weixin.py1-205
The SignalAdapter gateway/platforms/signal.py1-12 connects to a signal-cli daemon.
_remux_aac_to_m4a using ffmpeg to losslessly convert Android voice notes into compatible M4A containers for STT gateway/platforms/signal.py141-194get_scheduler and _extract_retry_after_seconds to handle Signal's backoff requirements gateway/platforms/signal.py47-57_guess_extension gateway/platforms/signal.py83-116Sources: gateway/platforms/signal.py1-194
The WhatsAppAdapter plugins/platforms/whatsapp/adapter.py integrates with WhatsApp via a local whatsapp-bridge instance.
whatsapp-bridge via HTTP requests to send and receive messages.phone@s.whatsapp.net, group@g.us) for direct targeting tools/send_message_tool.py48-52Sources: plugins/platforms/whatsapp/adapter.py tools/send_message_tool.py48-52
The FeishuAdapter plugins/platforms/feishu/adapter.py connects to Feishu (Lark) via its Open Platform APIs.
reply_to_message_id gateway/platforms/base.py126-127Sources: plugins/platforms/feishu/adapter.py gateway/platforms/base.py126-127
The QQBotAdapter gateway/platforms/qqbot/adapter.py integrates with QQBot.
Sources: gateway/platforms/qqbot/adapter.py
The PhotonAdapter plugins/platforms/photon/adapter.py provides integration with Photon, which can bridge to iMessage.
Sources: plugins/platforms/photon/adapter.py plugins/platforms/photon/sidecar/index.mjs tools/send_message_tool.py45-47
The TeamsAdapter plugins/platforms/teams/adapter.py integrates with Microsoft Teams.
Sources: plugins/platforms/teams/adapter.py
The GoogleChatAdapter plugins/platforms/google_chat/adapter.py integrates with Google Chat.
Sources: plugins/platforms/google_chat/adapter.py
The RelayAdapter gateway/relay/adapter.py and RelayConnector provide a mechanism for bridging remote gateway instances. This allows a Hermes instance in one network to act as a gateway for a remote instance, facilitating multi-hop communication or remote management. It utilizes WebSocket transports for bidirectional message passing gateway/relay/ws_transport.py
Sources: gateway/relay/adapter.py gateway/relay/ws_transport.py
Refresh this wiki
This wiki was recently refreshed. Please wait 4 days to refresh again.