> ## Documentation Index
> Fetch the complete documentation index at: https://docs.engini.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Teams Bot

Learn how to connect Engini to Teams Bot.

Using Engini’s Teams Bot activities, you can receive messages and commands from Microsoft Teams users, reply to them, send adaptive cards, and automate your team communication workflows directly from Microsoft Teams.

To get started with the Teams Bot app, you need a Microsoft account that can sign in to [Microsoft Teams](https://www.microsoft.com/microsoft-teams).

## Getting Started with Teams Bot

### Prerequisites

* A Microsoft Teams account.
* A Microsoft account that is allowed to sign in to your Teams organization.
* Only for a custom Teams bot: the Bot ID and the Secret key of your bot.
  **Note:** If you use the default sign-in with Microsoft, you do not need a Bot ID or a Secret key.
* The Engini bot added in your Microsoft Teams organization.
* The bot only answers users whose Microsoft 365 organization already has a Teams Bot connection in Engini. Other users get a "not registered" card instead.

## Add a connection to Teams Bot in Engini

1. Enter your Engini account at [https://app.engini.io.](https://app.engini.io/)

2. Navigate to Connections page by clicking on the Connections on the left sidebar or by clicking [here.](https://app.engini.io/connections)

3. Click on the "New Integration" option located at the top bar.

   <img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/connections-new-integration.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=c6e1ed2b7e097dc2a8f13e7f86cadf60" alt="" width="1568" height="688" data-path="help/assets/apps/teams-bot/connections-new-integration.png" />

4. Search for "TeamsBot" and choose it from the available applications.

   <img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/choose-application-teams-bot.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=8d12996f0a3784ea836374a3d92a01e3" alt="" width="1568" height="688" data-path="help/assets/apps/teams-bot/choose-application-teams-bot.png" />

5. Enter the following details in the “New Integration” form and press Save:

**Note:** There are two different authentication methods available, and the required fields differ depending on the option you choose.
Please follow the relevant instructions based on your selected method.

### *OAuth2*

Use the default method to connect with your own Microsoft account.

<img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/connection-form-oauth2.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=029d98fede753580e4fa0b58a01b3704" alt="" width="1568" height="688" data-path="help/assets/apps/teams-bot/connection-form-oauth2.png" />

1. *Connection Name -* Enter unique identifier for the connection within Engini.
2. Leave *Authentication Method* on the default ***OAuth2***, then click on the “Sign in with Microsoft” button.

* Sign in to your Microsoft account and click Allow on the permission screen.

3. Click on the Save button to save the connection.

### *Custom OAuth2*

Use this method if you work with your own custom Teams bot.

<img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/connection-form-custom-oauth2.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=c4fa3482ceaeb16ac00009710f7335ce" alt="" width="1568" height="688" data-path="help/assets/apps/teams-bot/connection-form-custom-oauth2.png" />

1. *Connection Name -* Enter unique identifier for the connection within Engini.
2. *Authentication Method -* Select ***Custom OAuth2***.
3. *Teams Bot Id -* Enter the unique ID of your Teams bot.
4. *Teams Bot Secret key -* Enter the secret key of your Teams bot.
5. Click on the “Sign in with Microsoft” button.

* Sign in to your Microsoft account and click Allow on the permission screen.

6. Click on the Save button to save the connection.

## Triggers

### Message Received

Triggers the workflow when a user sends any message to the Teams bot, enabling free-text and conversational interactions.

<img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/message-received.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=9eeec59564e522ee7273a19eff18e77f" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/message-received.png" />

* *Add Conditions -* Optionally add conditions so the workflow starts only for messages that match them.

The trigger returns the message text, the sender’s email, the sender’s Microsoft user ID, and any files the user attached, so you can use them in later steps.

### Command Received

Triggers the workflow when a user sends a specific command to the Teams bot, for example "/status". Commands are always typed with a leading slash.

<img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/command-received.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=2778548efa0f909fcb633f9dacd8a89f" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/command-received.png" />

* *Command Name -* Enter the command that should start the workflow, without the slash, for example "status". The user then types "/status" in the chat. Matching ignores upper and lower case and must match the whole command, so "/status now" does not match. A message without a slash starts the *Message Received* trigger instead.

The trigger returns the command text (without the slash), the sender’s email, the sender’s Microsoft user ID, and any files the user attached, so you can use them in later steps.

### Help Command Received

Triggers the workflow when a user types "/help". If you do not use this trigger, the bot answers "/help" itself with a built-in card listing all the available commands. Adding this trigger replaces that built-in card with your own reply. Only one active Help Command Received workflow runs.

<img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/help-command-received.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=174164052b16ca029912cdc3599ea877" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/help-command-received.png" />

This trigger has no fields to fill in. It returns the sender’s email, the sender’s Microsoft user ID, and any files the user attached, so you can use them in later steps.

### Adaptive Card Button Click

Triggers the workflow when a user clicks a button inside an adaptive card sent by the Teams bot, so your workflow can react to the user’s choice.

<img src="https://mintcdn.com/engini/g_1w923yIF_BlSUK/help/assets/apps/teams-bot/adaptive-card-button-click.png?fit=max&auto=format&n=g_1w923yIF_BlSUK&q=85&s=cd804c150cead4561b98abcd1a0b79bd" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/adaptive-card-button-click.png" />

* *Source card -* Select the *Send Adaptive Card* step whose card you want to read values from. This adds that card’s input fields to the trigger’s list, so you can map them in later steps. The default is *None*, which leaves those input fields out of the list. It does not control which card starts the workflow.

The trigger returns the ID of the clicked button and the values the user entered in the card’s input fields, so you can use them in later steps.

## Actions

### Send Teams Message

Sends a message, with optional attachments, to a Teams user.

<img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/send-teams-message.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=71384c8ff0e761b8ca73e1e366bd71b9" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/send-teams-message.png" />

1. *Message -* Enter the text you want the bot to send.
2. *User ID -* Enter the Microsoft user ID of the person who should receive the message. Leave it empty to send to the user who started the workflow from a Teams Bot trigger. It is required when the workflow does not start from a Teams Bot trigger. The message is always sent as a direct chat with the bot.
3. *Add Attachments -* Add rich content such as files or images to the message. Select the attachment type, then fill in its value as static text, as a value mapped from a previous step, or as an expression. Repeat for each attachment you want to include. Images appear inside the message; other file types are offered to the recipient as a Teams file card that they must accept before the file is delivered.

### Post Reply Action

Replies to the user who triggered the workflow, with optional attachments.

<img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/post-reply-action.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=69de7c57c929949c746a24b5bc011544" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/post-reply-action.png" />

1. *Message -* Enter the text you want the bot to send back to the user.
2. *Add Attachments -* Add rich content such as files or images to the reply. Select the attachment type, then fill in its value as static text, as a value mapped from a previous step, or as an expression. Repeat for each attachment you want to include. Images appear inside the message; other file types are offered to the recipient as a Teams file card that they must accept before the file is delivered.

**Note:** Use this activity in a workflow that starts with a Teams Bot trigger, because the trigger identifies the user and the conversation to reply to. The reply is posted in the same chat or channel the original message came from.

### Send Adaptive Card

Sends an adaptive card to the Teams user who started the workflow. Adaptive cards are interactive messages that can include text, images, input fields, and buttons.

<img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/send-adaptive-card.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=b6fe234ee2958992fd0a02cd58bd1aed" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/send-adaptive-card.png" />

1. *Adaptive Card -* Design the card in the Adaptive Card Designer. Choose *Start from scratch*, or pick a ready-made template: *Notification card*, *Survey form* or *Expense approval*. Click *Save* to apply your design to the field.
2. *Add Field -* Click to add optional fields. Note that the card is always sent to the user who started the workflow from a Teams Bot trigger. This step cannot send the card to a different user.

**Note:** This activity only works in a workflow that starts with a Teams Bot trigger. Without one the step fails, because there is no user to send the card to.

**Design the card**

Click the *Adaptive Card* field to open the Adaptive Card Designer. It opens as its own page, with the path *Workflows > Teams Bot > Send Adaptive Card > Adaptive Card Designer* at the top.

1. On the start screen, click *Start from scratch* to build an empty card.
2. Or pick a ready-made template from *All Templates*: *Notification card*, *Survey form* or *Expense approval*. You can change a template after you pick it.

   <img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/designer-start.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=3c3ba62113309ac913feb1729f124f3b" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/designer-start.png" />

Once a card is open, the designer shows four areas:

1. *Element Structure -* The list of everything on the card, in order. Click an item to select it.
2. The card itself, with a toolbar above it for adding a new card, container, column, text, image, input and other elements. Click an element on the card to select it.
3. *Element Properties -* The settings of the element you selected.
4. *Save -* Applies the card to the *Adaptive Card* field. *Cancel* closes the designer without applying it.

   <img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/designer-template-loaded.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=ac241e49cdac78e243f9064c82a23c99" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/designer-template-loaded.png" />

**Use the toolbar**

The line above the card adds new elements. Click a button to add the element inside the selected container or column, or at the end of the card. You can also drag it to an exact spot on the card or in *Element Structure*.

* *New card -* Goes back to the start screen, so you can start from scratch or pick another template. Your current card stays open until you pick one.
* *Container -* Adds a box that groups elements together.
* *Column -* Adds a column. If a column is selected, the new column is added next to it. Otherwise, a new row with one column is added.

The icons after them add a single element. Point at an icon to see its name:

* *Text -* A line of text.
* *Image -* A picture.
* *Text input -* A box where the user types an answer.
* *Choice set -* A list of options the user chooses from.
* *Date -* A date picker.
* *Checkbox -* A box the user ticks.
* *Buttons -* A row of buttons. Set what each button does in *Element Properties* (see *Set up a button* below).

*JSON -* At the far right of the toolbar, shows the card as code for advanced editing.

**Note:** The answers from *Text input*, *Choice set*, *Date* and *Checkbox* are returned by the *Adaptive Card Button Click* trigger under each element’s *ID*.

**Set up a button**

Select a button on the card. Its settings appear in *Element Properties*:

1. *Button ID -* A name for the button. Give every button its own ID.
2. *Title -* The text shown on the button.
3. *Button click workflow -* The workflow that runs when the user clicks the button. That workflow must start with the *Adaptive Card Button Click* trigger. A button with no workflow does nothing.

   <img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/designer-button-selected.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=1d81c7f4dda30d2df17531c5e699dda9" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/designer-button-selected.png" />

**Set up an input**

Select an input, such as a text input. Its settings appear in *Element Properties*:

1. *ID -* The name of the answer. The value the user enters is returned by the *Adaptive Card Button Click* trigger under this ID, so use a clear name such as *email* or *reason*.
2. *Label -* The question shown above the input.

   <img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/designer-input-selected.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=475bd475167ffa5319aeac8d6fcb349d" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/designer-input-selected.png" />

**Save the card**

Click *Save*. You return to the *Send Adaptive Card* step, and the *Adaptive Card* field now shows your card.

* *Adaptive Card -* The card you designed. Click it again at any time to reopen the designer and change it.

  <img src="https://mintcdn.com/engini/q9ZKM_GZWBQLAG6n/help/assets/apps/teams-bot/designer-card-applied.png?fit=max&auto=format&n=q9ZKM_GZWBQLAG6n&q=85&s=feaa0b2a8c47ec1b248303205daef895" alt="" width="1918" height="836" data-path="help/assets/apps/teams-bot/designer-card-applied.png" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.