Teneo Developers

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.

Power Automate Calendar bot

Core concepts

  • Backend connector to Power Automate
  • Data Actions
  • Date and Time handling
  • Entities
  • Flow variables
  • Global variables
  • Integration
  • Match requirements
  • Scripts
  • Skip conditions

Solution components

Power Automate integration

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.

Power Automate flow

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.

Getting Started

Prerequisites

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.

Import Power Automate flow

  1. Log in to Power Automate and click on 'My flows' in the sidebar on the left.
  2. Click on 'Import'.
  3. Upload the zip package of the Power Automate flow.
  4. Click on the wrench symbol below 'ACTION' for the Resource Type 'Flow'.
  5. Ensure the 'Setup' is set to 'Create as new' and set a 'Resource name', then save.
  6. Click on the wrench symbol below 'ACTION' for the Resource Type 'Office 365 Outlook Connection'.
  7. Click on your email address on the list and save.
  8. Click on 'Import' and wait for the flow to finish importing.

Set up Power Automate flow

  1. Once it is done, click on 'Open flow'.
  2. Open the flow trigger 'When a HTTP request is received'.
  3. 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.

Power Automate Calendar bot - set up flow 1

  1. Open the last step in the flow, 'Switch'.
  2. You should now see new steps, 'Case' 1-4. Click on the first 'Case'.
  3. 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:

Power Automate calendar bot - set up 2

  1. Repeat for the next case, setting the 'Calendar Id' in the 'Create event (V4)' step in the same way.
  2. 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:

Power Automate calendar bot - set up 3

  1. 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'.
  2. Save your flow.

Enable Power Automate flow

  1. Click on the arrow in the upper left corner next to the flow name to return to the main flow page.
  2. Click on 'Turn on' at the top of the page to enable your flow.

Power Automate calendar bot - enable flow

Add credentials to your solution

There are two global variables in the Teneo solution that you will need to store values for.

Variable NameExample valueDescription
powerAutomateURLhttps://prod-XX.westeurope.logic.azure.com/workflows/XXXX/triggers/manual/paths/invoke/SendMail?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=XXXXXHTTP Post URL from the Power Automate flow trigger 'When a HTTP request is received'.
nTimeZone2Number 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.

Example conversations

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?
User: Teneo
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
User: Yes
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?
User: Tomorrow
Bot: These are the meetings for 2021-07-27:
14:00-15:00: Teneo

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.
User: Teneo
Bot: What day is the meeting scheduled for?
User: Tomorrow
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?
User: 14:30
Bot: Okay, I will update the start time. Do you want to change anything else for this meeting?
User: No
Bot: Do you want me to update the meeting with the following information?
Start time: 14:30 on 2021-07-27
User: Yes
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.
User: Teneo
Bot: What day is the meeting scheduled for?
User: Tomorrow
Bot: Do you want to delete the meeting Teneo on 2021-07-27?
User: Yes
Bot: Your meeting has been deleted.

Solution components

The solution contains the following components: Power Automate calendar bot - solution components

Download

  1. Download the solution Power Automate Calendar bot.
  2. Import the solution into Teneo Studio.
  3. Once the solution has been imported, please make sure to assign the Lexical Resources called 'Teneo Lexical Resource English'.
  4. Download the Power Automate flow Calendarflow.