Microsoft Teams
Share any xMagic agent with Microsoft Teams so people in your organization can chat with it without leaving Teams. Each share becomes its own Teams app with its own bot, so you can revoke it at any time without touching the agent itself.
This tutorial walks through the whole setup with an example agent called Stochastic Teams Tutorial. You switch between four places:
| Where | What you do there |
|---|---|
| xMagic | Create the share, paste the bot details, download the Teams app and verify the connection |
| Teams Developer Portal | Create the bot, its client secret and the Teams app |
| Microsoft Entra admin center | Copy your organization's Tenant ID |
| Teams admin center | Upload the app and choose who can use it |
Before you start
You need:
- An xMagic agent you are allowed to configure.
- A Microsoft 365 account that can create apps in the Teams Developer Portal.
- A Teams administrator who can upload custom apps in the Teams admin center.
xMagic keeps your setup progress. If you close the wizard halfway, open the share again and it continues from the step you left.
Step 1: Create the share in xMagic
- In the left bar, open the menu (⋯) next to your agent and select Share.

- Under Share with apps, select Set up next to Microsoft Teams.

- Enter a Share name. This is the app name people see in Teams, so make it recognizable (for example
Stochastic Teams Tutorial). - Under Available in, choose where people can use the agent: Private chat, Group chats and/or Team channels.
- Select Create share.

In private chats, people can attach files and receive files from the agent. In group chats and channels, files the agent creates are shared as download links.
Step 2: Register the bot in Teams Developer Portal
The Register bot step shows the exact values you need, including the messaging endpoint for this share. Keep the wizard open and select Open Teams Developer Portal to work side by side.

Create the bot
- In Teams Developer Portal, go to Tools → Bot management.

- Select + New bot.

- Enter a bot name (for example
Stochastic Teams Tutorial) and select Create.

Save the messaging endpoint
On the bot's Configure page, paste the endpoint shown in the wizard into Endpoint address and select Save. It looks like https://api.xmagic.ai/channels/shares/<share-id>/api/messages. Paste it exactly as shown.

Create a client secret
- In the same bot, open Client secrets and create a new client secret.
- Copy the secret value right away. Microsoft shows it only once and you paste it into xMagic in the next step.

Then go back to Tools → Bot management and copy the bot's Bot ID.
Create the Teams app and attach the bot
The second half of the Register bot step describes the app:

- In Teams Developer Portal, go to Apps → New app.

- Enter the app name and select Create.

- Under Basic information, copy the App ID. It goes into the Teams App ID field in xMagic.

- Open App features → Bot and, under Select an existing bot, choose the bot you created.
- Under What can your bot do?, tick Upload and download files. Leave Only send notification, Supports audio calls and Supports video calls unticked.
- Under the scopes, tick the same conversation types you chose for the share (in this example, Personal), then select Save.

Copy your Tenant ID
The Tenant ID identifies the Microsoft directory where you registered the bot.
- Open the Microsoft Entra admin center with the same account you used in Teams Developer Portal.
- In the left menu, select Entra ID → Overview.
- Under Basic information, copy the Tenant ID (use the copy icon next to it).

If you cannot open the Microsoft Entra admin center, ask your Microsoft 365 or directory administrator for the Tenant ID.
Back in xMagic, select Enter bot details.
Step 3: Connect the bot in xMagic
Paste the values you copied:
| Field | Where to find it |
|---|---|
| Bot ID | Teams Developer Portal → Tools → Bot management → your bot |
| Bot registration Tenant ID | Microsoft Entra admin center → Entra ID → Overview → Tenant ID (see Copy your Tenant ID) |
| Teams App ID | Teams Developer Portal → Apps → your app → Basic information → App ID |
| Allowed organization Tenant ID | For your own organization, the same Tenant ID as above |
| Bot client secret | The secret value you copied from Client secrets |

Check Available in, then select Save connection.

xMagic stores the client secret encrypted. To change the bot later, open the share again; leave the secret blank to keep the saved one.
Step 4: Install the app in your organization
- In the Install step, select Download Teams app (.zip) and give the ZIP to your Teams administrator. It already contains the bot, the conversation types and the app icons.

Upload the app
- In the Teams admin center, go to Teams apps → Manage apps. Open Actions (top right corner) and select Upload new app.

- Select Upload and choose the ZIP you downloaded.

Choose who can use it
- In Manage apps, scroll down to the All apps list, type the app name in Search by name and find your app.

- Under Available to, select the link. The app page opens on Users and groups with Availability selected.

