Generate QR code within Power Automate

In this post we will learn how to dynamically generate QR code using Power Automate and then send that as a PDF attachment to an email address.

For this post we will use Google Charts API, however note that since this is an external API so you need to check with your organizational data loss prevention policies, data security policies before making any API calls. Additionally, since this is a third-party API, this may be discontinued in the future and hence you may want to plan for this.

The URL to generate a QR code looks as below:

https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=powerplatformguide.blogspot.com

Here we dynamically specify the dimensions of the QR code and its content based on our requirement.

To build such a Flow, we will follow the following steps:

1 - Create an Instant Flow with three user input parameters as below:


2 - Add an action using OneDrive connector to upload a file from URL with parameters as seen below. We need to make sure that the destination file path will be unique, so in this case we are using current timestamp. 

At this stage the QR code is created and stored in your OneDrive. The next steps will email the QR code, however similar steps can be used to use the QR-code image for other purposes.

3 - Use the OneDrive connector to get the file content of the file that we created in the previous step. This is the QR code content and can be used for various scenarios. 

4 - Convert the file content into base64 format using base64() expression.

5 - Create an HTML body and embed QR code using <img> HTML tag

The resulting output will give you a QR-code as seen below:

Comments

  1. hi, thanks for the tutorial, how do i convert in base64 and use it in a img html tag for an email ?
    Kind regards

    ReplyDelete

Post a Comment

Popular posts from this blog

Restrict Attachment control in PowerApps to accept Excel files only

Get start and last date of month using Power Apps