Add chat in a Teams tab app
When you use a scenario-based tab app template to create a new project with Teams Toolkit in Visual Studio Code, the Teams JavaScript client library is automatically installed. Teams Toolkit makes it easy to include native Teams functionality in the tab apps you build.
Suppose you want the users of your app to be able to start a new Teams chat with recipients they've chosen from within your application.
To create this functionality, you can use the following functions in the Teams JavaScript client library:
app.initialize()
: To ensure that the app is fully initialized before you make any calls by using the Teams JavaScript client library.app.getContext()
: To obtain the current context of your app.people.isSupported()
: To ensure that the people capability is supported in the current context.people.selectPeople()
: To display a people picker to the user. The user can then select the participants they want to include in the chat.chat.isSupported()
: To ensure that the chat capability is supported in the current context.chat.openGroupChat()
: To create a new Teams chat for the selected users and take the user directly to the chat.
In the next unit, you'll learn how to create a new Teams app project that contains a tab. You'll use Teams Toolkit in Visual Studio Code and learn how to integrate chat into a tab by using the Teams JavaScript client library.