












Hermes Agent (GitHub 164k stars) is not just a coding assistant in the terminal. Through its message gateway, the Agent can connect to 24 messaging platforms — Telegram, Discord, Slack, WeChat, Lark, DingTalk, Microsoft Teams, and more. The Agent capabilities (Skills, tool calls, approval processes) you configure on one platform are universal across all platforms.
This article focuses on the integration method for Microsoft Teams: 6 steps to get your AI Agent bot into Teams chats.
Teams 群聊 ←── HTTPS Webhook ──→ Hermes Gateway (端口 3978) ←──→ Agent + LLM
and Slack's Socket Mode are different; Teams pushes messages via public HTTPS Webhooks. Your Hermes instance requires a publicly reachable endpoint—use a local development tunneling tool for development and a real domain name in production.
| scenarios | behavior |
|---|---|
| Private chat (1:1) | Triggers Agent response for every message, no need for @ |
| Group chat | Responds only when @bot is mentioned |
| Channel | Responds only when @bot is mentioned |
Teams treats @mentions as <at>BotName</at> tags and passes them to Hermes, which automatically strips and processes them.
Microsoft's @microsoft/teams.cli automation bot registration does not require Azure Portal:
npm install -g @microsoft/teams.cli@preview
teams login
Verify login and obtain your AAD Object ID (needed for whitelist configuration later):
teams status --verbose
Teams cannot push messages to localhost. Local development requires a tunneling tool:
# Microsoft devtunnel(推荐,URL 持久)
devtunnel create hermes-bot --allow-anonymous
devtunnel port create hermes-bot -p 3978 --protocol https
devtunnel host hermes-bot
# 或 ngrok
ngrok http 3978
# 或 cloudflared
cloudflared tunnel --url http://localhost:3978
Note down the output.https:// URL, use next. Keep tunnel running during development.
teams app create \
--name "Hermes" \
--endpoint "https://<your-tunnel-url>/api/messages"
CLI output CLIENT_ID, CLIENT_SECRET, and TENANT_ID. Save Client Secret immediately—won't be shown again.
add to ~/.hermes/.env:
# 必填
TEAMS_CLIENT_ID=<your-client-id>
TEAMS_CLIENT_SECRET=<your-client-secret>
TEAMS_TENANT_ID=<your-tenant-id>
# 限制访问用户(强烈建议)
# 用 teams status --verbose 获取 AAD Object ID
TEAMS_ALLOWED_USERS=<your-aad-object-id>
can also use config.yaml to configure:
platforms:
teams:
enabled: true
extra:
client_id: "your-client-id"
client_secret: "your-secret"
tenant_id: "your-tenant-id"
port: 3978
HERMES_UID=$(id -u) HERMES_GID=$(id -g) docker compose up -d gateway
verify if running:
curl http://localhost:3978/health
# 应返回: ok
docker logs -f hermes
# 看到: [teams] Webhook server listening on 0.0.0.0:3978/api/messages
teams app get <teamsAppId> --install-link
Open the output link and install it in the Teams client. After installation, send a message to the bot—it's ready.
This is one of the most practical features of Teams integration. When an Agent needs to execute a dangerous command (delete files, run shell commands, etc.), it won't let you manually input /approve, but instead sends an Adaptive Card, with 4 buttons:
| Button | Action |
|---|---|
| Allow Once | Approve this specific command |
| Allow Session | Automatically Approve Similar Commands Within This Session |
| Always Allow | Permanently Approve This Mode |
| Deny | Reject Execution |
After Clicking the Button, the Card Will Be Immediately Updated to Show the Approval Decision, and the Agent Will Continue or Stop Execution.
The Hermes Agent's Teams Integration Not Only Supports Chatting but Also Automatically Pushes Meeting Minutes. After Enabling the Teams Meeting Pipeline Plugin, Minutes Are Automatically Generated and Pushed to the Specified Teams Channel or Chat After the Meeting Ends.
Two Push Modes:
| Mode | Applicable Scenarios | Limitations |
|---|---|---|
incoming_webhook |
Simple Push to Channel | Does Not Support Threads, No Reply Function |
graph |
Posting as Bot, Supports Threads | Requires Microsoft Graph Permissions |
graphMode Configuration:
platforms:
teams:
enabled: true
extra:
client_id: "..."
client_secret: "..."
tenant_id: "..."
delivery_mode: "graph"
chat_id: "19:meeting_..." # 推送到聊天
# 或
# team_id: "..."
# channel_id: "..." # 推送到频道
Local Development Use Tunnel, Production Environment Use Real Domain:
# 创建 Bot 时直接用生产域名
teams app create \
--name "Hermes" \
--endpoint "https://your-domain.com/api/messages"
# 已有 Bot 更新端点
teams app update --id <teamsAppId> --endpoint "https://your-domain.com/api/messages"
Requirements:
- Port 3978 (or TEAMS_PORT specified port) can be accessed from the public network
- TLS certificate is valid (Teams rejects self-signed certificates)
⚠️ Must set TEAMS_ALLOWED_USERS, otherwise anyone who can find or install your Bot can interact with it.
Security best practice:
TEAMS_ALLOWED_USERS Enter the AAD Object ID of authorized users, silently discard unauthorized messages TEAMS_CLIENT_SECRET Treat as a password, rotate regularly ~/.hermes/.env Set file permissions to 600: chmod 600 ~/.hermes/.env/api/messages is authenticated by Teams Bot Framework — requests without a valid JWT will be rejected | Variable | Description |
|---|---|
TEAMS_CLIENT_ID |
Azure AD App (Client) ID |
TEAMS_CLIENT_SECRET |
Azure AD Client Secret |
TEAMS_TENANT_ID |
Azure AD Tenant ID |
TEAMS_ALLOWED_USERS |
Comma-separated AAD Object ID whitelist |
TEAMS_ALLOW_ALL_USERS |
SettrueSkip whitelist (not recommended) |
TEAMS_HOME_CHANNEL |
Conversation ID for scheduled/active messages |
TEAMS_PORT |
Webhook port (default 3978) |
| Question | Solution |
|---|---|
| Health endpoint is normal but Bot is not responding | Check if the tunnel is still running, and if the Bot endpoint matches the tunnel URL |
KeyError: 'teams'Log errors |
Restart container |
| Authentication error | Verify CLIENT_ID, CLIENT_SECRET, TENANT_ID |
| Bot received message but ignored | AAD Object ID not in ALLOWED_USERS |
| Tunnel URL changes after restart | devtunnel uses named tunnel URL for persistence; ngrok free version changes each time, need to use teams app update to update |
No inference provider configured |
Check ANTHROPIC_API_KEY (or other LLM key) is configured |
Teams is just one of them. Hermes Agent also supports:
Telegram, Discord, Slack, WhatsApp, Signal, Email, SMS (Twilio), Home Assistant, Mattermost, Matrix, DingTalk, Lark, WeCom, WeCom Callback, WeChat, iMessage (BlueBubbles), QQ Bot, YuEbao, Microsoft Teams, Teams Meetings, LINE, SimpleX Chat, ntfy, Open WebUI, Webhooks.
The same Agent, a set of Skills and tool configurations, work across all platforms.
Author: itech001
Source: Official Account: AI Artificial Intelligence Era
website : https://www.theaiera.cn/
Sharing the latest AI news and research every day.
Originally published on AI Artificial Intelligence Era, attribution required when reposting.
This content is automatically aggregated by InertiaRSS (RSS Reader) for reading reference only. Original from — Copyright belongs to the original author.