Microsoft Teams Bot
The Microsoft Teams Bot integration lets users hold a bidirectional conversation with OctoMesh directly from a Microsoft Teams chat: they can send messages (questions) and upload files (for example invoices), and receive answers back in the same conversation.
It is built on the Azure Bot Service and two mesh-adapter pipeline nodes:
| Node | Kind | Purpose |
|---|---|---|
FromTeamsBot@1 | Trigger | Hosts the Bot Framework messaging endpoint (POST /{tenant}/teamsBot), authenticates the request, downloads any file attachments and starts the pipeline for the incoming message. |
TeamsBotReply@1 | Load | Sends a reply back into the originating conversation through the Bot Framework REST API. |
Unlike the polling-based FromMicrosoftGraph@1 trigger (which only reads a Teams channel),
the bot is real-time and two-way: it supports 1:1 chats, file uploads and threaded
replies.
Architecture
- The user writes to the bot in Teams.
- Azure Bot Service relays the activity to the mesh adapter's messaging endpoint. For local development the endpoint is exposed through a dev tunnel (see Setup); in production it is a public HTTPS URL of the adapter.
FromTeamsBot@1normalises the activity — including downloaded file attachments — into the same$.Emails[] / AttachmentDatashape produced by the e-mail and Graph triggers, so the downstream pipeline is channel-agnostic. Conversation routing metadata (serviceUrl,conversationId, sender) is placed at$.Conversation.- Your pipeline does whatever it needs (query data, run an AI prompt, store an uploaded file …).
TeamsBotReply@1posts the answer back into the conversation.
Unified message shape
FromTeamsBot@1 emits the same structure as FromEmail@1 / FromMicrosoftGraph@1:
$.Emails[0].Body — the message text
$.Emails[0].From — sender display name
$.Emails[0].Attachments[0].Data — base64 file content (PDF, image, …)
$.Emails[0].Attachments[0].ContentType
$.Conversation.ServiceUrl — where TeamsBotReply@1 sends the answer
$.Conversation.ConversationId
$.Conversation.ActivityId — for threaded replies
This means a single pipeline can serve e-mail and Teams with only the trigger and the reply node differing per channel.
Credentials
Both nodes read their credentials from a MicrosoftGraphConfiguration entity resolved by
name through a Uses association on the pipeline. The Azure AD App Registration's
ClientId / ClientSecret double as the bot's App ID / secret, and AzureTenantId
selects the token authority (required for a single-tenant bot — see below) and is also used to
download channel (SharePoint) file attachments via Microsoft Graph.
Single-tenant vs. multi-tenant bot
Many Azure AD tenants now block the creation of multi-tenant app registrations, so the Azure Bot resource only offers Single Tenant (or Managed Identity, which has no client secret and cannot be used here). A single-tenant bot is fully supported:
TeamsBotReply@1requests its Bot Framework token from the tenant authorityhttps://login.microsoftonline.com/{AzureTenantId}/oauth2/v2.0/tokenwhenAzureTenantIdis set, and from thebotframework.comauthority (multi-tenant) when it is blank.- Therefore
AzureTenantIdis mandatory for a single-tenant bot.
Continue with the step-by-step Setup.