Power Automate Calendar bot
The Calendar bot example solution showcases one way to use the Power Automate backend connector in a Teneo solution containing an integration and flows that can be used to create, get, update, and delete meetings in Office 365 Outlook.
- Backend connector to Power Automate
- Data Actions
- Date and Time handling
- Flow variables
- Global variables
- Match requirements
- Skip conditions
The solution contains a Power Automate backend integration with a method that sends an HTTP Post request with a JSON object to Power Automate, which then carries out the requested action and sends a response back to Teneo so this can be used in the bot output.
The Power Automate flow is triggered by an HTTP request. It contains four different cases for creating, getting, updating, and deleting meetings in Outlook. Which case is used depends on the sAction flow variable that is unique for each of the four Teneo flows.
In order to use this solution, you will need a Power Automate account in which to create a flow.
As the solution uses the calendar function in Office 365 Outlook, you will need to be logged into Outlook.
These instructions also assume you have downloaded and imported the Power Automate solution. See instructions below.
- Log in to Power Automate and click on 'My flows' in the sidebar on the left.
- Click on 'Import'.
- Upload the zip package of the Power Automate flow.
- Click on the wrench symbol below 'ACTION' for the Resource Type 'Flow'.
- Ensure the 'Setup' is set to 'Create as new' and set a 'Resource name', then save.
- Click on the wrench symbol below 'ACTION' for the Resource Type 'Office 365 Outlook Connection'.
- Click on your email address on the list and save.
- Click on 'Import' and wait for the flow to finish importing.
- Once it is done, click on 'Open flow'.
- Open the flow trigger 'When a HTTP request is received'.
- Copy the HTTP Post URL and store it somewhere as you will need it for the next step. This is what the opened trigger looks like; copy the HTTP Post URL by clicking on the 'copy' symbol to the right of the text field.
- Open the last step in the flow, 'Switch'.
- You should now see new steps, 'Case' 1-4. Click on the first 'Case'.
- Click on the first step for this case, 'Get calendar view of events'. The 'Calendar Id' is currently set to 0; click on the X to remove this value, and select the calendar you want to use from the drop-down menu (choose 'Calendar' for your regular default Outlook calendar). This step can be seen in the following picture:
- Repeat for the next case, setting the 'Calendar Id' in the 'Create event (V4)' step in the same way.
- In cases 3 and 4, you will need to set the 'Calendar Id' twice per case. In case 3, set it in the steps 'Get calendar view of events (V3) 2' and 'Delete event (V2)' which you can find inside steps 'Apply to each 2' > 'Condition' > 'If yes'. The second step that you need to set the ID in, i.e. the one inside the 'Apply to each' step, can be seen in this picture:
- In case 4, set the ID in steps 'Get calendar view of events (V3) 3' and 'Update event (V4) 2', which you can find inside steps 'Apply to each 3' > 'Condition 2' > 'If yes'.
- Save your flow.
- Click on the arrow in the upper left corner next to the flow name to return to the main flow page.
- Click on 'Turn on' at the top of the page to enable your flow.
There are two global variables in the Teneo solution that you will need to store values for.
|Variable Name||Example value||Description|
|powerAutomateURL||HTTP Post URL from the Power Automate flow trigger 'When a HTTP request is received'.|
|nTimeZone||2||Number of hours' difference from the Coordinated Universal Time (UTC), used by Power Automate. The example value of 2 is for Central European Time, i.e. UTC+2.|
In this example, the user creates a meeting for the following day:
User: I want to create a meeting.
Bot: What is the subject of the meeting?
Bot: What is the date and start time of the meeting?
User: Tomorrow at 2 pm.
Bot: What is the end time of the meeting?
User: 3 pm
Bot: Is the following information correct?
Meeting subject: Teneo
Start time: 14:00 on 2021-07-27
End time: 15:00 on 2021-07-27
Bot: Your meeting has been created.
The bot can retrieve a list of meetings for a specified date; here, it lists the one that was just created:
User: Please show me my meetings
Bot: What day do you want to see the meetings for?
Bot: These are the meetings for 2021-07-27:
The user can change the subject, start time, or end time of any of their meetings:
User: I want to update a meeting
Bot: What is the subject of the meeting you want to update? Please note that this is case sensitive.
Bot: What day is the meeting scheduled for?
Bot: What part of the meeting do you want to update: subject, start time, or end time?
User: Start time
Bot: What would you like to change the start time to?
Bot: Okay, I will update the start time. Do you want to change anything else for this meeting?
Bot: Do you want me to update the meeting with the following information?
Start time: 14:30 on 2021-07-27
Bot: Your meeting has been updated.
Finally, the user can also delete meetings:
User: Delete meeting
Bot: What is the subject of the meeting you want to delete? Please note that this is case sensitive.
Bot: What day is the meeting scheduled for?
Bot: Do you want to delete the meeting Teneo on 2021-07-27?
Bot: Your meeting has been deleted.
The solution contains the following components: