Ignite Live Blog: THR3040 Microsoft Teams Messaging Extensions Deep Dive

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

Interest and thirst for knowledge around Microsoft Teams has been very strong at Microsoft Ignite. There are many ways that developers can deliver even more productivity to users by extending the out-of-the-box Teams experience. Messaging Extensions are one particular type of custom development that can be used to enhance the conversational experience to create a deep integration to line of business applications.

 

In this theater session Wictor Wilén dived into the technical implementation to show us how to get started developing these Messaging Extensions, some tips and things to watch out for. Wictor has been a driving force in the community in the area of Teams development and is the person behind the popular Yeoman Generator for Teams.

 

Messaging Extensions covers three different ways that Teams behavior can be enhanced:

  1. Search Commands
  2. Action Commands
  3. Link Unfurling

 

Wictor concentrated on Search and Action commands in his demo where he was able to build tighter integration with Planner by developing:

  • A Search Command that enhanced the compose experience making it possible to search for a Planner task and insert the task as an Adaptive Card in the Teams channel.

search-compose-extension.png

 

  • An Action Command that allowed a user to create a Planner task from a chat message and then created an Adaptive Card (linking back to the Planner task).

action-extension.png

 

action-dialog.png

 

For both Search and Action commands the Bot can request that Teams displays a web page (URL) in a dialog. This provides the extension the ability to take full control of the user experience in the dialog and allows for a very rich custom experience. The Yeoman Generator for Teams is the fastest way to get started and through its interactive questions you can specifically create an app and have it scaffold up the pieces needed for a messaging extension.

 

An important architectural concept to grasp when getting started with developing messaging extensions is that they require a Bot to respond to the events that are happening in Teams. Both search and action commands result in a series of requests being sent to a Bot (that is registered via a Teams manifest) to handle the extension. The Bot responds to these various commands with an appropriate JSON response. This flow of requests and responses between the Teams client and the backend Bot is not direct, rather it flows through the Microsoft Bot service. This means that during development the Bot needs to be available on a public URL. To fill this requirement Wictor discussed the ngrok utility that can be used on a development machine to expose your localhost on a public URL. Ngrok also provides a great way to inspect the messages being sent between the Bot framework and your Bot while developing. The ngrok inspector is available while ngrok is running on the development machine and by default can be accessed on http://localhost:4040

 

IMG_7961.JPG

 

The source code used for the demo is available on GitHub http://askwictor.com/THR3040-demo and serves as a great reference for how to:

  • Implement a search command that displays a custom dialog (task module)
  • Implement an action command that displays a custom dialog (task module)
  • Perform an authentication/authorization flow within a messaging extension
  • Creating an Adaptive Card in a Teams channel as a result of interactions with both the search and action commands
  • Utilize an open source middleware library that Wictor has created that makes it far easier to handle the incoming request commands in your Bot and create the correctly formatted responses

 

Further resources:

https://docs.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/what-are-messaging-extensions

https://docs.microsoft.com/en-us/microsoftteams/platform/

 

Written by:

Cameron Dwyer

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.