Microsoft teams

Learn how to use Microsoft teams with Composio

Overview

SLUG: MICROSOFT_TEAMS

Description

Microsoft Teams integrates chat, video meetings, and file storage within Microsoft 365, providing virtual collaboration and communication for distributed teams

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to Channel.Create,Channel.ReadBasic.All,ChannelMessage.Read.All,ChannelMessage.ReadWrite,ChannelMessage.Send,ChannelSettings.ReadWrite.All,Chat.Create,Chat.Read,Chat.ReadBasic,Chat.ReadWrite,Chat.ReadWrite.All,ChatMessage.Read,ChatMessage.Send,Directory.ReadWrite.All,Group.ReadWrite.All,offline_access,People.Read.All,Presence.ReadWrite,Team.Create,Team.ReadBasic.All,TeamMember.ReadWrite.All,TeamsActivity.Read,TeamsActivity.Send,User.Read,OnlineMeetings.ReadWrite
bearer_token
string

Connecting to Microsoft teams

Create an auth config

Use the dashboard to create an auth config for the Microsoft teams toolkit. This allows you to connect multiple Microsoft teams accounts to Composio for agents to use.

1

Select App

Navigate to [Microsoft teams](https://platform.composio.dev/marketplace/Microsoft teams).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Microsoft teams Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4microsoft_teams_auth_config_id = "ac_YOUR_MICROSOFT_TEAMS_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Microsoft teams: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, microsoft_teams_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Microsoft teams toolkit’s playground](https://app.composio.dev/app/Microsoft teams)

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["MICROSOFT_TEAMS"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Add member to team

Description

Tool to add a user to a microsoft teams team. use when granting or updating membership for a user.

Action Parameters

roles
array
team_id
stringRequired
user_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Archive Teams team

Description

Tool to archive a microsoft teams team. use after confirming the team id; returns 202 if accepted.

Action Parameters

should_set_spo_site_read_only_for_members
boolean
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create online meeting

Description

Use to schedule a new standalone microsoft teams online meeting, i.e., one not linked to any calendar event.

Action Parameters

end_date_time
stringRequired
is_passcode_required
boolean
participants
array
start_date_time
stringRequired
subject
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Team

Description

Tool to create a new microsoft teams team. use when you need to provision a team with optional template, channels, and members.

Action Parameters

description
string
displayName
stringRequired
firstChannelName
string
members
array
template@odata.bind
string
visibility
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Teams team

Description

Tool to delete a microsoft teams team. use after confirming the target team id.

Action Parameters

team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get team channel

Description

Tool to get a specific channel in a team. use after obtaining valid team and channel ids to fetch channel details.

Action Parameters

channel_id
stringRequired
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get chat message

Description

Tool to get a specific chat message. use after confirming chat id and message id.

Action Parameters

chat_id
stringRequired
message_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Team

Description

Tool to get a specific team. use when full details of one team by id are needed.

Action Parameters

team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List message replies

Description

Tool to list replies to a channel message. use after obtaining team, channel, and message ids.

Action Parameters

channel_id
stringRequired
message_id
stringRequired
team_id
stringRequired
top
integerDefaults to 50

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List team members

Description

Tool to list members of a microsoft teams team. use when you need to retrieve the members of a specific team, for auditing or notifications.

Action Parameters

team_id
stringRequired
top
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Chat

Description

Creates a new chat; if a 'oneonone' chat with the specified members already exists, its details are returned, while 'group' chats are always newly created.

Action Parameters

chatType
stringRequired
members
arrayRequired
topic
string

Action Response

data
Required
error
string
successful
booleanRequired

Tool Name: Unarchive Teams team

Description

Tool to unarchive a microsoft teams team. use when you need to restore an archived team to active state.

Action Parameters

team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Teams channel message

Description

Tool to update a message in a channel. use when you need to modify an existing channel message after confirming channel and message ids.

Action Parameters

channel_id
stringRequired
content
stringRequired
content_type
stringDefaults to text
message_id
stringRequired
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Teams chat message

Description

Tool to update a specific message in a chat. use when you need to correct or modify a sent chat message.

Action Parameters

chat_id
stringRequired
content
stringRequired
content_type
stringDefaults to text
message_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Team

Description

Tool to update the properties of a team. use when you need to modify team settings such as member, messaging, or fun settings.

Action Parameters

funSettings
object
memberSettings
object
messagingSettings
object
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all chats

Description

Retrieves all microsoft teams chats a specified user is part of, supporting filtering, property selection, and pagination.

Action Parameters

filter
string
select
array
top
integerDefaults to 50
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all chat messages

Description

Retrieves all messages from a specified microsoft teams chat using the microsoft graph api, automatically handling pagination; ensure `chat id` is valid and odata expressions in `filter` or `select` are correct.

Action Parameters

chat_id
stringRequired
filter
string
select
array
top
integerDefaults to 50

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a channel

Description

Creates a new 'standard', 'private', or 'shared' channel within a specified microsoft teams team.

Action Parameters

description
string
membership_type
stringDefaults to standard
name
stringRequired
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Teams message

Description

Retrieves a specific message from a microsoft teams channel using its team, channel, and message ids.

Action Parameters

channel_id
stringRequired
message_id
stringRequired
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Teams

Description

Retrieves microsoft teams accessible by the authenticated user, allowing filtering, property selection, and pagination.

Action Parameters

filter
string
select
string
top
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List team channels

Description

Retrieves channels for a specified microsoft teams team id (must be valid and for an existing team), with options to include shared channels, filter results, and select properties.

Action Parameters

filter
string
include_shared_channels
boolean
select
string
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List chat messages

Description

Retrieves messages (newest first) from an existing and accessible microsoft teams one-on-one chat, group chat, or channel thread, specified by `chat id`.

Action Parameters

chat_id
stringRequired
top
integerDefaults to 50

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List People

Description

Retrieves a list of people relevant to a specified user from microsoft graph, noting the `search` parameter is only effective if `user id` is 'me'.

Action Parameters

filter
string
orderby
string
search
string
select
string
skip
integer
top
integer
user_id
stringDefaults to me

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Post message to Teams channel

Description

Posts a new text or html message to a specified channel in a microsoft teams team.

Action Parameters

channel_id
stringRequired
content
stringRequired
content_type
stringDefaults to text
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Send message to Teams chat

Description

Sends a non-empty message (text or html) to a specified, existing microsoft teams chat; content must be valid html if `content type` is 'html'.

Action Parameters

chat_id
stringRequired
content
stringRequired
content_type
stringDefaults to text

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reply to Teams channel message

Description

Sends a reply to an existing message, identified by `message id`, within a specific `channel id` of a given `team id` in microsoft teams.

Action Parameters

channel_id
stringRequired
content
stringRequired
content_type
stringDefaults to text
message_id
stringRequired
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired