Introduction
Jonathan Silva takes us on a journey into the world of Power Automate, focusing on the simplicity of performing basic HTTP requests. In this blog post, we'll explore how Jonathan utilizes the HTTP action to fetch a random joke from GitHub's official Joke API and seamlessly integrates it with Microsoft Teams for a light-hearted interaction.
Setting Up the Flow: Trigger Configuration
- Jonathan uses the new Co-Pilot designer in Power Automate to add an input for the trigger, selecting "email" to send the message to a specific person in Teams.
- This trigger prompts for the recipient's email address each time the flow runs.
Working with HTTP Action
1. Choosing the HTTP Action:
- Jonathan inserts the HTTP action, highlighting that it's a premium connector in Power Automate, requiring a premium license and developer account.
- He emphasizes the variety of HTTP connectors available, choosing the basic one for this example.
2. Configuring the HTTP Action:
- Explaining the significance of passing a URI to the flow, Jonathan demonstrates how to choose the method (GET in this case) and mentions the option to include headers and queries.
- He runs a test to ensure the HTTP action is retrieving data successfully, showcasing the obtained headers, status code, and body (the random joke in this instance).
Parsing JSON for Specific Data
1. Introducing Parse JSON Action:
- Jonathan identifies the need to extract specific values from the retrieved JSON body.
- He adds the "Parse JSON" action, copying the sample payload from the HTTP action's output to extract individual values.
2. Defining Parse JSON Settings:
- Jonathan configures the Parse JSON action by providing the body as input and pasting the copied sample payload.
- This step allows the subsequent actions to access the setup and punchline of the joke separately.
Sending Messages to Microsoft Teams
1. Posting the Setup to Teams:
- Jonathan adds an action to post a message in Teams, using the Flow bot and specifying the recipient's email dynamically from the trigger.
- He includes the joke setup in the message.
2. Adding a Delay:
- Jonathan introduces a delay of 5 seconds before the next action, simulating a pause before revealing the punchline.
3. Posting the Punchline to Teams:
- Another action is added to post a message in Teams, mirroring the previous configuration but sending the punchline this time.
Finalizing and Testing
1. Completing the Flow:
- Jonathan sums up the steps, acknowledging the absence of a clipboard copy feature and the need to recreate each action for subsequent messages.
2. Running the Final Test:
- He initiates a test run, providing the email address when prompted, and demonstrates the quick delivery of a dad joke setup and punchline in Microsoft Teams.
Conclusion
Concluding the tutorial, Jonathan emphasizes the simplicity of executing HTTP requests in Power Automate, especially when integrated with other actions like parsing JSON and posting messages in Teams. The blog post serves as a handy guide for beginners looking to explore the fundamentals of leveraging external APIs within Power Automate for fun and productivity alike.
Want More?
Sign up for the Pragmatic Works' on-demand learning platform to gain access to a wide range of courses, including those related to Microsoft products like Power BI, Power Automate, and Azure.