Microsoft Teams
Connect the agent to Microsoft Teams through the Bot Framework (single-tenant), with a manifest ready to publish.
Microsoft Teams
The Microsoft Teams integration lets the agent answer messages directly in your organisation's chat, through a bot registered in Azure / Bot Framework.
Reach it through the Settings icon → Integrations tab → the Microsoft Teams card.
Turning the integration on
Turn on the toggle in the Microsoft Teams card. The configuration fields appear once it is on.
How it works
- Teams sends an activity (a message, joining a conversation, an attachment) to Roberty's public endpoint.
- Roberty validates the JWT the Bot Framework issued (
aud= the bot'sappId). - The agent matching the payload's
tenantIdis resolved and run. - The answer goes back to Teams through the Bot Framework's own
serviceUrlAPI, authenticated with OAuth2client_credentials.
Roberty keeps each conversation's history (by conversationId), respecting the agent's Memory settings, so it has context between messages.
The configuration fields
| Field | What it is |
|---|---|
| Tenant ID | The Azure Active Directory tenant's ID (a UUID) |
| App ID (Bot) | The Application (client) ID of the App Registration created in the Azure portal |
| App Password | The registered application's client secret |
| Welcome message | Shown when a user starts a conversation in Teams (optional) |
Prerequisites
- An App Registration and an Azure Bot (Azure Bot Service).
- From the App Registration you need:
- Application (client) ID →
appId - Client secret →
appPassword - Directory (tenant) ID →
tenantId
- Application (client) ID →
The bot only authenticates in its own tenant, so the App Registration has to exist in the same tenant as the Teams the bot will be used in. If your Azure account lives in a different tenant from Microsoft 365/Teams, create the App Registration in the Teams tenant (App registrations belong to Entra ID and need no Azure subscription). The Azure Bot resource can stay in your subscription, pointing at that app.
Setting the bot up in Azure
1. Create the App Registration (in the Teams tenant)
- At portal.azure.com, switch the directory to the Teams tenant.
- Microsoft Entra ID → App registrations → New registration.
- Under Supported account types, choose Accounts in this organizational directory only (single-tenant).
- Note the Application (client) ID and the Directory (tenant) ID.
- Under Certificates & secrets → New client secret, generate one and copy the value (shown once).
2. Create the Azure Bot
- Create a resource → Azure Bot, type Single Tenant, option Use existing app registration.
- Enter the App ID and the App tenant ID (the Directory ID from the previous step).
- Under Configuration → Messaging endpoint, enter:
https://agent-backend.roberty.app/integrations/teams
- Under Channels, add the Microsoft Teams channel.
Roberty uses a single route for Teams and resolves the agent from the tenantId in the payload.
3. Configure the agent in Roberty
On this screen, fill in Tenant ID, App ID, App Password and, if you want, the welcome message.
4. Download the manifest and publish it to Teams
Use Download manifest (.zip) in the Teams card — it builds a ready package (manifest.json plus icons) from the agent's name and description and the App ID you entered. The button becomes available once there is an App ID filled in and a published version of the agent.
In the Teams client: Apps → Manage your apps → Upload an app → Upload a custom app, and select the .zip. (Uploading custom apps has to be allowed in the Teams admin.)
What it supports
- Conversation memory: the history is kept per conversation and bounded by the window set under the agent's Memory.
- Ending a conversation: the user can send
/reset(or/novaconversa,/encerrar,/limpar,/clear,/new) to finish — the agent writes a closing message and the history is cleared. - Attachments: files sent in the chat have their text extracted and handed to the agent. Documents (PDF, DOCX and the like) work natively; images depend on OCR.
Security validation
Roberty validates every request:
- The
Authorization: Bearer <jwt>header is checked against the public keys athttps://login.botframework.com/v1/.well-known/keys. - The token's audience must equal the
appIdconfigured on the agent. - The issuer must be
https://api.botframework.comorhttps://sts.windows.net/<tenantId>/.
Requests with no token, or an invalid one, get a 401.
Troubleshooting
| Symptom | Likely cause |
|---|---|
AADSTS700016: Application ... was not found in the directory | The App Registration is not in the tenant being used to authenticate — it has to exist in the Teams tenant (tenantId). |
401 Invalid token | The appId configured on the agent does not match the App Registration's. |
404 Agent not configured for tenant | The agent's tenantId does not match the organisation that sent the message. |
| The bot shows as "typing" and never answers | The appPassword is wrong or expired; check the secret. |
| The welcome message does not appear | The conversationUpdate event never arrived, or welcomeMessage is blank. |
| The manifest fails to validate on upload | The App ID is not a valid GUID, or the agent has no published version. |