Skip to main content

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:

WhereWhat you do there
xMagicCreate the share, paste the bot details, download the Teams app and verify the connection
Teams Developer PortalCreate the bot, its client secret and the Teams app
Microsoft Entra admin centerCopy your organization's Tenant ID
Teams admin centerUpload the app and choose who can use it

Before you start​

You need:

note

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​

  1. In the left bar, open the menu (⋯) next to your agent and select Share.

Agent menu with the Share option

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

Share agent dialog with the Microsoft Teams option

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

Create share step of the Teams wizard

tip

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.

Register bot step with the messaging endpoint

Create the bot​

  1. In Teams Developer Portal, go to Tools → Bot management.

Developer Portal Tools page

  1. Select + New bot.

Bot management list

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

Create a new bot dialog

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.

Bot endpoint address saved

Create a client secret​

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

Client secret created dialog

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:

Register bot step with the Teams app instructions

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

Developer Portal Apps list

  1. Enter the app name and select Create.

Create a new app dialog

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

App ID on the Basic information page

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

Bot feature of the Teams app

Copy your Tenant ID​

The Tenant ID identifies the Microsoft directory where you registered the bot.

  1. Open the Microsoft Entra admin center with the same account you used in Teams Developer Portal.
  2. In the left menu, select Entra ID → Overview.
  3. Under Basic information, copy the Tenant ID (use the copy icon next to it).

Tenant ID on the Microsoft Entra admin center overview

note

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:

FieldWhere to find it
Bot IDTeams Developer Portal → Tools → Bot management → your bot
Bot registration Tenant IDMicrosoft Entra admin center → Entra ID → Overview → Tenant ID (see Copy your Tenant ID)
Teams App IDTeams Developer Portal → Apps → your app → Basic information → App ID
Allowed organization Tenant IDFor your own organization, the same Tenant ID as above
Bot client secretThe secret value you copied from Client secrets

Connect step with the bot identifiers

Check Available in, then select Save connection.

Connect step with the client secret and conversation types

note

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​

  1. 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.

Install step with the download button

Upload the app​

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

Actions dropdown in Manage apps

  1. Select Upload and choose the ZIP you downloaded.

Upload a custom app dialog

Choose who can use it​

  1. In Manage apps, scroll down to the All apps list, type the app name in Search by name and find your app.

Tutorial app in the All apps list

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

Availability view of the app page

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

Edit availability panel

Install it for people​

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

Installs view of the app

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

Edit installs panel with a selected user

It can take several hours before people see the app

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.

note

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:

  1. In Teams, select Apps (the + icon in the left bar).
  2. Search for the app name and select it.
  3. 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.

Start fresh at any time

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:

WhereWhat the agent remembersGood to know
Private chat (one-on-one)Everything you said before in your chat with itEach person has their own private chat, so nobody else sees or shares it.
Group chatThe whole group chat, shared by everyone in itIt only sees messages that @mention it. Other messages in the group never reach it.
Team channelEach thread on its ownA 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 sendThe 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.
/newStarted 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 new without 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 /new only clears the one you send it in.
  • Earlier messages stay visible in Teams, so you can still scroll back and read them.
note

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.

tip

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:

ActionEffect
ManageReopen the wizard to change the bot details or conversation types, download the ZIP again or check the connection
RevokePermanently disconnect this share; the agent itself is not affected