Saturday 4 January 2020

Ask Alexa to search for a Microsoft Team – Integration of Amazon Alexa Skill with MS Team using Azure Functions and Graph API

The article helps understand how to integrate your Amazon Alexa with Microsoft team using Azure functions and Microsoft Graph API. The use case demonstrated here is finding a team on Microsoft Teams via Alexa. You can implement plenty of use cases.

This requires the following components.
  • Amazon's Alexa developer console for testing, and Alexa device for real demo.
  • Azure Subscription - Azure function to host request/response code for Alexa device, which integrates with Microsoft Graph API
  • Office 365 tenant - with Microsoft Teams enabled. 


Configure Skills on Alexa Console


From the Amazon Alexa console (https://developer.amazon.com/alexa/console/ask), create a custom skill. The following steps has to be created on the console.
  • Create invocation utterance - This is the skill invocation keywords on Alexa. In my case, invocation would be “team finder”
Invocation your skill by saying team finder
Invocation your skill by saying team finder


  • Create intent with sample utterances. In my case, the intent is “teaminformation”, and the following are few samples.
    • From the utterances, mark and create a intent slot “teamname”.
Few/Sample utterances to find a Microsoft Team
Few/Sample utterances to find a Microsoft Team

  • Create a slot type called “teamnames” and map this slot type to the intent slot created above. In the “teamnames” slot type, add necessary team names.
Team Names added for recognition
Team Names added in slot for recognition

  • In the endpoint section, provide the Azure function endpoint. This has to be done after creating the function, which is explained below in this article.


Create/Deploy Azure Function with Graph API integration


From the Azure portal, create an Azure function with anonymous access rights. The function uses .net platform. This needs to be customized, so that our custom intent type is considered for the request and responses. The request/response code on Azure function,
  • should be able to receive and identify the intent, and necessary team names
  • Then team name is passed on to Microsoft Graph API to search/find the team details.
  • The API used for finding MS Team would be https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team') and displayName eq '" + teamSlot + "'"

The following request/response code shows the Azure function for our Alexa custom skill.


The following code snippet shows the helper function to integrate with Graph API for finding teams.

Deploy the Azure function and copy the function URL.

Note: The entire function could be found on the github portal https://github.com/nakkeerann/MicrosoftTeamFinder-for-Alexa


Ask Alexa (Test your Alexa Skill)


  • Now make sure, you have necessary teams provisioned on Microsoft Teams. In my case, I have multiple teams.
  • Now, go back to Alexa custom skill and add the end point as shown below.

Azure endpoint which has request/response code - configured
Azure endpoint which has request/response code - configured

  • Save the end point. Now save and build the model from utterance or intent configuration screen.
  • Turn on your Alexa and start testing. In my case, I have attached the test snapshot from the Amazon Aelxa console test screen.
Ask your Alexa to find a team on the Microsoft Teams Tenant
Ask your Alexa to find a team on the Microsoft Teams Tenant