To enable Microsoft Teams as an engagement adaptor, a number of steps need to be followed:
Client-ID
and Client-Secret
from the OAuth ProtocoloauthConnection
along with your appId
and appPassword
of the BotAn Endpoint can be configured to allow communication between Microsoft Teams and ServisBOT. To do so, the EngagementType
and EngagementConfig
must be configured:
For a Teams Bot without OAuth configured:
{
"Address": "myorganization-ClaimsBot",
"OutboundBotReference": "ClaimsBot",
"InboundBotReference": "ClaimsBot",
"Organization": "myorganization",
"Useragent": "useragent",
"EngagementType": "MicrosoftBotFramework",
"EngagementConfig" : {
"Secret": "srn:vault::myorganization:secretdoc:ms-teams-engage",
"Public": {
"TenantId":"" //Your microsoft tenant ID
}
},
"Updated": 1562752374780,
"TargetBotReference": "ClaimsBot",
"Status": "online",
"AllowedDomains": [
"*.production.helium.servismatrix.com",
"*.production.helium.servismatrixcdn.com",
"*.servisbot.com",
"https://servisbot.com"
],
"Name": "myorganization ClaimsBot default endpoint",
"Created": 1562752374780,
"Srn": "srn:botnet:eu-1:myorganization:endpoint:myorganization-ClaimsBot"
}
For a Teams Bot with OAuth Configured:
{
"Address": "myorganization-ClaimsBot",
"OutboundBotReference": "ClaimsBot",
"InboundBotReference": "ClaimsBot",
"Organization": "myorganization",
"Useragent": "useragent",
"EngagementType": "MicrosoftBotFrameworkNativeOAuth",
"EngagementConfig" : {
"Secret": "srn:vault::myorganization:secretdoc:ms-teams-engage",
"Public": {
"TenantId":"" //Your microsoft tenant ID
}
},
"Updated": 1562752374780,
"TargetBotReference": "ClaimsBot",
"Status": "online",
"AllowedDomains": [
"*.production.helium.servismatrix.com",
"*.production.helium.servismatrixcdn.com",
"*.servisbot.com",
"https://servisbot.com"
],
"Name": "myorganization ClaimsBot default endpoint",
"Created": 1562752374780,
"Srn": "srn:botnet:eu-1:myorganization:endpoint:myorganization-ClaimsBot"
}
You will need the URL to your endpoint in order to configure your bot in Azure and MS Teams.
Login into the Azure portal and search or navigate to Bot Services, if you do not already have a Bot Channel registered, click Bot Channels Registration.
Fill out the fields and options to create a registration.
Grab the endpoint ID and add it to our engagement adapter domain. Bot creation on the Azure portal can take some time to build.
The Messaging endpoint takes the form:
https://engagement.<sb-region>.servisbot.com/picard/v1/engage/<endpoint-address>
Example for the current public ServisBot Regions:
https://engagement.eu-1.servisbot.com/picard/v1/engage/myorganization-ClaimsBot
https://engagement.us-1.servisbot.com/picard/v1/engage/myorganization-ClaimsBot
The Bot cannot currently communicate with the web chat.
For a teams bot without OAuth configured:
{
"appId" : "d9b16107-02bd-4af8-80f8-4bbb3d369a7f",
"appPassword" : "secureAppPassword1"
}
For a teams bot with OAuth configured:
{
"appId" : "d9b16107-02bd-4af8-80f8-4bbb3d369a7f",
"appPassword" : "secureAppPassword1",
"oauthConnection" : "myOAuthConnection"
}
The appId
and appPassword
come from the previous steps with the Azure Bot Channel Configuration.
Edit the endpoint and assign your ms teams secret to it
Optional - Add your application ID into the tenantid field
token.botframework.com
Select from one of my existing bots
When using an OAuth enabled Teams Bot, a BaaS api-connector
can be used with the access_token
inside of a Classic Flow Worker.
If we create the following BaaS api-connector
:
{
"Persona": "https://website.com/myimage.png",
"Alias": "graphapime",
"Body": {},
"Created": 1566326362571,
"Description": "A secure graph",
"Endpoint": " https://graph.microsoft.com/v1.0/me",
"Headers": {
"Authorization": "Bearer ${oauthToken}",
"Content-Type": "application/json"
},
"Method": "GET",
"Organization": "flowit",
"RequestMapping": {
"oauthToken": {
"inputPath": "$.accessToken",
"requestParameter": "oauthToken",
"type": "requestHeader"
}
},
"ResponseMapping": {}
}
The BaaS Node can be figured as illustrated:
The access_token
is accessed via msg.event.event.token.contents.private.accessToken
. The response can then be accessed in msg.baas.graphapime
in a subsequent node.
Note: this assumes your Bot is configured with access to the Graph API in the Azure Configuration.