要把 OpenClaw 接到 Microsoft Teams,成為公司內部的 AI 員工?最快的方式是 ZenClaw 控制台的 Microsoft Teams 連接頁。 MixerBox AI 做的託管服務 9 秒部署、Messaging endpoint URL 自動預設、*.zenclaw.bot 子網域與憑證自動——你只需要到 Azure Portal 建一個 Bot,把三組 credentials 貼回來。這篇給兩條路:ZenClaw 控制台的 Microsoft Teams 連接頁(點擊)、自架 OpenClaw 完整走一次 Azure。
Teams 整合的架構:為什麼比 LINE / Telegram 複雜
Microsoft Teams 走的不是 webhook token 模式,而是透過 Azure Bot 服務 + Microsoft Entra ID(前 Azure AD)做身分驗證。這是為了企業合規與 SSO。 組成元件:
- Azure Bot — Azure Portal 上的資源,負責 Teams ↔ 你伺服器 的訊息中繼
- Messaging endpoint — 你伺服器的對外 HTTPS URL(
https://你的網域/api/messages) - App ID — Microsoft Entra ID 上對應的 application 識別碼
- Client Secret — 用來驗證訊息來源的密碼
- Tenant ID — 你公司 Microsoft 365 tenant 的 ID
- Teams app manifest — 讓使用者能在 Teams 裡找到並安裝這個 bot
官方文件:docs.microsoft.com/en-us/azure/bot-service。對比 LINE 只要 Channel Secret + Access Token 兩組,Teams 要取三組 ID + secret,流程比較長。
推薦:ZenClaw 控制台的 Microsoft Teams 連接頁(15 分鐘)
ZenClaw 已經幫你把 Messaging endpoint、網域、HTTPS 憑證全預設好。你只要到 Azure Portal 建 Bot、填回三組 ID。 流程:
- 登入 zenclaw.ai
- 按「立即雇用 AI 員工」→ 進控制台按「新增 OpenClaw 安裝」→ 等 9 秒
- Channels 區點 Microsoft Teams
- 複製上方的 Messaging endpoint URL(ZenClaw 自動給你一個
https://*.zenclaw.bot/api/messages) - 到 portal.azure.com,建立 Azure Bot(Type of App 選 Single Tenant,Pricing tier 選 Free F0)
- Bot → Configuration → 貼入 Messaging endpoint → Apply
- 複製 App ID(Microsoft App ID 欄)
- 建立 Client Secret:點 Manage Password 或進 Microsoft Entra ID → App registrations → 該 app → Certificates & secrets → New client secret → 複製 Value
- 取 Tenant ID:Microsoft Entra ID → Overview
- 回 ZenClaw 控制台的 Microsoft Teams 連接頁,貼入 App ID / Client Secret / Tenant ID,按連線
完成。接下來發布 Teams app(manifest 可以讓 ZenClaw 產給你,或走 Teams admin center 側載)。
自架 OpenClaw 接 Teams:完整 7 步
假設你已經有一台跑起來的 OpenClaw(見 零技術背景完整指南)、有對外 HTTPS 網域、有 Azure 訂閱。 走一遍完整步驟:
Step 1:建立 Azure Bot
portal.azure.com → 搜尋「Azure Bot」→ Create:
- Bot handle:取個唯一名字
- Subscription / Resource group:選你的
- Pricing tier:Free (F0)
- Data residency:Global
- Type of App:Single Tenant(建議,最簡單合規)
- Creation type:Create new Microsoft App ID
Review + Create → 等資源就緒。
Step 2:設 Messaging endpoint
進 Azure Bot → 左側 Configuration:
- Messaging endpoint:填
https://你的網域/api/messages- 必須 HTTPS
- 憑證合法(Let’s Encrypt 或正式 CA)
- 你 OpenClaw 必須已經對外開放這個路徑
- Apply 儲存
Step 3:取 App ID
同 Configuration 頁:Microsoft App ID 那一欄就是。複製存好——這等於 Entra ID 上的 app registration。
Step 4:建立 Client Secret
兩條路:
路 A:Configuration 頁 → Manage Password(直接跳 Entra ID)
路 B:左側選 Microsoft Entra ID → App registrations → 找到剛才的 app → Certificates & secrets → New client secret
- 填 description
- 選到期日(建議 6 個月以上,到期要更新)
- 建立後立刻複製 Value(只顯示一次、刷新就看不到)
Step 5:取 Tenant ID
Microsoft Entra ID → Overview → Tenant ID(GUID)。複製存好。
Step 6:填入 OpenClaw
編輯 ~/.openclaw/openclaw.json 或用 dashboard,在 channels.msteams 填入:
{
"channels": {
"msteams": {
"appId": "你的 App ID",
"appPassword": "你的 Client Secret",
"tenantId": "你的 Tenant ID"
}
}
}
重啟 gateway(預設 port 18789)。官方 CLI 設定:docs.openclaw.ai/cli/config。
Step 7:側載 / 發佈 Teams app
建立 Teams app manifest(JSON 檔,內容包含 App ID、bot 資訊、圖示)。打包成 .zip,到:
- Teams admin center → Manage apps → Upload new app(給整個組織)
- 或 Teams client 左側 Apps → Upload a custom app(個人 / 團隊)
完成後在 Teams 開啟跟 bot 的 1:1 聊天、傳訊息,看 OpenClaw gateway log 有沒有收到。
常見踩雷
最多人卡在:Messaging endpoint 不是 HTTPS / 憑證過期、Client Secret 忘了複製 Value、Single Tenant vs Multi Tenant 選錯、Teams app 沒側載成功。 排查:
- Bot 建好但傳訊息沒反應 → Messaging endpoint URL 可達嗎?
curl看 - 憑證不合法 → Let’s Encrypt 要記得自動更新
- Client Secret 驗證失敗 → Value 複製錯、或已過期,重新建一組
- Tenant ID 錯 → 去 Entra ID Overview 再複製一次
- Teams 裡找不到 bot → 側載失敗,看 Teams admin center 的錯誤訊息
~/.openclaw/重啟設定不見 → Docker volume 沒掛好,見 volume 設定不見修復
企業情境還要考慮:網路政策可能擋 Azure / Teams API,見 OpenClaw 安全加固 10 項。
ZenClaw vs 自架:時間成本對比
ZenClaw 省下的不是 Azure 那幾步(那個還是要),而是 Messaging endpoint 的伺服器、網域、HTTPS 憑證、以及後續 OpenClaw 維運。 對比:
| 面向 | 自架 | ZenClaw 控制台的 Microsoft Teams 連接頁 |
|---|---|---|
| Azure Bot 建立 | 要 | 要(同樣 Azure 步驟) |
| 伺服器 + OpenClaw | 自己架 | 9 秒預設好 |
| Messaging endpoint URL | 自己申請網域 + TLS | 自動 *.zenclaw.bot |
| HTTPS 憑證 | 自己維護 | 自動續期 |
| 升級 / CVE | 自己追 | 自動 |
| 首次上線 | 數天~數週 | 15–20 分鐘 |
選擇權看你——但若你只是要讓公司在 Teams 用上 AI 員工,ZenClaw 顯然是比較簡單的路。