NICK KRAMER: [MUSIC]
Hi. Welcome to Bring Teams
collaboration to your apps by
leveraging Microsoft Graph.
I'm your host Nick Kramer.
We're going to talk about two related topics today.
First is structuring your conversation
inside Microsoft Teams and
the second part is bringing
those structured conversations into your application.
Let me start with structuring
conversations by showing you
a demo we showed at last year's build
and updating it with some of the
new features we've done.
This is the contents
of stock trading out for
investment professionals AKA cTrade.
I'm looking at buying some Fabrikam stock,
but I'm concerned with the impact
of the new steel tariffs.
I'm going to ask our tariff experts about it.
C Trade uses the tags API to identify
our team of tariff experts
and then creates a chat with them.
In that chat, it puts
an adaptive card to provide context about
the stock and adds a tab to the chat
to bring us back to the page with the full information.
C Trade also adds the C Trade bot to the chat.
We're set up for maximum productivity.
Paddy from our tariff team has gotten back to us,
so let's use the bot to complete the trade.
Now that the trade is made we can close out this
help chat and move on to the next thing on a to-do list.
We open the C Trade tab,
which lists all the active conversations
about this trade and we close the chat out.
Note how the chat now disappears from our chat list,
allowing us to declutter and focus on what's next.
That's how C Trade structures
our conversations so that people have
the context they need to make decisions
quickly and focus on what's important.
We saw there an
example of structuring
conversations using those graph APIs.
First, we created a chat
and we added the right people to it.
We installed bots and tabs
into the chat so people could be productive.
We sent messages behind the scenes,
we were reading messages and storing
those conversations into a system
of record and then at the end,
there was an end of life process.
We removed people from the thread,
we hid the chat thread so there was no further need to
clutter up the screen and
then we could delete the chat thread.
That full lifecycle of conversations is supported.
Let's walk through some of the details.
To create the chat API,
it's post/chats and you
need to pass in two key pieces of information.
First, do you want to be a
one-on-one chat or a group chat?
That's the chat types field
and then you pass in the members.
You can pass in either the grid for
the members or you can pass in their UPN,
AKA their e-mail address.
We then install the app into the chat and
this same trick will also work for meetings and
you do post/chats ID/installed
apps and you pass in the object ID,
the grid for the app that you're installing.
Then we pin the tab in the chat.
We did post/chats, ID tabs,
we said what the display name
for the tab was going to be,
C Trade is what it shows at the top of the screen.
We passed in the app ID that we wanted to pin in
the tab and then we passed in
some configuration information for that tab.
We passed in an entity ID that means something to
this particular application and
we passed in the content URL.
A tab is really just an iframe and that content
URL tells the system what to display in that iframe.
Once we got that chat set up,
we send a message using post/chats/ID/messages.
Here is a simple text,
a nice hello world example.
But what we did here was a little more fancy.
We sent our adaptive card,
so full graphics also had
the capability of doing buttons and rich text in there.
Same API call richer payload and adaptive cards are
expressed in the attachment property
and under the attachments is that content field,
which is where your adaptive card markup goes.
After we sent messages,
we also wanted to read the messages back.
That's the get/chats ID/messages.
We've recently added the ability to sort
those messages by created date time.
The default is to sort by last modified date time,
which is great for compliance,
archiving and other bulk messaging scenarios.
But it's not what you want
for these interactive scenarios.
For interactive scenarios, you
want to see it in the same order.
You'd see the messages in teams client,
which is created by date time.
When we enter our end of life phase, we removed members.
It's just delete/chat/ID/members/ID.
Which member do you want to remove?
They're gone. We also hid the thread.
This is a new feature in Teams graph
allowing you to hide the thread for a given user.
Posts/chat/ID hide for user and you pass
in the ID of the user that you want to hide it for.
Each user can have a different view of whether
that particular chat thread is hidden for them or not.
Craft has a rich set of APIs for helping you
direct focus to the most important things.
We just talked about hiding show chat thread.
There's also the ability to mark threads as being
read and mark individual messages as having been read.
You can also at mention a user or a team or
a channel to get their attention and
we've recently added the ability to at mention
the tag so you can create a tag of,
say, all the tariff experts in the team
and then at mention all the tariff experts.
We're also working on the ability to
pin a chat thread to the top of the screen,
to pin a message at the top of a screen,
to mute the chat thread
so that you won't get any notifications
about further messages in
that chat thread and also to delete that chat thread.
That's how we bring structured conversations
into Microsoft Teams.
Now let's talk about how do we bring
those structured conversations into your app?
A good example of this is with Microsoft Teams and Jira.
Teams is a great tool for collaboration
and Jira is a great tool for issue tracking.
But how do you collaborate
about issues with your colleagues?
Well, you could cut and paste.
You could take data out of Jira,
cut and paste it into teams,
send your message, go
back to Jira while you wait for a reply,
and then when the reply gets there,
you switch back to Teams,
you figure out that, no,
they didn't answer the question you
really wanted because you didn't cut and
paste enough information and
you do the whole thing again.
That gets old pretty quick and
our friends at Yasin came up with a better way.
They found a way to integrate
that Team's conversation into Jira.
Let's take a look at how that works.
Here we have a typical
IT support case.
Pradeep has a ticket for
Miriam that her laptop is crashing.
But he needs some more information
from her before he can help.
He creates a new team's chat by using
Yasin and Jira to ask Miriam for further details.
When he does that, Miriam gets a message in
Teams that has not just his question,
but also the context from Jira, the issue title,
the ticket number, and a link
back to the full details in Jira.
Miriam answers without leaving teams,
and Pradeep gets the reply without leaving Jira.
If the issue is reactivated
next week when he's on vacation,
the new agent can even find the conversation they
already had and be instantly up to speed.
[MUSIC] Let's review what we saw.
We saw a way to initiate chats
inside Jira built with those graph APIs.
There's a way to read those messages
inside a chat control.
There is a compose box that lets us send messages,
and there's one more piece you can build that we
didn't see in that last demo,
which is the ability to show a list of chats.
We actually saw that in our first demo being able to
list the chats that are relevant to a particular issue,
not just all the chats that the user has.
Let's talk about the APIs for
building those experiences,
for creating chats,
we've talked about the create chat API,
which you combine with the API for listing people.
Given the first few characters
that you type in for that person,
you call list people to get
the rest of the people that match that string.
There's delegated permissions for all these things.
Application permissions are new,
application permissions are a great way to initiate
a conversation at midnight when
there's no people around,
you can still start a chat thread.
We've also recently added the ability
to start conversations with federated users,
a federated user Is a user who's
not even in your tenant.
So starting cross tenant conversations.
While I focused here on chat,
we also support channels as well for creating.
For the compose box.
Again, we talked about that send message call already.
Replying to channel messages is also something we offer
and that send really
supports the full gamut of what's in teams.
You can do rich text images,
the adaptive cards we saw earlier,
attaching attachments and files.
You can do announcements.
You can do at mentions of users, teams,
and channels and the tags feature
that we talked about earlier.
For building APIs with chat controls.
There's list messages which we saw earlier
with the created date time sort order.
We'll talk in a moment about system messages.
The way to get those messages
that are not sent by a user.
There are things like Fred was added to
the team or Bob renamed this chat.
We also will talk about how to
subscribe to change notifications.
You hear about new messages
after you got that first list of messages.
Then we'll talk about the chat viewpoint,
which is how you read and set,
which chats are read and which are unread.
For system messages, you get them with
the same API you use to get regular messages.
Get slash chats, ID slash messages,
slash ID, and you can sort whatever order you want.
But here I did by creating date time.
When you get those messages,
you'll see a message that has
message type equals system event message,
and then there will be an event
detail field that tells you all the
information that's specific to
that particular system event.
There are about two dozen
different system events we support here.
To learn about new messages.
We create a subscription.
We say we want to hear about changes to slash chats,
slash ID, slash messages.
That's the resource we want updates
for and we pass in a notification URL,
a callback URL to,
here's what you should call when that new message
happens and when we
receive a notification on that callback URL,
what's passed to us is conceptually two things.
First, it's that hint that there is a new message,
but then there's also for this notification at least.
There's also the rich payload that
says not only is there a new message,
here's that new message.
That's stored in the encrypted content field.
When you decrypt it, you get the full information in
the message as if you'd
called get slash messages yourself.
We've been busy adding new types of
resources that you can subscribe to.
One of the most important here is
the ability to get the chat messages.
All of the chat messages for a given user,
previously you can get for
a single thread or for a whole tenant,
and being able to get all of
the chats for a given user is really useful.
There's also an API for getting notifications
about new chat threads, not just messages,
but the threads themselves so you can render
a chat list and update that chat list.
Similarly, there's change notifications now for
membership and for new channels and for new teams.
I mentioned that viewpoint is how you
specify when the message is read or
unread so you can show that to your users
and let them know where to start reading in the chat.
To set the viewpoint.
It's patch, slash chat, slash ID,
slash viewpoint, and you pass in
the date time of the last message read date time.
When you get it, it's get slash chat,
slash ID and it'll be part of
the message payload you get
back under the viewpoint property.
We're continuing to add
new features to build out the scenario.
We're working right now on being able to add reactions,
editing and deleting your messages,
and pinning messages to a chat thread so that
that message appears at the top of the chat window.
We're also working on some performance improvements.
We have rich notification support for
a lot of notifications and subscriptions today.
We are working on
getting support for the remaining scenarios there,
including some scenarios with delegated permissions.
Again, being able to get
that notification and right away know what message
it's talking about without having to make
a second API call to get the message that hinted you to.
Another big one is being able to get
all channel messages and the replies in a single call,
which is much more efficient
than getting the messages and
then call and get replies for
each of the route messages.
Next, let's talk about chat
lists and how to build those.
Obviously, the basics are being able to list
the chat threads and subscribe to new chats.
There's a bunch of useful details,
though, to talk about.
There's last message preview.
We'll talk more about in a minute.
There's being able to subscribe
to those change notifications for
new messages for a given user or for a single chat.
Being able to show and hide a chat comes in
handy when structuring conversations
and the viewpoint comes into play at
the chat list level as well as inside a particular chat.
When we list chats with
last message preview its get slash me slash
chats and then dollar sign
expand equals last message preview.
What that gives us is that first subject or
that first line of text
in that last message in the thread.
It also tells you who sent it and when they
sent it so you can build that full chat list experience.
We're currently working on
the ability to pin a chat thread,
so both pinning a message and pinning a chat thread.
The chat thread goes at the top of
your list of chat threads and being
able to mute a chat thread
allows you to turn off notifications.
When there's additional messages in that muted chat,
you don't get bothered by them.
Let's recap what we saw.
We learned how to structure our conversations in
Microsoft Teams by automating
the lifecycle of those chats.
By creating those chats
automatically adding the right people to them.
Installing apps into those threads
so people can be productive.
We learned how to send and read messages in those chats,
and we learned what to do at the end of
the lifecycle of those chats.
How to delete the thread,
unpin the chat, hide the chat,
and remove members from the chat so people
don't try to keep going with a dead thread.
We then learned how to bring
that structured conversation into your app so
your users don't need to switch
back and forth between apps to be productive.
We built a chat control using
the read chat API that allows you to
read those messages and view what's being sent.
We also built the send experience with
a compose box and
the ability to create those chat threads.
We also learned about chat lists
and how to display those.
Along the way, we learned about
the APIs that are available today in
green and the APIs that are coming soon in yellow.
To learn more about Team's graph,
check out aka.ms/teams-graph-overview.
Thanks for watching. Bring teams collaboration
to your apps by leveraging Microsoft Graph.
I look forward to seeing what you build.