Setu Recipes: reusable workflows across every app.Browse templates

Integrations / Microsoft Teams

Microsoft Teams

Read and send Microsoft Teams chat and channel messages through Microsoft Graph. Work and school accounts only.

8 actions OAuth 2 5 read3 write Calls graph.microsoft.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "teams" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
Chat.ReadBasicList your Teams chats
Chat.ReadRead messages in your Teams chats
ChatMessage.SendSend messages in your Teams chats
Team.ReadBasic.AllList the teams you belong to
Channel.ReadBasic.AllList channels in your teams
ChannelMessage.Read.AllRead messages in channels of your teams
ChannelMessage.SendSend messages in channels of your teams
User.ReadIdentify which Microsoft account you connected
offline_accessStay connected without asking you to sign in again

Actions

List channel messagesreadteams.list_channel_messagesRead recent top-level messages in a team channel. Needs admin approval of the ChannelMessage.Read.All permission.

Needs scope: ChannelMessage.Read.All

InputTypeDescription
team_idstringRequiredTeam ID from list_joined_teams
channel_idstringRequiredChannel ID from list_channels
topintegerOptionalNumber of items to return (maximum 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.list_channel_messages",
  input: {
    "team_id": "<team_id>",
    "channel_id": "<channel_id>"
  },
});
List channelsreadteams.list_channelsList the channels of a team with their IDs and names. Needs admin approval of the Channel.ReadBasic.All permission in most organizations.

Needs scope: Channel.ReadBasic.All

InputTypeDescription
team_idstringRequiredTeam ID from list_joined_teams
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.list_channels",
  input: {
    "team_id": "<team_id>"
  },
});
List chat messagesreadteams.list_chat_messagesRead recent messages in one Teams chat, newest first, with sender, time and text.

Needs scope: Chat.Read

InputTypeDescription
chat_idstringRequiredChat ID from list_chats
topintegerOptionalNumber of items to return (maximum 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.list_chat_messages",
  input: {
    "chat_id": "<chat_id>"
  },
});
List chatsreadteams.list_chatsList the user's Teams chats (one-on-one, group and meeting chats) with their IDs, topics and types.

Needs scope: Chat.ReadBasic

InputTypeDescription
topintegerOptionalNumber of items to return (maximum 50)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.list_chats",
  input: {},
});
List joined teamsreadteams.list_joined_teamsList the Microsoft Teams the user belongs to, with their IDs. Needs admin approval of the Team.ReadBasic.All permission in most organizations.

Needs scope: Team.ReadBasic.All

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.list_joined_teams",
  input: {},
});
Reply to channel messagewriteteams.reply_to_channel_messageReply in the thread of an existing channel message as the signed-in user.

Needs scope: ChannelMessage.Send

InputTypeDescription
team_idstringRequiredTeam ID from list_joined_teams
channel_idstringRequiredChannel ID from list_channels
message_idstringRequiredID of the message being replied to, from list_channel_messages
contentstringRequiredMessage text
content_typestringOptionalFormat of content (default text)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.reply_to_channel_message",
  input: {
    "team_id": "<team_id>",
    "channel_id": "<channel_id>",
    "message_id": "<message_id>",
    "content": "<content>"
  },
});
Send channel messagewriteteams.send_channel_messagePost a new top-level message in a team channel as the signed-in user.

Needs scope: ChannelMessage.Send

InputTypeDescription
team_idstringRequiredTeam ID from list_joined_teams
channel_idstringRequiredChannel ID from list_channels
contentstringRequiredMessage text
content_typestringOptionalFormat of content (default text)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.send_channel_message",
  input: {
    "team_id": "<team_id>",
    "channel_id": "<channel_id>",
    "content": "<content>"
  },
});
Send chat messagewriteteams.send_chat_messagePost a message into an existing Teams chat as the signed-in user.

Needs scope: ChatMessage.Send

InputTypeDescription
chat_idstringRequiredChat ID from list_chats
contentstringRequiredMessage text
content_typestringOptionalFormat of content (default text)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "teams.send_chat_message",
  input: {
    "chat_id": "<chat_id>",
    "content": "<content>"
  },
});