Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Teams has a number of areas that your application has access to via its API. These are all available via the app.Api object. Here is a short summary of the different areas:
Teams has a number of areas that your application has access to via its API. These are all available via the app.api object. Here is a short summary of the different areas:
| Area | Description |
|---|---|
Conversations |
Gives your application the ability to perform activities on conversations (send, update, delete messages, etc.), or create conversations (like 1:1 chat with a user) |
Meetings |
Gives your application access to meeting details |
Teams |
Gives your application access to team or channel details |
| Area | Description |
|---|---|
conversations |
Gives your application the ability to perform activities on conversations (send, update, delete messages, etc.), or create conversations (like 1:1 chat with a user) |
meetings |
Gives your application access to meeting details |
teams |
Gives your application access to team or channel details |
An instance of the API client is passed to handlers that can be used to fetch details:
Example
In this example, we use the API client to fetch the members in a conversation. The Api object is passed to the activity handler in this case.
In this example, we use the API client to fetch the members in a conversation. The api object is passed to the activity handler in this case.
[Message]
public async Task OnMessage([Context] MessageActivity activity, [Context] ApiClient api)
{
var members = await api.Conversations.Members.Get(context.Conversation.Id);
}
@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
members = await ctx.api.conversations.members.get(ctx.activity.conversation.id)
app.on('message', async ({ activity, api }) => {
const members = await api.conversations.members(activity.conversation.id).get();
});
Proactive API
It's also possible to access the API client from outside a handler via the app instance. Here we have the same example as above, but we're access the API client via the app instance.
const members = await app.Api.Conversations.Members.Get("...");
members = await app.api.conversations.members.get("...")
import * as endpoints from '@microsoft/teams.graph-endpoints';
const res = await app.api.graph.call(endpoints.chats.getAllMessages.get);