Package Exports
- @microsoft/teams-js
- @microsoft/teams-js/dist/MicrosoftTeams.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@microsoft/teams-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Microsoft Teams JavaScript client SDK
Welcome to the Teams JavaScript client SDK! For breaking changes, please refer to our changelog in the current <root>/packages/teams-js directory.
This JavaScript library is part of the Microsoft Teams developer platform. See full SDK reference documentation.
Getting Started
See instructions in the monorepo root for how to clone and build the repository.
Whenever building or testing the Teams client SDK, you can run yarn build or yarn test from the packages/teams-js directory.
Installation
To install the stable version:
npm
npm install --save @microsoft/teams-js
yarn
yarn add @microsoft/teams-js
Production
You can reference these files directly from here or point your package manager at them.
Usage
As a package
Install either using npm or yarn.
If you are using any dependency loader such as RequireJS or SystemJS or module bundler such as browserify, webpack, you can use import syntax to import specific modules. For e.g.
import { app } from '@microsoft/teams-js';As a script tag
Reference the SDK inside of your .html page using:
<!-- Microsoft Teams JavaScript API (via CDN) -->
<script
src="https://res.cdn.office.net/teams-js/2.4.2/js/MicrosoftTeams.min.js"
integrity="sha384-M1BiuUWGXFEu6jscBr/dyRZl4uojmiT5eMSu50lpG3eUyacKjwXE0eWRa2ZIdOmQ"
crossorigin="anonymous"
></script>
<!-- Microsoft Teams JavaScript API (via npm) -->
<script src="node_modules/@microsoft/teams-js@2.4.2/dist/MicrosoftTeams.min.js"></script>
<!-- Microsoft Teams JavaScript API (via local) -->
<script src="MicrosoftTeams.min.js"></script>Dependencies
Teams client SDK depends on Promise type. If you support older browsers and devices which may not yet provide it natively (e.g. IE 11), you need to provide a global polyfill, such as es6-promise, in your bundled application. If you're using a script tag to reference the Teams client SDK, you need to make sure the polyfill is included and initialized before the Teams client SDK is.
Examples
Stay tuned for examples coming soon.
Testing
The Teams Test App is used to validate the Teams client SDK APIs.
Troubleshooting
If the CDN hash value on the npm page is out of date please refer to [here] (https://github.com/OfficeDev/microsoft-teams-library-js/blob/main/packages/teams-js/README.md) for an up to date version. If you notice this problem, please report that issue to us in [GitHub Issues] (https://github.com/OfficeDev/microsoft-teams-library-js/issues)
Contributing
Please be sure to check out the Contributor's guide for crucial steps.