This article explains how to hook up webhooks in Firmhouse to a Zapier workflow so that it updates your Klaviyo profiles API. Zapier automates your work by connecting your apps and then moves information between them based on the rules you set.
To get started, you need to create an account with Zapier. Sign up here if you don’t have an account already. Now once you have created an account, log into Zapier to create a Zap. A Zap is an automated workflow that tells your app to perform an action when an event happens. Every Zap has a trigger and one or more actions. A trigger is an event that starts a Zap and an action is what your Zap does for you.
Add a trigger
By using a Zap with a webhook trigger, you can catch information coming from Firmhouse and push that information to Klaviyo.
Click on Create Zap on the top left corner of your Zapier account.
Search for Webhooks by Zapier and press Enter.
Next, click on the event dropdown menu to choose an event, select Catch Hook and click Continue.
Next, you will see a field Pick off a child key. Leave this field empty and click Continue.
The catch hook trigger gives you a unique URL (something like this, https://hooks.zapier.com/hooks/catch/xxxxxxxx/xxxxxxx/) that you can make POST requests to, so that you can copy and paste it into Firmhouse in the next steps.
Configure Webhook in Firmhouse
Now that we have our custom webhook URL generated by Zapier, it is time to create a Firmhouse webhook which will get triggered when someone completes the checkout for a subscription. Follow the steps below to get it done.
Go to your portal in Firmhouse and navigate to Apps section located on the sidebar.
Look for Webhooks and click Configure. You will be taken to the Outgoing webhooks page.
Next, click on New outgoing webhook on the top right corner and fill out the form fields.
In the Name field, enter the name of your webhook. We will use Signed up.
In the Endpoint url field, enter the URL you copied earlier from Zapier.
Leave the Authentication type to none.
In the Event dropdown menu, select Subscription signed up.
Lastly, in the Template field, paste the following snippet. Click here for more Liquid tags that you can use.
"event": "subscription signed up",
Click Save to save the outgoing Webhooks.
This step ensure the trigger works as expected.
To get your test to work correctly, you must first start a subscription in Firmhouse via your regular checkout so that a webhook will trigger towards your Zap.
Next, head over to your Zapier account, click Test trigger.
3. You should at this point see a green tick and a success message that a request was found. Also, you will see a display of the webhook payload or the data it carries.
4. Now click Continue to proceed to the next stage which is setting up an action.
Set up Zap Action
After setting up Zap trigger correctly and passing the test, the next step is to add Action(s) to your Zap. We will be adding two action steps.
Find a subscriber in Klaviyo.
Update subscriber in Klaviyo.
Add Find a Subscriber Event (Choose app and event)
In your Zap editor click on the plus [+] icon underneath the Zap trigger to add a new action.
Search for your action application, in our use case, Klaviyo app. Select Klaviyo.
Click the Event dropdown menu, select Find a subscriber and click continue.
If you already have an account connected to Zapier for Klaviyo app, select it from the account menu.
If not, you will be asked to connect your Klaviyo account. Click on the Sign in button at the far right and you will be taken to a pop up page requesting for your Klaviyo public and private API keys in order to allow Zapier access your Klaviyo account.
Sign in to your Klaviyo app, you can copy/create your API keys from Account Settings.
Copy and paste the API keys on the specified fields in the pop up page and click Yes, Continue.
Set up action
Now your Klaviyo account is connected with Zapier. Click Continue to set up action. This step sets up the data you want to send over to Klaviyo. You will see dropdown menus and/or form fields to fill in. Some fields are required, while others are optional.
First click on the drop down menu of List field and it is a required field, there you will find two options List and Custom, click on List bar and select Newsletter radio button as your option.
Next, click on the Email field which is also required, once done click on Catch Hook in Webhooks by Zapier dropdown menu and select Email to insert data.
Note that the data displayed in the dropdown of Catch Hook in Webhooks by Zapier will depend on the information passed by your outgoing webhook from Firmhouse. For the purpose of this tutorial, we used Email, First and Last name, Event and id. By default Zapier will display the first three data, click Show all options to display all the data.
You will also find an optional Create a new record if the search doesn’t find anything.
Select the Create [item] if it doesn't exist yet? checkbox.
Fill in the fields with the values you want to use for the new record.
Next, click continue.
The final step is to see if your action works as expected. Click on Test action.
2. Add Update subscriber event (Choose app and event)
In the next steps, we will add another action step to the workflow.
Click on the plus [+] icon to add a new action.
First search for Klaviyo app and select it.
In choose app & event dropdown menu, choose an Event by clicking on Event field, select Update subscriber.Click continue.
Click Choose account dropdown and select your Klaviyo account which will be listed in the dropdown menu of Klaviyo account field.
Click Continue to set up action.
Set up action
Click Set up action to display the different fields to fill in.
Click on Subscriber field and then click the Custom tab in the drop down menu.
Click on Find a Subscriber in Klaviyo to expand it. Select ID.
Click outside the drop down box to exit the Subscriber field in order to enter other fields.
Click on the Email field, once done click on Find a Subscriber in Klaviyo dropdown menu and select Email.
Follow the same process for First name and Last name fields.
To test your Zap action, create an updated subscriber and click on Test action. If everything is done correctly, your test will pass and you can now publish your Zap.
Click Publish to automate your workflow.