@frogbotai/piece-microsoft-teams
v0.42.0
Published
microsoft-teams tools for FrogBot.
Readme
@frogbotai/piece-microsoft-teams
Native Microsoft Graph actions, polling triggers, and Azure Bot channel support for Teams.
Usage
import { defineMicrosoftTeams } from '@frogbotai/piece-microsoft-teams';
const createMicrosoftTeams = defineMicrosoftTeams({
cloud: 'usGovernment',
tenantId: process.env.MICROSOFT_TENANT_ID!,
});
export const microsoftTeams = createMicrosoftTeams({
auth: {
appId: process.env.TEAMS_BOT_APP_ID!,
appPassword: process.env.TEAMS_BOT_APP_PASSWORD!,
},
oauth: {
clientId: process.env.MICROSOFT_GRAPH_CLIENT_ID!,
clientSecret: process.env.MICROSOFT_GRAPH_CLIENT_SECRET!,
},
});defineMicrosoftTeams() defaults to the commercial Microsoft cloud and the common tenant. Select the cloud and tenant when defining the factory so the OAuth authorization URL, token URL, stored credential, account lookup, and all Graph requests use one environment. createMicrosoftTeams is the pre-defined commercial common factory.
Azure Bot credentials and user Graph OAuth are independent. The factory auth config runs the channel adapter. A user's OAuth connection supplies the delegated Graph access token for actions; bot credentials never authorize Graph actions.
Teams channel setup
- Create an Azure Bot and its Microsoft Entra application. Record the application ID and client secret as
appIdandappPassword. - Enable the Microsoft Teams channel on the Azure Bot.
- Set the bot messaging endpoint to
/api/webhooks/<piece-instance-slug>on the public FrogBot URL. The instance is bound to one agent at boot and must have a globally unique slug. - Create or upload a Teams app manifest whose bot ID is the same Azure Bot application ID. Add personal, team, and group chat scopes as needed, then install the app.
- Use
botAppType: 'SingleTenant'withbotTenantIdfor a single-tenant registration. Multi-tenant is the default.
Bot Framework Activities are authenticated by the official Teams adapter. FrogBot does not parse or accept an Activity before that adapter validates its bearer JWT. Live incoming authors may include an email resolved through the conversation-members API; FrogBot matches that normalized email to a local user. A missing email produces an anonymous channel participant and leaves access to the agent's channel access rule.
The separate Graph OAuth app registration uses the scopes below for user actions. It may be the same Entra application only when its bot credential, redirect URI, delegated permissions, and operational ownership are intentionally managed together; the two credentials remain separate in FrogBot configuration.
Agent questions
When an agent with the question tool runs in Teams, each question call appears as one Adaptive Card with the choices, an optional text box, and Submit and Dismiss buttons. The card is replaced in place with the answer and who gave it, and the agent continues in the same conversation. The person who submits is matched to a FrogBot user by the email from the conversation's member list and must pass the agent's access check; others get a private notice. No Microsoft Graph permission is required. See the Microsoft Teams page in the FrogBot docs for the manifest, limits, and troubleshooting.
OAuth scopes
Change the requested scopes with the factory's scopes option: createMicrosoftTeams({ oauth, scopes: ({ defaultScopes }) => [...defaultScopes, 'Chat.Create'] }) adds one, and an array replaces the defaults. microsoftTeamsScopes maps each name to the provider's scope string.
- Always requested:
offline_access,User.Read. - Defaults:
openid,email,profile,Channel.Create,Channel.ReadBasic.All,ChannelMessage.Send,Team.ReadBasic.All,Chat.ReadWrite,ChannelMessage.Read.All,TeamMember.Read.All,User.ReadBasic.All,Presence.Read.All,OnlineMeetingTranscript.Read.All,OnlineMeetingRecording.Read.All. - Also available:
User.Read.All,Team.Create,TeamSettings.Read.All,TeamSettings.ReadWrite.All,Channel.Delete.All,ChannelSettings.Read.All,ChannelSettings.ReadWrite.All,ChannelMember.Read.All,ChannelMember.ReadWrite.All,ChannelMessage.ReadWrite,ChannelMessage.Edit,Chat.Create,Chat.Read,Chat.ReadBasic,ChatMessage.Send,ChatMessage.Read,ChatMember.Read,ChatMember.ReadWrite,TeamMember.ReadWrite.All,Presence.Read,OnlineMeetings.Read,OnlineMeetings.ReadWrite.
Actions
| Upstream action slug | Previous wrapper export | Native action | Notes |
| ---------------------------------------------- | ---------------------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| microsoft_teams_create_channel | microsoftTeamsCreateChannel | createChannel | Standard channel |
| microsoft_teams_send_channel_message | microsoftTeamsSendChannelMessage | sendChannelMessage | Text or HTML |
| microsoft_teams_send_chat_message | microsoftTeamsSendChatMessage | sendChatMessage | Text or HTML |
| microsoft_teams_reply_to_channel_message | microsoftTeamsReplyToChannelMessage | replyToChannelMessage | Thread reply |
| microsoft_teams_create_chat_and_send_message | microsoftTeamsCreateChatAndSendMessage | createChatAndSendMessage | One-to-one or group chat |
| microsoft_teams_create_private_channel | microsoftTeamsCreatePrivateChannel | createPrivateChannel | Private channel |
| microsoft_teams_get_chat_message | microsoftTeamsGetChatMessage | getChatMessage | |
| microsoft_teams_delete_chat_message | microsoftTeamsDeleteChatMessage | deleteChatMessage | Soft delete |
| microsoft_teams_get_channel_message | microsoftTeamsGetChannelMessage | getChannelMessage | Supports replies |
| microsoft_teams_find_channel | microsoftTeamsFindChannel | findChannel | Exact display-name match |
| microsoft_teams_find_team_member | microsoftTeamsFindTeamMember | findTeamMember | Exact email or display-name match |
| microsoft_teams_get_meeting_transcript | microsoftTeamsGetMeetingTranscript | getMeetingTranscript | Lists metadata or returns VTT text; no file is created because the upstream output is text |
| microsoft_teams_get_meeting_recording | microsoftTeamsGetMeetingRecording | getMeetingRecording | Lists or returns metadata; upstream does not download recording bytes |
| request_approval_in_channel | requestApprovalInChannel | Omitted | Activepieces-specific waitpoint action calls run.pause and resumes from an approval URL; durable waits belong to the FrogBot workflow host |
| request_approval_direct_message | requestApprovalDirectMessage | Omitted | Activepieces-specific waitpoint action calls run.pause and resumes from an approval URL; durable waits belong to the FrogBot workflow host |
| custom_api_call | customApiCall | customApiCall | Paths are relative to Microsoft Graph v1.0 in the configured cloud; redirects are not followed |
Triggers
| Upstream trigger slug | Native trigger | Type | Notes |
| ---------------------- | ------------------------- | --------- | ----------------------------------------------- |
| new-channel-message | channelMessageCreated | polling | Uses the Graph delta link as its cursor |
| new-channel | channelCreated | polling | Uses creation time as its cursor |
| new-chat | chatCreated | polling | Uses creation time as its cursor |
| new-chat-message | chatMessageCreated | polling | Uses the Graph delta link as its cursor |
| Bot Framework message | messageReceived | app | Secure shared bot ingress |
| Bot Framework reaction | messageReactionReceived | app | Added and removed reactions |
| Adaptive Card action | cardActionReceived | app | Action.Submit and adaptive-card invokes |
| Conversation update | conversationUpdated | app | Membership and bot-install conversation updates |
| Installation update | installationUpdated | app | Teams app installation changes |
| Dialog open | dialogOpened | app | Task module open invokes |
| Dialog submit | dialogSubmitted | app | Task module submissions |
Polling runs every five minutes. Microsoft Graph does not offer delegated webhooks for this preserved piece contract, so events can arrive after the corresponding Teams activity; delta cursors prevent replay after a successful poll.
