Lecture 42: Build upon the solution for everything - Deploy your first Chatbot to Teams and query/change data in SAP
After you exposed your SAP backend APIs through Azure APIM, you are all set to connect client apps. A chatbot 🤖 is arguably the most interesting one. There are three chatbot implementation options for Chatbots in Microsoft Teams.
Bot Framework SDK | Bot Framework Composer | Power Virtual Agent (PVA) | |
---|---|---|---|
coding style | full-code | low-code | low-code |
programming language | C#, Java, NodeJS and Python | built-in designer with PowerFX scripting language | built-in designer with PowerFX scripting language |
complexity | high, but fully flexible | medium, more freedom than PVA but less than SDK | low |
required dev environment setup | IDE of choice, build-environment (e.g. NPM), simulator, etc. | shipped with Composer studio | built into Microsoft Teams |
We will discuss Bot Framework Composer as part of the lecture.
- Familiarize yourself with this repo and Bot Devblog.
- Setup your Bot Framework Composer development environment including Bot Framework Emulator (Releases -> Assets) and ngrok.
- Create a new Azure Bot
- Add Web platform to app registration on Azure AD of your bot and maintain Redirect Uris
https://token.botframework.com/.auth/web/redirect
. - Configure your bot to perform OAuth login (Access External Resources -> OAuth Login) as you did for 103b. Store your token using bot scope
dialog.myoauth
(be aware of the different scopes and memory of the variables turn, this and dialog!). - Maintain OAuth Connection Settings for AAD v2 on your Azure Bot. Hint: Scopes likely similar to
api://<appid>/SAP.ReadWrite
- Configure your bot with a task that targets your OData API on Azure APIM (Access External Resources -> Send an HTTP request).
- Design an Adaptive Card or use a hero card to present the result to the end-user of the bot. Hint: Use
Send a Response
task with Attachment.
Snippet for hero card and response structure for demo SAP OData service epm_ref_apps_prod_man_srv.
[HeroCard
title = ${dialog.api_response.content.d.Name}
subtitle = ${dialog.api_response.content.d.Price} ${dialog.api_response.content.d.CurrencyCode}
text = ${dialog.api_response.content.d.Description}
image = https://apimngtowelsap.azure-api.net${dialog.api_response.content.d.ImageUrl}
]
- Be able to retrieve SAP data via chatbot, that is Microsoft Teams enabled (e.g. using simulator) and present result within an adaptive card.
- (Optionally) Add interaction to the adaptive card.
- (Optionally) Deploy bot within Teams.