In today’s world, a typical workplace uses quite a few systems on a daily basis. That means our processes normally involve more than one system. When it comes to Automating your processes you sometimes may need to start a zenphi Flow based on an event in another system. That system could be your own in-house system or another existing system out there like, Typeform, CloudMailIn, etc. which provide Webhooks functionality.
The good news is that you connect your systems to zenphi to automate your workflows in just a few steps using Http Trigger. And the better news is that you can leave the complexities of dealing with their JSON payload to zenphi.
Now let’s see how we can do this.
Publish the empty Flow to get the Invocation information of the Http Trigger. Then click on the Http Trigger action to open the configuration panel.
As you can see the Http Trigger comes with three predefined parameters:
- Http Body: This is the body of the incoming Http Call
- Http Method: Indicates the Http Method used to invoke the Http Trigger
- Remote IP: Indicates the IP address of the caller
Click on the Invocation section in the configuration panel to see the url and authentication token which you need to use to start this Flow.
Ways to Call a zenphi HTTP Trigger
You can call a zenphi HTTP Trigger using both HTTP POST and HTTP GET.
Calling HTTP Trigger Using HTTP GET
To call the Trigger using HTTP GET you need to use the same URL displayed in the panel and pass in the Auth Header value as a Query String value for x-zenphi-httptriggertoken.
In our example the url is: https://webhook-zone1.zenphi.io/http/6b599f0d909c4feab96485bb767765dc/495ef720fa29410b94eb2b9c44e2e9fb
So to add the Query String we just need to add ? at the end of the URL followed by x-zenphi-httptriggertoken={your token value (everything after : in the Auth Header textbox)
In summary the structure would be
{URL}?x-zenphi-httptriggertoken={Authentication Token Value}
*Please make sure there is no leading or trailing spaces in the Authentication Token Value, when copy pasting it.
In our example the finished URL would be:
https://webhook-zone1.zenphi.io/http/6b599f0d909c4feab96485bb767765dc/495ef720fa29410b94eb2b9c44e2e9fb?x-zenphi-httptriggertoken=MGI3NWIwNmQtYWEwMC00MTIxLTg3NmYtYzRl
Calling HTTP Trigger Using HTTP POST USING URL
The URL for this method is exactly the same as HTTP GET. Construct the URL as above and use HTTP POST to start the Flow.
Calling HTTP Trigger Using HTTP POST USING AUTH HEADER
Some systems allow you to configure Header Values of a HTTP Call. For those systems add and configure x-zenphi-httptriggertoken Header value to the value Authentication Token Value (as above.
For this Flow we use CloudMailIn as the service starting the Flow. With CloudMailIn, you can easily create an email address, and make a HTTP Call whenever an email is received on the address. It will then pass in all the information about the email through the HTTP Call.
So let’s get a free account and configure an Inbound Email address. When configuring, you need to use the HTTP POST URL of your Flow (which includes the authentication token as a query string value in url). Also, configure the POST format to be JSON – Normalized, then press Next.
Now take a note of the email address provided by CloudMailIn. Whenever you send an email to this address, it will start your Flow.
Let’s head back to our Flow. Add new Log to History action to the Flow and configure it to log Http Body value of the trigger.
Once configured, publish the Flow.
Now send a test email to the email address provided by CloudMailIn to test the Flow. Once sent, it takes a few seconds for a new instance of your Flow to start. You can monitor this in the Recent Runs page.
Click on the new instance of the Flow Run id to see the information Logged.
As you can see the body of the Http Call is logged .
In another post, I’ll show using the Parse JSON action, you can easily transform the JSON payload, in our case the Http Body, into structured data so that you don’t have to deal with the complexities of JSON queries and JSON paths.
Comments ( 2 )
Jackson Avery
March 20, 2021Is Zenphi a Google interface? How can we use Google Automation in Zenphi?
admin
March 22, 2021Hi, zenphi utilizes the same interface structure as Google so that users would feel at home. You can start automating your workflows on Google using zenphi’s Starter tier for free.