Service | Microsoft Docs article | Related commit history on GitHub | Change details |
---|---|---|---|
platform | Command Bot In Teams | https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/bots/how-to/conversations/command-bot-in-teams.md | Title: Command bot in Teams description: Learn how a command bot works in Teams, and to add command and responses. -+ ms.localizationpriority: high Microsoft Teams allows you to automate simple and repetitive tasks in a conversa The command bot template is built using the TeamsFx SDK, which provides a simple set of functions over the Microsoft Bot Framework to implement the scenario. Command bot can be used in different scenarios such as checking ticket status, and retrieve help information. **Advantages** You can edit the manifest template file `templates\appPackage\manifest.template. ```JSON "commandLists": [ {+ "scopes": [ + "team", + "groupchat" + ], "commands": [ { "title": "helloWorld", TeamsFx SDK provides a convenient class `TeamsFxBotCommandHandler`, to handle wh ``` You can customize the command, including calling an API, processing data, or any other command .- <br> </details> If you're responding to a command that needs to access Microsoft Graph data of a If you don't have the required SDK, and need to invoke external APIs in your code. The `Teams: Connect to an API` command in Microsoft Visual Studio Code Teams Toolkit extension, or `teamsfx add api-connection` command in TeamsFx CLI can be used to bootstrap code to call target APIs. For more information, see [connect to existing API](../../../toolkit/add-API-connection.md#steps-to-connect-to-api). ## FAQ- <br> <details> For more information on how to add workflow bot Adaptive Card actions to command Follow the [step-by-step](../../../sbs-gs-commandbot.yml) guide to build Teams Command bot. -## See Also +## See also * [Conversation basics](conversation-basics.md) * [Build bots for Teams](../../what-are-bots.md) |
platform | Access Teams Context | https://github.com/MicrosoftDocs/msteams-docs/commits/main/msteams-platform/tabs/how-to/access-teams-context.md | For example, in your app manifest if you set your tab *configurationUrl* attribu ### Get context by using the Microsoft Teams JavaScript library -You can also retrieve the information listed above using the [Microsoft Teams JavaScript client library](/javascript/api/overview/msteams-client) by calling `microsoftTeams.getContext(function(context) { /* ... */ })`. +You can also retrieve the context information using the [Microsoft Teams JavaScript client library](/javascript/api/overview/msteams-client). ++# [TeamsJS v2](#tab/Json-v2) ++ The information can be retrieved by calling `microsoftTeams.app.getContext().then((context) => {/*...*/});`. ++ The following code provides an example of context variable: ++ ```Json + { + "app": { + "host": { + "clientType": "The type of host client. Possible values are android, ios, web, desktop, surfaceHub, teamsRoomsAndroid, teamsPhones, teamsDisplays rigel (deprecated, use teamsRoomsWindows instead)", + "name": "", + "ringId": "The current ring ID", + "sessionId": "The unique ID for the current Teams session for use in correlating telemetry data" }, + "iconPositionVertical": "", + "locale": "The current locale of the user formatted as languageId-countryId (for example, en-us)", + "osLocaleInfo": "", + "parentMessageId": "The parent message ID from which this task module is launched", + "sessionId": "The unique ID for the current session used for correlating telemetry data", + "theme": "The current UI theme: default | dark | contrast", + "userClickTime": "", + "userFileOpenPreference": "" }, + "channel": { + "defaultOneNoteSectionId": "The OneNote section ID that is linked to the channel", + "displayName": "The name of the current channel", + "id": "The channel ID in the format 19:[id]@thread.skype", + "membershipType": "", + "ownerGroupId": "", + "ownerTenantId": "", + "relativeUrl": "The relative path to the SharePoint folder associated with the channel" }, + "chat": { "id": "The chat ID in the format 19:[id]@thread.skype" }, + "meeting": { + "id": "The meeting ID used by tab when running in meeting context" }, + "page": { + "frameContext": "The context where tab URL is loaded (for example, content, task, setting, remove, sidePanel)", + "id": "The developer-defined unique ID for the entity this content points to", + "isFullScreen": "Indicates if the tab is in full-screen", + "isMultiWindow": "The indication whether the tab is in a pop out window", + "sourceOrigin": "", + "subPageId": "The developer-defined unique ID for the sub-entity this content points to" }, + "sharepoint": "The SharePoint context is available only when hosted in SharePoint", + "sharepointSite": { + "domain": "The domain of the root SharePoint site associated with the team", + "path": "The relative path to the SharePoint site associated with the team", + "url": "The root SharePoint site associated with the team" }, + "team": { + "displayName": "The name of the current team", + "groupId": "Guid identifying the current Office 365 Group ID", + "internalId": "The Microsoft Teams ID in the format 19:[id]@thread.skype", + "isArchived": "Indicates if team is archived", + "templateId": "", + "type": "The type of team", + "userRole": "The user's role in the team" }, + "user": { + "displayName": "", + "id": "The Azure AD object id of the current user, in the current tenant", + "isCallingAllowed": "Indicates if calling is allowed for the current logged in user", + "isPSTNCallingAllowed": "Indicates if PSTN calling is allowed for the current logged in user", + "licenseType": "The license type for the current user. Possible values are E1, E3, and E5 enterprise plans", + "loginHint": "A value suitable as a login hint for Azure AD. This is usually the login name of the current user, in their home tenant", + "tenant": { + "id": "The Azure AD tenant ID of the current user", + "teamsSku": "The license type for the current user tenant. Possible values are enterprise, free, edu, unknown" }, + "userPrincipalName": "The principal name of the current user, in the current tenant" } +} +``` ++# [TeamsJS v1](#tab/Json-v1) ++The information can be retrieved by calling `microsoftTeams.getContext(function(context) { /* ... */ })`. The following code provides an example of context variable: -```json +```Json { "teamId": "The Microsoft Teams ID in the format 19:[id]@thread.skype", "teamName": "The name of the current team", The following code provides an example of context variable: } ``` ++ # [TeamsJS v2](#tab/teamsjs-v2) ## TypeScript |