Azure OpenAI-powered chatbot for SAP users, enabling account verification, job status checks, as well as providing maintenance schedule communications.
Unlike traditional bots, where users are constrained to rigid, predefined pathways, this AI assistant provides the flexibility to interact in natural language. It mimics a conversational experience like interacting with a human, making it intuitive and user-friendly. Users can freely express their queries and commands in everyday language, eliminating the need to understand complex code or specific command language.
No more clicking through endless menus or decoding tech jargon. Just type what you need, like checking if your account is locked, finding out the status of a job, or schedule a system maintenance. Just write in plain English in your natural language. It’s as easy as chatting with a friend - quick, straightforward, and no hassle!
Architecture
Greetings in Teams
- Power Platform
- Power Virtual Agent (PVA), to create the bot https://web.powerva.microsoft.com/
- Power Automate Flows: https://make.powerautomate.com/
- Recommended for productive use is separated DEV and PROD environments
- Trial license: https://learn.microsoft.com/en-us/power-apps/maker/signup-for-powerapps
- Azure Subscription
- Azure Trial: https://azure.microsoft.com/en-us/free
- Azure OpenAI Service
- Deployment Guide: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal
- Request Access to OpenAI as described. Request only Text & code models.
- On-Premises Data Gateway
- Deploement Guide: https://learn.microsoft.com/en-us/power-automate/gateway-reference
- SAP System
- Preferable you can use an existing system
- Alternatively you can setup a system quite quickly with the Azure Center for SAP Solutions: https://learn.microsoft.com/en-us/azure/sap/center-sap-solutions/overview
- Follow this documentation: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal
- Once the OpenAI Service is deployed go to Models and deploy the gpt-35-turbo model.
- Retrieve your endpoint URL and Key in "Chat Playground" -> "View code".
- Deploy a Windows VM in a subnet that has access to the SAP systems
- Install the Data Gateway on that VM
-
Login to: https://make.powerautomate.com/
-
Go to Solutions and import the Power Automate Flow.
-
Here you can download the flow as zip file: Download the Power Automate Flow
-
Get your Azure OpenAI URL and API-Key from the Azure Open AI Service Chat playground.
-
URI example: https://[your endpoint].openai.azure.com/openai/deployments/[deployed model name]]/chat/completions?api-version=2023-07-01-preview
-
Edit the Flow
-
Enter the URI and KEY in the respective fields of the HTTP Connector.
-
For now you can enter this directly in clear text. For later production use it's recommended to configure these as secrets and put references to the secrets like seen in the screen shot.
-
In the designer overview you'll see the connections showing errors. These require an update so that it will work in your environment
-
Change the connection references in below steps or delete those not required (e.g. Sharepoint list entry). This is needed because the flow was imported from another environment.
- Get my profile (V2)
- Call SAP function (V2) (For case A, B & C)
- Send an email (V2)
- Post card in chat or channel
- Create item in Sharepoint list (or delete this step if not needed)
-
Change all 3 SAP ERP Connectors
-
Update the JSON connection definition in "SAP System" field to match your SAP system(s).
-
For simplicity there is only one SID per case in the flow.
-
Please follow this documentation to handle mutliple SAP SIDs in each case: Multiple SIDs
-
Also update the connection to your Data Gateway in the "Change connection reference" link
-
Now you can finally save the flow
-
And turn on the flow
-
Login to: https://web.powerva.microsoft.com/ and create a new bot.
-
In the fallback topic paste the code from the provided fallback.yaml file.
-
Download the fallback topic code here: fallback.yaml
-
Open the fallback topic in your bot
-
Open the code editor and enter the code via copy/paste.
-
The last step is to configure your personal bot greeting message into the following 2 topics:
- Greetings
- Reset Conversation
Example:
I’m an AI assistant that helps you with SAP activities.
I can:
A.) Check if your user account exists, determine the roles assigned, and verify if it is locked.
B.) Check the status of an SAP job.
C.) Communicate planned maintenance schedules.
What would you like me to do?
-
Test the Bot:
-
When OK publish the bot:
-
Activate and Open the Bot in Teams
-
Open the Bot in Teams and test:
-
In case of errors most likely the flow failed.
- Check here: https://make.powerautomate.com/ in
- "My Flows"
- "28-days run history"
- "My Flows"
- Check here: https://make.powerautomate.com/ in
-
The logs of the flow run provide helpful error messages.
-
Example with a timeout error:
Contributions to enhance the capabilities are welcome.
This project is licensed under the MIT License.
THE CONTENT OF THIS REPOSITORY IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.