- Select Edit availability, choose Everyone or Specific users or groups (useful for a pilot) and select Apply.

Install it for people
- On the app page, under Installed for, select the link (for example No one) and then Install app.

- Choose Everyone or a pilot group in Install to and select Apply.

Microsoft takes time to roll out a newly installed app to everyone in your organization, often several hours. Until then, people cannot find the app in Teams. This is normal: wait, then ask them to refresh Teams. You don't need to upload or install the app again.
This setup is done once: nobody needs to repeat the bot registration, IDs, secret or ZIP upload.
Step 5: Chat with the agent in Teams
If the app doesn't show up yet, wait and refresh Teams: after it is installed, it can take several hours to reach everyone.
In a private chat, the app appears under Chat only after its chat has been opened once:
- In Teams, select Apps (the + icon in the left bar).
- Search for the app name and select it.
- Select Open (Add the first time). The chat with the agent then appears under Chat.
In group chats and channels, mention the app (for example @Stochastic Teams Tutorial) to get a reply.
Send /new in the chat to start a new conversation with a clean history. See Start a new conversation.
Ask questions and share files
Write to the agent as you would to a colleague. In a private chat you can also attach a file with the paperclip icon and ask about it, for example "What is the hotel limit for a trip to Paris?" together with your company's travel policy.
The agent remembers what was said earlier in the same conversation, so you can ask follow-up questions without repeating yourself.
What the agent remembers
The agent's memory belongs to the conversation, not to the person. What counts as one conversation depends on where you talk to it:
| Where | What the agent remembers | Good to know |
|---|---|---|
| Private chat (one-on-one) | Everything you said before in your chat with it | Each person has their own private chat, so nobody else sees or shares it. |
| Group chat | The whole group chat, shared by everyone in it | It only sees messages that @mention it. Other messages in the group never reach it. |
| Team channel | Each thread on its own | A reply in the same thread keeps the memory. A new post starts a fresh conversation. |
Nothing carries over from one conversation to another. For example, something you tell the agent in your private chat is not known in a group chat or a channel. The same goes the other way round.
Start a new conversation with /new
Because the agent remembers the whole chat, earlier messages can get in the way when you move on to something else. Send /new to start over. You stay in the same Teams chat, but the agent starts again as if you were talking to it for the first time.
Use /new when you:
- switch to a different topic or task,
- want to ask about a different file, or
- notice the agent keeps referring to something said earlier.
For example:
| You send | The agent replies |
|---|---|
| I'm travelling to Lisbon next month to visit one of our suppliers. | Offers help with the trip. |
| Which city am I travelling to? | You're travelling to Lisbon. You mentioned it at the start of our conversation. |
/new | Started a new conversation. Your next message begins with a clean history. |
| Which city am I travelling to? | I don't have any information about your travel plans. You haven't shared any details with me yet. |
After /new, the agent no longer knows about the trip: the next message really starts from scratch.
Good to know:
- You can also type
newwithout the slash. - In group chats and channels, mention the app first, for example
@Stochastic Teams Tutorial /new. - Each private chat, group chat and channel thread has its own conversation, so
/newonly clears the one you send it in. - Earlier messages stay visible in Teams, so you can still scroll back and read them.
Teams can also suggest new in the app's command menu. If you don't see it there, your Teams administrator can download the app again from Manage in xMagic and upload it in the Teams admin center. Like a new installation, the update can take several hours to reach everyone. Typing /new works either way.
See where an answer comes from
When the agent uses a file or a web page to answer, it adds a small number such as 1 to the answer. Hover over or select the number to see:
- the name of the file or page and
- the passage the agent used.
Select the name to open the file or page.
File links work for 1 hour after the answer arrives. If a link has expired, ask the question again to get a new one.
Step 6: Verify the connection
Back in xMagic, select Verify connection and then Check Teams connectivity. Once xMagic has received a message from Teams for this share, the share shows Connected.
If the check reports a problem, fix it, send a new message in Teams and check again.
Review Teams conversations in xMagic
Conversations from Teams appear in the agent's Threads with the Teams logo. To see only those, use Filter → Type → Microsoft Teams. Every time someone sends /new, the conversation that follows appears as a new thread.
Managing a share
Open the agent's Share dialog to see every app share under Existing app shares:
| Action | Effect |
|---|---|
| Manage | Reopen the wizard to change the bot details or conversation types, download the ZIP again or check the connection |
| Revoke | Permanently disconnect this share; the agent itself is not affected |