• MarkDataGuy

Planting trees with the HTTP Connector in Power Automate and tree-nation

Hi There,

As some of you know, I am one of the organizers of #DataWeekender and a few days ago, we decided that as a thank you to the speakers of our last conference, we would plant some trees on their behalf. We did this via tree-nation.com and you can view our forest here.

We then decided to keep going with our planting, and we would plant a tree for every talk submission that we received for our CU5 event. Then I wondered if we can automate our tree planting when a submission is received? Tree-nation comes with an API and sessionize, (which we use to manage our call for papers), sends an email whenever a submission is received. PowerAutomate can connect to all sorts of applications including two key things for our automated tree planting, a connector to Office365 emails and the HTTP connector.

My approach to this was to

1) Set up an office365 email connector to my inbox and monitor for emails from the sessionize notification address. (these are in the format event+XXXX@notifications.sessionize.com)

2) Extract the body of the email, and do some work to extract the speaker name, which is in the first line of the email.

3) Connect to tree-nation API to plant a tree

In power automate, our flow looks like this.

Tree-nation supplies API documentation on how to interact with their API and as part of this, you will need to request an API key and your planter id. What took a bit of working out was how to get it working in Power Automate. There are two key aspects.

1) Set up your JSON payload to send to tree-nation. I created a variable to hold this and the content is (Change the bits in bold to suit your needs);



"recipients": [


"name": "Name",

"email": "email"



"planter_id": 123456,

"species_id": 727,

"quantity": 1,

"message": "Thank you @{variables('varSubmitter')} for your submission"



In our case, we set Name, Email, Species id, and planter_id directly in the JSON text, and the name of the user that we are planting a tree on behalf of is referenced via @{variables('varSubmitter')}

2) Set up the HTTP connector

Once you add the HTTP connector, you configure it as follows;

The key thing that took me a few goes to get right (as I am an API rookie) was the Authorization. Make sure that you include the Bearer text as follows


Bearer YourAPITokenFromTreeNation


Once that, everything should be straightforward, and you can enjoy the site of trees appearing in your Forrest.

If you want to use my Power Automate job as a starter you can download it from my github.

I would encourage other organisations to consider supporting tree-nation or similar projects. While swag can be fun, I know that a lot of it ends up in landfills. Instead, consider trees as gifts and if you can automate it as we did, you can get a cool buzz going about your efforts.

Thank you,


60 views0 comments
Original on Transparent.png