mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-09 04:33:38 +00:00
2.8 KiB
2.8 KiB
Microsoft Teams (MVP)
This repository includes a built-in msteams channel MVP for Microsoft Teams direct messages.
Current scope
- Direct-message text in/out
- Tenant-aware OAuth token acquisition
- Conversation reference persistence for replies
- Public HTTPS webhook support through a tunnel or reverse proxy
Not yet included
- Group/channel handling
- Attachments and cards
- Polls
- Richer Teams activity handling
Example config
{
"channels": {
"msteams": {
"enabled": true,
"appId": "YOUR_APP_ID",
"appPassword": "YOUR_APP_SECRET",
"tenantId": "YOUR_TENANT_ID",
"host": "0.0.0.0",
"port": 3978,
"path": "/api/messages",
"allowFrom": ["*"],
"replyInThread": true,
"mentionOnlyResponse": "Hi — what can I help with?",
"validateInboundAuth": false,
"restartNotifyEnabled": false,
"restartNotifyPreMessage": "Nanobot agent initiated a gateway restart. I will message again when the gateway is back online.",
"restartNotifyPostMessage": "Nanobot gateway is back online."
}
}
}
Behavior notes
replyInThread: truereplies to the triggering Teams activity when a storedactivity_idis available.replyInThread: falseposts replies as normal conversation messages.- If
replyInThreadis enabled but noactivity_idis stored, Nanobot falls back to a normal conversation message. mentionOnlyResponsecontrols what Nanobot receives when a user sends only a bot mention such as<at>Nanobot</at>.- Set
mentionOnlyResponseto an empty string to ignore mention-only messages. validateInboundAuth: trueenables inbound Bot Framework bearer-token validation.validateInboundAuth: falseleaves inbound auth unenforced, which is safer while first validating a new relay, tunnel, or proxy path.- When enabled, Nanobot validates the inbound bearer token signature, issuer, audience, token lifetime, and
serviceUrlclaim when present. restartNotifyEnabled: trueenables optional Teams restart-notification configuration for external wrapper-script driven restarts.restartNotifyPreMessageandrestartNotifyPostMessagecontrol the before/after announcement text used by that external wrapper.
Setup notes
- Create or reuse a Microsoft Teams / Azure bot app registration.
- Set the bot messaging endpoint to a public HTTPS URL ending in
/api/messages. - Forward that public endpoint to
http://localhost:3978/api/messages. - Start Nanobot with:
nanobot gateway
- Optional: if you use an external restart wrapper (for example a script that stops and restarts the gateway), you can enable Teams restart announcements with
restartNotifyEnabled: trueand have the wrapper sendrestartNotifyPreMessagebefore restart andrestartNotifyPostMessageafter the gateway is back online.