# Microsoft Teams (/integrations/microsoft_teams)





{/* MANUAL-CONTENT-START:intro */}

Use [Microsoft Teams](https://teams.microsoft.com) to read, send, update, or delete chat and channel messages, reply to threads, and add reactions. List teams, chats, channels, and their members to resolve destinations.

Switch to trigger mode to start a workflow from message notifications in a selected chat, or when the outgoing webhook is @mentioned in a channel. To mention a user, wrap the name in `<at>` tags, such as `<at>userName</at>`, and supply the mention details required by the action.

Chat subscriptions request creation and update notifications, but Sim deduplicates them by subscription and message ID within a seven-day window. Later edits may not start a separate workflow run.

{/* MANUAL-CONTENT-END */}

## OAuth scopes [#oauth-scopes]

Sim requests these scopes when someone connects a Microsoft Teams account. For a self-hosted deployment, register your own app with the provider using the settings below. See [Integrations and OAuth](/platform/self-hosting/integrations-oauth) for setup.

| Setting | Value |
| - | - |
| Redirect URI | `<NEXT_PUBLIC_APP_URL>/api/auth/oauth2/callback/microsoft-teams` |
| Environment variables | `MICROSOFT_CLIENT_ID`, `MICROSOFT_CLIENT_SECRET` |

| Scope | Description |
| - | - |
| `openid` | Standard authentication |
| `profile` | Access profile information |
| `email` | Access email address |
| `User.Read` | Sign in and read your profile |
| `Chat.Read` | Read your Teams chat messages |
| `Chat.ReadWrite` | Read and write your Teams chat messages |
| `Chat.ReadBasic` | Read names and members of your Teams chats |
| `ChatMessage.Send` | Send chat messages |
| `Channel.ReadBasic.All` | Read channel names and descriptions |
| `ChannelMessage.Send` | Send channel messages |
| `ChannelMessage.Read.All` | Read channel messages |
| `ChannelMessage.ReadWrite` | Read and write channel messages |
| `ChannelMember.Read.All` | Read team channel members |
| `Group.Read.All` | Read all groups, memberships, and group content |
| `Group.ReadWrite.All` | Read and write all groups |
| `Team.ReadBasic.All` | Read team names and descriptions |
| `TeamMember.Read.All` | Read team members |
| `offline_access` | Access account when not using the application |
| `Files.Read` | Read OneDrive files |
| `Sites.Read.All` | Read documents and list items in all SharePoint sites |

## Use the block [#usage-instructions]

Read, write, update, and delete chat and channel messages. Reply to messages, add reactions, and list teams, chats, channels, and their members. Use trigger mode for message notifications in a selected chat, or an @mention of the outgoing webhook in a channel. Chat subscriptions request creation and update notifications, but Sim deduplicates them by subscription and message ID within a seven-day window. Later edits may not start a separate run. To mention users in messages, wrap their name in `<at>` tags: `<at>userName</at>`

## Actions [#actions]

### Read Microsoft Teams Chat [#read-microsoft-teams-chat]

Read content from a Microsoft Teams chat

<ReferenceDetails>
  #### Input [#input]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `chatId` | string | Yes | The ID of the chat to read from (e.g., "19:abc123def456\@thread.v2" - from chat listings) |
  | `includeAttachments` | boolean | No | Download and include message attachments (hosted contents) into storage |

  #### Output [#output]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Teams chat read operation success status |
  | `messageCount` | number | Number of messages retrieved from chat |
  | `chatId` | string | ID of the chat that was read from |
  | `messages` | array | Array of chat message objects |
  | `attachmentCount` | number | Total number of attachments found |
  | `attachmentTypes` | array | Types of attachments found |
  | `content` | string | Formatted content of chat messages |
  | `attachments` | file\[] | Uploaded attachments for convenience (flattened) |
</ReferenceDetails>

### Write to Microsoft Teams Chat [#write-to-microsoft-teams-chat]

Write or update content in a Microsoft Teams chat

<ReferenceDetails>
  #### Input [#input-1]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `chatId` | string | Yes | The ID of the chat to write to (e.g., "19:abc123def456\@thread.v2" - from chat listings) |
  | `content` | string | Yes | The content to write to the message (plain text or HTML formatted, supports @mentions) |
  | `files` | file\[] | No | Files to attach to the message |

  #### Output [#output-1]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Teams chat message send success status |
  | `messageId` | string | Unique identifier for the sent message |
  | `chatId` | string | ID of the chat where message was sent |
  | `createdTime` | string | Timestamp when message was created |
  | `url` | string | Web URL to the message |
  | `updatedContent` | boolean | Whether content was successfully updated |
  | `files` | file\[] | Files attached to the message |
</ReferenceDetails>

### Read Microsoft Teams Channel [#read-microsoft-teams-channel]

Read content from a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-2]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team to read from (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings) |
  | `channelId` | string | Yes | The ID of the channel to read from (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |
  | `includeAttachments` | boolean | No | Download and include message attachments (hosted contents) into storage |

  #### Output [#output-2]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Teams channel read operation success status |
  | `messageCount` | number | Number of messages retrieved from channel |
  | `teamId` | string | ID of the team that was read from |
  | `channelId` | string | ID of the channel that was read from |
  | `messages` | array | Array of channel message objects |
  | `attachmentCount` | number | Total number of attachments found |
  | `attachmentTypes` | array | Types of attachments found |
  | `content` | string | Formatted content of channel messages |
  | `attachments` | file\[] | Uploaded attachments for convenience (flattened) |
</ReferenceDetails>

### Write to Microsoft Teams Channel [#write-to-microsoft-teams-channel]

Write or send a message to a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-3]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team to write to (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings) |
  | `channelId` | string | Yes | The ID of the channel to write to (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |
  | `content` | string | Yes | The content to write to the channel (plain text or HTML formatted, supports @mentions) |
  | `files` | file\[] | No | Files to attach to the message |

  #### Output [#output-3]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Teams channel message send success status |
  | `messageId` | string | Unique identifier for the sent message |
  | `teamId` | string | ID of the team where message was sent |
  | `channelId` | string | ID of the channel where message was sent |
  | `createdTime` | string | Timestamp when message was created |
  | `url` | string | Web URL to the message |
  | `updatedContent` | boolean | Whether content was successfully updated |
  | `files` | file\[] | Files attached to the message |
</ReferenceDetails>

### Update Microsoft Teams Chat Message [#update-microsoft-teams-chat-message]

Update an existing message in a Microsoft Teams chat

<ReferenceDetails>
  #### Input [#input-4]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `chatId` | string | Yes | The ID of the chat containing the message (e.g., "19:abc123def456\@thread.v2" - from chat listings) |
  | `messageId` | string | Yes | The ID of the message to update (e.g., "1234567890123" - a numeric string from message responses) |
  | `content` | string | Yes | The new content for the message (plain text or HTML formatted) |

  #### Output [#output-4]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the update was successful |
  | `messageId` | string | ID of the updated message |
  | `updatedContent` | boolean | Whether content was successfully updated |
</ReferenceDetails>

### Update Microsoft Teams Channel Message [#update-microsoft-teams-channel-message]

Update an existing message in a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-5]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings or channel info) |
  | `channelId` | string | Yes | The ID of the channel containing the message (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |
  | `messageId` | string | Yes | The ID of the message to update (e.g., "1234567890123" - a numeric string from message responses) |
  | `content` | string | Yes | The new content for the message (plain text or HTML formatted) |

  #### Output [#output-5]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the update was successful |
  | `messageId` | string | ID of the updated message |
  | `updatedContent` | boolean | Whether content was successfully updated |
</ReferenceDetails>

### Delete Microsoft Teams Chat Message [#delete-microsoft-teams-chat-message]

Soft delete a message in a Microsoft Teams chat

<ReferenceDetails>
  #### Input [#input-6]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `chatId` | string | Yes | The ID of the chat containing the message (e.g., "19:abc123def456\@thread.v2" - from chat listings) |
  | `messageId` | string | Yes | The ID of the message to delete (e.g., "1234567890123" - a numeric string from message responses) |

  #### Output [#output-6]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the deletion was successful |
  | `deleted` | boolean | Confirmation of deletion |
  | `messageId` | string | ID of the deleted message |
</ReferenceDetails>

### Delete Microsoft Teams Channel Message [#delete-microsoft-teams-channel-message]

Soft delete a message in a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-7]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings or channel info) |
  | `channelId` | string | Yes | The ID of the channel containing the message (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |
  | `messageId` | string | Yes | The ID of the message to delete (e.g., "1234567890123" - a numeric string from message responses) |

  #### Output [#output-7]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the deletion was successful |
  | `deleted` | boolean | Confirmation of deletion |
  | `messageId` | string | ID of the deleted message |
</ReferenceDetails>

### Reply to Microsoft Teams Channel Message [#reply-to-microsoft-teams-channel-message]

Reply to an existing message in a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-8]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings or channel info) |
  | `channelId` | string | Yes | The ID of the channel (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |
  | `messageId` | string | Yes | The ID of the message to reply to (e.g., "1234567890123" - a numeric string from message responses) |
  | `content` | string | Yes | The reply content (plain text or HTML formatted message) |

  #### Output [#output-8]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the reply was successful |
  | `messageId` | string | ID of the reply message |
  | `updatedContent` | boolean | Whether content was successfully sent |
</ReferenceDetails>

### Get Microsoft Teams Message [#get-microsoft-teams-message]

Get a specific message from a Microsoft Teams chat or channel

<ReferenceDetails>
  #### Input [#input-9]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | No | The ID of the team for channel messages (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID) |
  | `channelId` | string | No | The ID of the channel for channel messages (e.g., "19:abc123def456\@thread.tacv2") |
  | `chatId` | string | No | The ID of the chat for chat messages (e.g., "19:abc123def456\@thread.v2") |
  | `messageId` | string | Yes | The ID of the message to retrieve (e.g., "1234567890123" - a numeric string from message responses) |

  #### Output [#output-9]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the retrieval was successful |
  | `content` | string | The message content |
  | `metadata` | object | Message metadata including sender, timestamp, etc. |
  | ↳ `messageId` | string | Message ID |
  | ↳ `content` | string | Message content |
  | ↳ `createdTime` | string | Message creation timestamp |
  | ↳ `url` | string | Web URL to the message |
  | ↳ `teamId` | string | Team ID |
  | ↳ `channelId` | string | Channel ID |
  | ↳ `chatId` | string | Chat ID |
  | ↳ `messages` | array | Array of message details |
  | ↳ `messageCount` | number | Number of messages |
</ReferenceDetails>

### Add Reaction to Microsoft Teams Message [#add-reaction-to-microsoft-teams-message]

Add an emoji reaction to a message in Microsoft Teams

<ReferenceDetails>
  #### Input [#input-10]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | No | The ID of the team for channel messages (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID) |
  | `channelId` | string | No | The ID of the channel for channel messages (e.g., "19:abc123def456\@thread.tacv2") |
  | `chatId` | string | No | The ID of the chat for chat messages (e.g., "19:abc123def456\@thread.v2") |
  | `messageId` | string | Yes | The ID of the message to react to (e.g., "1234567890123" - a numeric string from message responses) |
  | `reactionType` | string | Yes | The emoji reaction (e.g., ❤️, 👍, 😊) |

  #### Output [#output-10]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the reaction was added successfully |
  | `reactionType` | string | The emoji that was added |
  | `messageId` | string | ID of the message |
</ReferenceDetails>

### Remove Reaction from Microsoft Teams Message [#remove-reaction-from-microsoft-teams-message]

Remove an emoji reaction from a message in Microsoft Teams

<ReferenceDetails>
  #### Input [#input-11]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | No | The ID of the team for channel messages (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID) |
  | `channelId` | string | No | The ID of the channel for channel messages (e.g., "19:abc123def456\@thread.tacv2") |
  | `chatId` | string | No | The ID of the chat for chat messages (e.g., "19:abc123def456\@thread.v2") |
  | `messageId` | string | Yes | The ID of the message (e.g., "1234567890123" - a numeric string from message responses) |
  | `reactionType` | string | Yes | The emoji reaction to remove (e.g., ❤️, 👍, 😊) |

  #### Output [#output-11]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the reaction was removed successfully |
  | `reactionType` | string | The emoji that was removed |
  | `messageId` | string | ID of the message |
</ReferenceDetails>

### List Microsoft Teams Team Members [#list-microsoft-teams-team-members]

List all members of a Microsoft Teams team

<ReferenceDetails>
  #### Input [#input-12]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings) |

  #### Output [#output-12]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `members` | array | Array of team members |
  | `memberCount` | number | Total number of members |
</ReferenceDetails>

### List Microsoft Teams Channel Members [#list-microsoft-teams-channel-members]

List all members of a Microsoft Teams channel

<ReferenceDetails>
  #### Input [#input-13]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings) |
  | `channelId` | string | Yes | The ID of the channel (e.g., "19:abc123def456\@thread.tacv2" - from channel listings) |

  #### Output [#output-13]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `members` | array | Array of channel members |
  | `memberCount` | number | Total number of members |
</ReferenceDetails>

### List Microsoft Teams Chat Members [#list-microsoft-teams-chat-members]

List all members of a Microsoft Teams chat

<ReferenceDetails>
  #### Input [#input-14]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `chatId` | string | Yes | The ID of the chat (e.g., "19:abc123def456\@thread.v2" - from chat listings) |

  #### Output [#output-14]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `members` | array | Array of chat members |
  | `memberCount` | number | Total number of members |
  | `hasMore` | boolean | Whether Graph indicated additional pages beyond this response |
</ReferenceDetails>

### List Microsoft Teams [#list-microsoft-teams]

List the Microsoft Teams the current user is a direct member of

<ReferenceDetails>
  #### Input [#input-15]

  | Parameter | Type | Required | Description |
  | - | - | - | - |

  #### Output [#output-15]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `teams` | array | Array of teams the user is a member of |
  | `teamCount` | number | Total number of teams |
  | `hasMore` | boolean | Whether Graph indicated additional pages beyond this response |
</ReferenceDetails>

### List Microsoft Teams Chats [#list-microsoft-teams-chats]

List the Microsoft Teams chats the current user is part of

<ReferenceDetails>
  #### Input [#input-16]

  | Parameter | Type | Required | Description |
  | - | - | - | - |

  #### Output [#output-16]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `chats` | array | Array of chats the user is part of |
  | `chatCount` | number | Total number of chats |
  | `hasMore` | boolean | Whether Graph indicated additional pages beyond this response |
</ReferenceDetails>

### List Microsoft Teams Channels [#list-microsoft-teams-channels]

List all channels in a Microsoft Teams team

<ReferenceDetails>
  #### Input [#input-17]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `teamId` | string | Yes | The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings) |

  #### Output [#output-17]

  | Parameter | Type | Description |
  | - | - | - |
  | `success` | boolean | Whether the listing was successful |
  | `channels` | array | Array of channels in the team |
  | `channelCount` | number | Total number of channels |
  | `hasMore` | boolean | Whether Graph indicated additional pages beyond this response |
</ReferenceDetails>

## Triggers [#triggers]

A trigger starts a workflow when a supported event occurs in this service.

### Microsoft Teams Channel [#microsoft-teams-channel]

Trigger workflows when the outgoing webhook is @mentioned in a Microsoft Teams channel.

<ReferenceDetails label="Configuration and outputs">
  #### Configuration [#configuration]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `hmacSecret` | string | Yes | The security token provided by Teams when creating an outgoing webhook. Used to verify request authenticity. |

  #### Output [#output-18]

  | Parameter | Type | Description |
  | - | - | - |
  | `from` | object | |
  | ↳ `id` | string | Sender ID |
  | ↳ `name` | string | Sender name |
  | ↳ `aadObjectId` | string | AAD Object ID |
  | `message` | object | |
  | ↳ `raw` | object | |
  | ↳ `attachments` | json | Array of attachments |
  | ↳ `channelData` | object | |
  | ↳ `team` | object | |
  | ↳ `id` | string | Team ID |
  | ↳ `tenant` | object | |
  | ↳ `id` | string | Tenant ID |
  | ↳ `channel` | object | |
  | ↳ `id` | string | Channel ID |
  | ↳ `teamsTeamId` | string | Teams team ID |
  | ↳ `teamsChannelId` | string | Teams channel ID |
  | ↳ `conversation` | object | |
  | ↳ `id` | string | Composite conversation ID |
  | ↳ `name` | string | Conversation name (nullable) |
  | ↳ `isGroup` | boolean | Is group conversation |
  | ↳ `tenantId` | string | Tenant ID |
  | ↳ `aadObjectId` | string | AAD Object ID (nullable) |
  | ↳ `conversationType` | string | Conversation type (channel) |
  | ↳ `text` | string | Message text content |
  | ↳ `messageType` | string | Message type |
  | ↳ `channelId` | string | Channel ID (msteams) |
  | ↳ `timestamp` | string | Timestamp |
  | `activity` | object | Activity payload |
  | `conversation` | object | |
  | ↳ `id` | string | Composite conversation ID |
  | ↳ `name` | string | Conversation name (nullable) |
  | ↳ `isGroup` | boolean | Is group conversation |
  | ↳ `tenantId` | string | Tenant ID |
  | ↳ `aadObjectId` | string | AAD Object ID (nullable) |
  | ↳ `conversationType` | string | Conversation type (channel) |
</ReferenceDetails>

### Microsoft Teams Chat [#microsoft-teams-chat]

Trigger workflows from Microsoft Teams chat message notifications via Microsoft Graph subscriptions. Notifications share a seven-day deduplication window keyed by subscription and message ID, so later edits may not start a separate run.

#### Configuration [#configuration-1]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `triggerCredentials` | string | Yes | This trigger requires microsoft teams credentials to access your account. |
| `triggerChatId` | string | Yes | The ID of the Teams chat to monitor |
| `includeAttachments` | boolean | No | Fetch hosted contents and upload to storage |

#### Output [#output-19]

| Parameter | Type | Description |
| - | - | - |
| `message_id` | string | Message ID |
| `chat_id` | string | Chat ID |
| `from_name` | string | Sender display name |
| `text` | string | Message body (HTML or text) |
| `created_at` | string | Message timestamp |
| `attachments` | file\[] | Uploaded attachments as files |
