Showing results for 
Search instead for 
Did you mean: 

Extending Flow with Functions - Part 1

Ever needed to do something in Flow which there isn't already provided in an existing action?

Very often there are packages out there, that we could use to extend our flow with more functionality.


In this article I will show you how to extend flow, using Azure Functions. The technique I'm going to use is:


  1. Create an Azure Function that take some input, does some processing, and returns a result;
  2. Test the function to show how it works as an API;
  3. Write a custom connector, so we can integrate with Flow (and PowerApps);
  4. Use it in Flow

In the first Part of this series, we will create the Azure Function, and in the second part, we will write the custom connector and use it in Flow.


Give me example of what's missing from flow?


A common senario in our flow is we have data - either from our trigger or another action - such as a SharePoint List Item. We then want to transform this into something  else - like the markdown for the body an email, or HTML for web page, or maybe even some json that we going to send into a HTTP action.


So we need something that takes a template, and transform the input to the output - we don't actually have anything in flow.


We could use a compose action, or set variable action, but it is cumbersome, and usually take multiple actions to achieve our output. Even grouping these actions together inside a scope, still just hides the fact that we have to do alot of work inside our flow to transform our data.


But there is very nice little tool - which we use everywhere else - including APIM in Azure - called Liquid Templates!


So in this article, I am going to show, with only a few lines of code, how to get Liquid Template working inside your flow. 


Where did the idea come from? 


A short distraction - OK - I'll be honest, I was watching a video from Ignite on the difference between Logic Apps and Microsoft Flow, and one of the big selling points of Logic Apps is - Liquid templates.


But wait - I use Liquid templates in my Flow's all the time - it one of the most useful actions I have - so I though I would share with you how I got Liquid templates working in my Flow environment, and show you some examples of why it's so useful.


Lets get started - Our Azure Function


The easiest way to get Liquid Templates is use a package from a package library - such as npm. There are number of liquid template packages, the one I'm going to use is liquid-node



This technique will work with most npm modules, or a module from other package managers.


Create our Azure Function


Lets start by creating our Azure Function - login to the Azure Portal, and create a Function App

Create a new function, with the "HTTP trigger" template


Install npm packages

Now we need to get the npm library into the function, so launch kudu on your function from the platform features tab


From Kudu - launch a CMD shell


Change directory to your function app, inside the site\wwwroot directory



First - initialise the npm package.json file, with:

npm init


then, install the npm package
npm install liquid-node


Add Javascript code


Return to your function, and now insert the following JavaScript code:


var Liquid = require('liquid-node');
var engine = new Liquid.Engine;

module.exports = function (context, req) {
    var template = req.body.liquidtemplate;     
    var data = JSON.stringify(\*/g, '¬');      

    engine.parseAndRender(template, JSON.parse(data)).then(
            context.res = {            
                status: 200,                   
                isRaw: true,
                body: result

Here an explaination of the code:


  • require('liquid-node') - tells nodejs to use this module;
  • new Liquid.Engine - creates an instance of the Liquid engine;
  • req.body.liquidtemplate - in the json we receive, the liquid template will be in the liquidtemplateobject;
  • - in the json we receive, the data we want to transform is inside the data object; 
  • engine.parseAndRender - this is the actual work - it takes the template and the data, and transforms it to the output;
  • context.res - this sends the response back.


 Let's test


Lets do a quick test to see if our liquid templates work. So lets take a simple bit of JSON with a person's name it:


  "name": "Mr PowerApp"

Lets change this a html heading


Click on Test and put in our request body, which is the template in liquidtemplate and our info in data, such as:

  		"name": "Mr PowerApp"

 Put this into the test area:

Click Run, and you should see the transformed output:

Great - so now you have seen how to select a library from npm, install it on an Azure Function, add the code to execute the package, and test it.

Lets now integrate into our Power Platform - so our Flow and PowerApps can use it. In the next part of this series, we will create a custom connection, and use it in Flow.

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: and twitter I also write at, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – Youtube channel -