Power Automate
The Power Automate example solution showcases how to connect your Teneo bot with a flow created in Power Automate. The solution contains a Power Automate integration and an example flow that can be used to send an email in Outlook via Power Automate. As the integration source code is embedded in the solution, it can easily be extended or used as a starting point for new methods.
Solution Contents
Power Automate integration
The solution contains a Power Automate backend integration with a method for sending an email in Outlook via Power Automate. This method is used in the example flow, ‘User wants to send email’.
Power Automate flow
The solution uses a flow in Power Automate that is triggered by an HTTP request. Power Automate offers many different actions to be used in flows, meaning this solution can easily be used with other flows to achieve different goals. In this example Power Automate flow, a trigger goes off when the HTTP request is received and the flow goes on to the next step in which the email is sent.
Getting Started
Prerequisites
In order to use this solution, you will need a Power Automate account in which to create a flow. These instructions also assume you have downloaded and imported the Power Automate solution. See instructions below.
Create a Power Automate flow
In this step, we will create a flow in Power Automate that will send out an email when we call on it from our Teneo solution.
Create the flow
- Log in to Power Automate and click on ‘My flows’ in the sidebar on the left.
- Click on ‘New flow’ to see the different options for building a flow. Click on ‘Automated cloud flow’.
- A box will appear where you can give the flow a name and choose the trigger; click on ‘Skip’ for now.
Add the trigger
- Search the list of triggers to find the one named
When an HTTP request is received
. The trigger will be marked with a green [Premium]. - Paste the following JSON into the text field labeled ‘Request Body JSON Schema’:
json
1{
2 "type": "object",
3 "properties": {
4 "emailTo": {
5 "type": "string"
6 },
7 "emailSubject": {
8 "type": "string"
9 },
10 "emailBody": {
11 "type": "string"
12 }
13 }
14}
15
- Click on ‘Show advanced options’. Set the method to POST and the relativePath to
/SendMail
.
Add the email operation
- Click on ‘New step’ and find the action called
Send an email (V2) Office 365 Outlook
not Outlook.com. - Click on the text field where you would write the recipient’s email address; the option to ‘Add dynamic content’ will now have appeared under the text field. Click on this and select the ‘emailTo’ variable. Repeat for the subject and body fields with the relevant variables.
- Save the flow.
Your flow should now look like this:
- Now that you have saved the flow, the HTTP POST URL will appear in the flow trigger 'When a HTTP request is received'. Copy this URL and store it somewhere as it will be needed for the next step.
Add credentials to your solution
There is one global variable in the Teneo Power Automate solution in which you will need to store a URL pointing to your Power Automate flow.
Variable Name | Example value | Description |
---|---|---|
powerAutomateURL | https://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=XXXXX | HTTP Post URL from the Power Automate flow trigger 'When a HTTP request is received'. |
Try it out!
Now that you have created your Power Automate flow and saved the link to it in a global variable in your Teneo solution, it's time to test it all out.
- In your Power Automate flow, click on 'Test' in the upper right corner.
- Select 'Manually'.
- Click on 'Save & Test'.
You will now see the message 'To see it work now, perform the starting action.' This means you can go into Tryout in Teneo Studio and ask it to send an email. Let us test this out by telling the bot the following, I want to send an email
and carrying out the following conversation:
User: I want to send an email
Bot: Who would you like to send the email to?
User: teneo@example.com
Bot: What is the subject of the email?
User: Power Automate
Bot: What would you like your email to say?
User: This is an email from Power Automate.
Bot: Is the following information correct?
To: teneo@example.com
Subject: Power Automate
Message body: This is an email from Power Automate.
User: Yes
Bot: Your email has been sent.
Download
- Download the solution here.
- Import the solution into Teneo. For more details, see How to import solutions.