Google Chat (Chat API)¶
အခြေအနေ: Google Chat API webhooks (HTTP သာ) မှတစ်ဆင့် DMs + spaces အတွက် အသင့်ဖြစ်နေပါသည်။
အမြန်စတင်ရန် (အစပြုသူများ)¶
- Google Cloud project တစ်ခု ဖန်တီးပြီး Google Chat API ကို ဖွင့်ပါ။ - သွားရန်: Google Chat API Credentials - API ကို မဖွင့်ရသေးပါက ဖွင့်ပါ။
- Service Account တစ်ခု ဖန်တီးပါ:
- Create Credentials > Service Account ကို နှိပ်ပါ။
- အမည်ကို စိတ်ကြိုက်ပေးပါ (ဥပမာ
openclaw-chat)။ - ခွင့်ပြုချက်များကို လွတ်ထားပါ (Continue ကို နှိပ်ပါ)။ - ဝင်ရောက်ခွင့်ရှိသော principals များကို လွတ်ထားပါ (Done ကို နှိပ်ပါ)။ - JSON Key ကို ဖန်တီးပြီး ဒေါင်းလုဒ်လုပ်ပါ: - ဖန်တီးပြီးသော service accounts စာရင်းထဲမှ သင်ဖန်တီးထားသည့် account ကို နှိပ်ပါ။ - Keys 탭 သို့ သွားပါ။ - Add Key > Create new key ကို နှိပ်ပါ။ - JSON ကို ရွေးပြီး Create ကို နှိပ်ပါ။
- ဒေါင်းလုဒ်လုပ်ထားသော JSON ဖိုင်ကို သင့် Gateway ဟို့စ် တွင် သိမ်းဆည်းပါ (ဥပမာ
~/.openclaw/googlechat-service-account.json)။ - Google Cloud Console Chat Configuration တွင် Google Chat အက်ပ် တစ်ခု ဖန်တီးပါ:
- Application info ကို ဖြည့်ပါ:
- App name: (ဥပမာ
OpenClaw) - Avatar URL: (ဥပမာ
https://openclaw.ai/logo.png) - Description: (ဥပမာ
Personal AI Assistant) - Interactive features ကို ဖွင့်ပါ။
- Functionality အောက်တွင် Join spaces and group conversations ကို အမှန်ခြစ်ပါ။
- Connection settings အောက်တွင် HTTP endpoint URL ကို ရွေးပါ။
- Triggers အောက်တွင် Use a common HTTP endpoint URL for all triggers ကို ရွေးပြီး သင့် Gateway ၏ public URL နောက်တွင်
/googlechatကို ဆက်ထည့်ပါ။ - အကြံပြုချက်: သင့် Gateway ၏ public URL ကို ရှာရန်
openclaw statusကို ပြေးပါ။ - Visibility အောက်တွင် Make this Chat app available to specific people and groups in <Your Domain> ကို အမှန်ခြစ်ပါ။
- စာသားဘောက်စ်ထဲတွင် သင့် အီးမေးလ်လိပ်စာ (ဥပမာ
user@example.com) ကို ထည့်ပါ။ - အောက်ဆုံးရှိ Save ကို နှိပ်ပါ။
- App name: (ဥပမာ
- အက်ပ် အခြေအနေကို ဖွင့်ပါ: - သိမ်းပြီးနောက် စာမျက်နှာကို ပြန်လည်ဆန်းသစ်ပါ။ - App status အပိုင်းကို ရှာပါ (အများအားဖြင့် သိမ်းပြီးနောက် အပေါ် သို့မဟုတ် အောက်တွင် တွေ့ရပါမည်)။ - အခြေအနေကို Live - available to users သို့ ပြောင်းပါ။ - Save ကို ထပ်မံ နှိပ်ပါ။
- OpenClaw ကို service account path + webhook audience ဖြင့် ဖွဲ့စည်းပါ:
- Env:
GOOGLE_CHAT_SERVICE_ACCOUNT_FILE=/path/to/service-account.json- သို့မဟုတ် config:channels.googlechat.serviceAccountFile: "/path/to/service-account.json"။ - webhook audience အမျိုးအစား + တန်ဖိုးကို သတ်မှတ်ပါ (သင့် Chat app config နှင့် ကိုက်ညီရပါမည်)။
- gateway ကို စတင်ပါ။ Google Chat will POST to your webhook path.
Google Chat တွင် ထည့်သွင်းခြင်း¶
Gateway ကို စတင်ထားပြီး သင့် အီးမေးလ်ကို visibility စာရင်းထဲ ထည့်ထားပြီးနောက်:
- Google Chat သို့ သွားပါ။
- Direct Messages ဘေးရှိ + (plus) အိုင်ကွန်ကို နှိပ်ပါ။
- ရှာဖွေရေးဘားတွင် (လူများကို ထည့်လေ့ရှိသည့် နေရာ) Google Cloud Console တွင် သင် သတ်မှတ်ထားသော App name ကို ရိုက်ထည့်ပါ။ - မှတ်ချက်: ဤ bot သည် private app ဖြစ်သောကြောင့် "Marketplace" browse စာရင်းတွင် မ ပေါ်လာပါ။ ၎င်းကို အမည်ဖြင့် ရှာဖွေရပါမည်။
- ရလဒ်များထဲမှ သင့် bot ကို ရွေးပါ။
- Add သို့မဟုတ် Chat ကို နှိပ်ပြီး 1:1 စကားပြောကို စတင်ပါ။
- အကူအညီပေးသူကို စတင်အလုပ်လုပ်စေရန် "Hello" ကို ပို့ပါ။
အများပြည်သူသုံး URL (Webhook-only)¶
Google Chat webhooks များသည် အများပြည်သူမှ ဝင်ရောက်နိုင်သော HTTPS endpoint တစ်ခု လိုအပ်ပါသည်။ လုံခြုံရေးအတွက် /googlechat လမ်းကြောင်းကိုသာ အင်တာနက်သို့ ဖော်ပြပါ။ OpenClaw dashboard နှင့် အခြား အရေးကြီးသော endpoint များကို သင်၏ private network အတွင်းတွင်သာ ထားရှိပါ။
Option A: Tailscale Funnel (အကြံပြု)¶
Use Tailscale Serve for the private dashboard and Funnel for the public webhook path. This keeps / private while exposing only /googlechat.
- သင့် Gateway သည် မည်သည့်လိပ်စာတွင် bind လုပ်ထားသည်ကို စစ်ဆေးပါ:
bash
ss -tlnp | grep 18789
IP လိပ်စာကို မှတ်သားပါ (ဥပမာ 127.0.0.1, 0.0.0.0, သို့မဟုတ် 100.x.x.x ကဲ့သို့သော သင့် Tailscale IP)။
- dashboard ကို tailnet အတွင်းသာ ဖော်ပြပါ (port 8443):
```bash # If bound to localhost (127.0.0.1 or 0.0.0.0): tailscale serve --bg --https 8443 http://127.0.0.1:18789
# If bound to Tailscale IP only (e.g., 100.106.161.80): tailscale serve --bg --https 8443 http://100.106.161.80:18789 ```
- webhook path ကိုသာ public အဖြစ် ဖော်ပြပါ:
```bash # If bound to localhost (127.0.0.1 or 0.0.0.0): tailscale funnel --bg --set-path /googlechat http://127.0.0.1:18789/googlechat
# If bound to Tailscale IP only (e.g., 100.106.161.80): tailscale funnel --bg --set-path /googlechat http://100.106.161.80:18789/googlechat ```
-
Funnel ဝင်ရောက်ခွင့်အတွက် node ကို အတည်ပြုပါ: တောင်းဆိုလာပါက output တွင် ပြထားသော authorization URL သို့ သွားပြီး သင့် tailnet policy တွင် ဤ node အတွက် Funnel ကို ဖွင့်ပါ။
-
ဖွဲ့စည်းမှုကို အတည်ပြုပါ:
bash
tailscale serve status
tailscale funnel status
သင်၏ အများပြည်သူသုံး webhook URL သည် -
https://<node-name>.<tailnet>.ts.net/googlechat
သင်၏ private dashboard သည် tailnet အတွင်းတွင်သာ ဆက်လက်ရှိနေမည် -
https://<node-name>.<tailnet>.ts.net:8443/
Google Chat app config တွင် :8443 မပါဘဲ public URL ကို အသုံးပြုပါ။
မှတ်ချက်: ဤ configuration သည် စက်ပြန်ဖွင့်ပြီးနောက်လည်း ဆက်လက်တည်ရှိပါမည်။ နောက်ပိုင်းတွင် ဖယ်ရှားလိုပါက
tailscale funnel resetနှင့်tailscale serve resetကို 실행ပါ။
Option B: Reverse Proxy (Caddy)¶
Caddy ကဲ့သို့သော reverse proxy ကို အသုံးပြုပါက path သီးသန့်ကိုသာ proxy လုပ်ပါ:
your-domain.com {
reverse_proxy /googlechat* localhost:18789
}
ဤဖွဲ့စည်းမှုဖြင့် your-domain.com/ သို့ လာသော request များကို လျစ်လျူရှုမည် သို့မဟုတ် 404 ဖြင့် ပြန်ပို့မည်ဖြစ်ပြီး your-domain.com/googlechat ကိုသာ OpenClaw သို့ လုံခြုံစွာ လမ်းကြောင်းချပါမည်။
Option C: Cloudflare Tunnel¶
Tunnel ၏ ingress rules များကို webhook path ကိုသာ လမ်းကြောင်းချရန် ဖွဲ့စည်းပါ:
- Path:
/googlechat->http://localhost:18789/googlechat - Default Rule: HTTP 404 (Not Found)
အလုပ်လုပ်ပုံ¶
- Google Chat sends webhook POSTs to the gateway. Each request includes an
Authorization: Bearer <token>header. - OpenClaw သည် သတ်မှတ်ထားသော
audienceType+audienceကို အသုံးပြု၍ token ကို စစ်ဆေးပါသည်: -audienceType: "app-url"→ audience သည် သင့် HTTPS webhook URL ဖြစ်ပါသည်။ -audienceType: "project-number"→ audience သည် Cloud project number ဖြစ်ပါသည်။ - မက်ဆေ့ချ်များကို space အလိုက် လမ်းကြောင်းခွဲပါသည်:
- DMs များသည် session key
agent:<agentId>:googlechat:dm:<spaceId>ကို အသုံးပြုပါသည်။ - Spaces များသည် session keyagent:<agentId>:googlechat:group:<spaceId>ကို အသုံးပြုပါသည်။ - DM access is pairing by default. Unknown senders receive a pairing code; approve with:
-
openclaw pairing approve googlechat <code> - Group spaces require @-mention by default. Use
botUserif mention detection needs the app’s user name.
Targets¶
ပို့ဆောင်မှုနှင့် allowlists အတွက် အောက်ပါ အမှတ်အသားများကို အသုံးပြုပါ:
- Direct messages:
users/<userId>သို့မဟုတ်users/<email>(အီးမေးလ်လိပ်စာများကို လက်ခံပါသည်)။ - Spaces:
spaces/<spaceId>။
Config highlights¶
{
channels: {
googlechat: {
enabled: true,
serviceAccountFile: "/path/to/service-account.json",
audienceType: "app-url",
audience: "https://gateway.example.com/googlechat",
webhookPath: "/googlechat",
botUser: "users/1234567890", // optional; helps mention detection
dm: {
policy: "pairing",
allowFrom: ["users/1234567890", "name@example.com"],
},
groupPolicy: "allowlist",
groups: {
"spaces/AAAA": {
allow: true,
requireMention: true,
users: ["users/1234567890"],
systemPrompt: "Short answers only.",
},
},
actions: { reactions: true },
typingIndicator: "message",
mediaMaxMb: 20,
},
},
}
မှတ်ချက်များ:
- Service account credentials ကို
serviceAccount(JSON string) ဖြင့် inline အဖြစ်လည်း ပေးနိုင်ပါသည်။ webhookPathကို မသတ်မှတ်ထားပါက default webhook path သည်/googlechatဖြစ်ပါသည်။actions.reactionsကို ဖွင့်ထားပါကreactionstool နှင့်channels actionမှတစ်ဆင့် Reactions ကို အသုံးပြုနိုင်ပါသည်။typingIndicatorသည်none,message(default), နှင့်reactionကို ပံ့ပိုးပါသည် (reaction များအတွက် user OAuth လိုအပ်ပါသည်)။- Attachments များကို Chat API မှတစ်ဆင့် ဒေါင်းလုဒ်လုပ်ပြီး media pipeline တွင် သိမ်းဆည်းပါသည် (အရွယ်အစားကို
mediaMaxMbဖြင့် ကန့်သတ်ထားပါသည်)။
ပြဿနာဖြေရှင်းခြင်း¶
405 Method Not Allowed¶
Google Cloud Logs Explorer တွင် အောက်ပါကဲ့သို့သော အမှားများကို ပြသပါက:
status code: 405, reason phrase: HTTP error response: HTTP/1.1 405 Method Not Allowed
This means the webhook handler isn't registered. Common causes:
- Channel not configured: The
channels.googlechatsection is missing from your config. အတည်ပြုရန်–
bash
openclaw config get channels.googlechat
"Config path not found" ဟုပြပါက ဖွဲ့စည်းမှုကို ထည့်ပါ (Config highlights ကို ကြည့်ပါ)။
- Plugin မဖွင့်ထားခြင်း: plugin အခြေအနေကို စစ်ဆေးပါ:
bash
openclaw plugins list | grep googlechat
"disabled" ဟုပြပါက သင့် config တွင် plugins.entries.googlechat.enabled: true ကို ထည့်ပါ။
- Gateway ကို ပြန်မစတင်ရသေးခြင်း: config ထည့်ပြီးနောက် Gateway ကို ပြန်စတင်ပါ:
bash
openclaw gateway restart
ချန်နယ် လည်ပတ်နေကြောင်း အတည်ပြုပါ:
openclaw channels status
# Should show: Google Chat default: enabled, configured, ...
အခြား ပြဿနာများ¶
- auth အမှားများ သို့မဟုတ် audience config မပြည့်စုံခြင်းများအတွက်
openclaw channels status --probeကို စစ်ဆေးပါ။ - မက်ဆေ့ချ် မရောက်ပါက Chat app ၏ webhook URL + event subscriptions ကို အတည်ပြုပါ။
- mention gating ကြောင့် အဖြေများ ပိတ်ဆို့ခံရပါက
botUserကို အက်ပ်၏ user resource name အဖြစ် သတ်မှတ်ပြီးrequireMentionကို စစ်ဆေးပါ။ - test message ပို့နေစဉ် Gateway သို့ request များ ရောက်မရောက်ကို ကြည့်ရန်
openclaw logs --followကို အသုံးပြုပါ။
ဆက်စပ်စာတမ်းများ: