# Microsoft Teams

> Send and retrieve messages in Microsoft Teams channels and chats, browse the teams and channels you belong to, and look up users to message.

Source: https://cotera.co/docs/reference/tools/individual-tools/microsoft-teams

---

**Authentication:** Microsoft OAuth. Requires a connected Microsoft 365 account with access to the relevant Microsoft resources, such as Teams depending on the tool.

**Description:** Send and retrieve messages in Microsoft Teams channels and chats, browse the teams and channels you belong to, and look up users to message.

***

## Beta Notice

**This tool is currently in beta testing and not yet available for general use.**

To get the Microsoft Teams tool added to your Cotera workspace, please contact our support team at [support.cotera.co](https://support.cotera.co).

***

## Teams & Channels

Discover the teams and channels available to the signed-in user.

### Teams List Joined Teams

List the Microsoft Teams the signed-in user is a member of, including each team's name and identifier.

**Operation Type:** Query (Read)

**Parameters:**

None.

**Returns:**

* **teams** `array`: Array of team objects, each with:
  * **id** `string`: Team identifier
  * **displayName** `string` (nullable): Team display name
  * **description** `string` (nullable): Team description

### Teams List Channels

List the channels within a Microsoft Team to find the channel you want to post to.

**Operation Type:** Query (Read)

**Parameters:**

* **teamId** `string` (required): The team ID (from List Joined Teams) whose channels to list.

**Returns:**

* **channels** `array`: Array of channel objects, each with:
  * **id** `string`: Channel identifier
  * **displayName** `string` (nullable): Channel display name
  * **description** `string` (nullable): Channel description
  * **membershipType** `string` (nullable): Channel membership type (e.g. "standard", "private")
  * **webUrl** `string` (nullable): Web URL for the channel

***

## Channel Messages

Send messages to channels.

### Teams Post Channel Message

Post a message to a channel in a Microsoft Team to share an update with everyone in that channel.

**Operation Type:** Mutation (Write)

**Parameters:**

* **teamId** `string` (required): The team ID (from List Joined Teams).
* **channelId** `string` (required): The channel ID (from List Channels).
* **content** `string` (required): The message content to post.
* **contentType** `string` (nullable, default `"text"`): Message format: `"text"` or `"html"`. Defaults to `"text"`.

**Returns:**

* **id** `string` (nullable): The message ID.
* **webUrl** `string` (nullable): Web URL for the posted message.

***

## Chat Messages

Send messages in one-on-one and group chats.

### Teams Send Chat Message

Send a message to an existing chat, or direct-message a person, for one-on-one and group conversations outside of channels.

**Operation Type:** Mutation (Write)

**Parameters:**

* **content** `string` (required): The message content to send.
* **chatId** `string` (nullable, default `null`): The chat ID to send the message to. Provide either `chatId` or `userId`.
* **userId** `string` (nullable, default `null`): The user ID to send a direct message to. Provide either `chatId` or `userId`. If `userId` is provided, a 1:1 chat is created or reused.
* **contentType** `string` (nullable, default `"text"`): Message format: `"text"` or `"html"`. Defaults to `"text"`.

**Returns:**

* **id** `string` (nullable): The message ID.
* **chatId** `string`: The chat ID the message was sent to.
* **webUrl** `string` (nullable): Web URL for the sent message.

***

## Users

Resolve people in your organization.

### Teams Find User

Find a person in the organization by name or email to resolve their user ID for direct messages.

**Operation Type:** Query (Read)

**Parameters:**

* **query** `string` (required): Name or email fragment to search for.
* **maxResults** `number` (nullable, default `10`): Maximum number of matching users to return.

**Returns:**

* **users** `array`: Array of user objects, each with:
  * **id** `string`: User identifier
  * **displayName** `string` (nullable): User display name
  * **mail** `string` (nullable): User email address
  * **userPrincipalName** `string` (nullable): User principal name (UPN)
  * **jobTitle** `string` (nullable): User job title

***

## Bot Messaging

### Microsoft Teams Send Message

Send a markdown message into a Teams conversation. Supports posting new messages, posting threaded replies, editing a placeholder message in place, and deleting a placeholder when text is empty.

**Operation Type:** Mutation (Write)

**Parameters:**

* **serviceUrl** `string` (required): The Bot Connector service URL for the conversation. Comes from the inbound Teams activity.
* **teamsConversationId** `string` (required): The Teams conversation ID to send the message to. Comes from the inbound Teams activity.
* **text** `string` (required): The markdown message text to send.
* **replyToActivityId** `string` (nullable, default: null): If set, posts the message as a threaded reply under this activity ID.
* **updateActivityId** `string` (nullable, default: null): If set, edits the existing activity in place with the new text. When `text` is empty and this is set, the activity is deleted instead.

**Returns:**

* **ok** `boolean`: Whether the message was sent successfully.
* **activityId** `string` (nullable): The ID of the created or updated activity.

**Example Usage:**

```json
{
  "serviceUrl": "https://smba.trafficmanager.net/amer/",
  "teamsConversationId": "19:abc123@thread.v2",
  "text": "Hello from Cotera! Here is your report.",
  "replyToActivityId": "1:abc123"
}
```

**Behavior Notes:**

* When `updateActivityId` is set and `text` is non-empty: edits the placeholder activity in place.
* When `updateActivityId` is set and `text` is empty: deletes the placeholder activity.
* Otherwise: posts a new message, optionally threaded under `replyToActivityId`.
* The tool may auto-generate text from the input record when text is not explicitly provided.

### Microsoft Teams Update Status

Send a transient typing indicator into a Teams conversation to signal that the bot is working. Best-effort: failures are swallowed and return `ok: false`.

**Operation Type:** Mutation (Write)

**Parameters:**

* **serviceUrl** `string` (required): The Bot Connector service URL for the conversation.
* **teamsConversationId** `string` (required): The Teams conversation ID.
* **status** `string` (required): The status text. An empty string is a no-op and returns `ok: true` without sending anything.

**Returns:**

* **ok** `boolean`: Whether the typing indicator was sent successfully.

**Example Usage:**

```json
{
  "serviceUrl": "https://smba.trafficmanager.net/amer/",
  "teamsConversationId": "19:abc123@thread.v2",
  "status": "Thinking..."
}
```

**Behavior Notes:**

* An empty `status` is a no-op — returns `ok: true` without sending a typing activity.
* A non-empty `status` sends a typing activity via the Bot Connector API.
* Failures are best-effort and return `ok: false` rather than throwing.

