Use Zapier to automate activities from events in Matrix
This tutorial shows you how to integrate Zapier with Matrix, which lets you automate workflows in a vast array of third-party applications using events triggered in Matrix, such as when a page is published live or when the page’s workflow status is changed.
Since Zapier provides automated workflows for a vast array of applications, this tutorial demonstrates this Zapier configuration process by the example of configuring a Google Sheet in Zapier (through a Zapier app) for a Matrix trigger. The publication of a page in a Matrix site results in Zapier recording this event’s data as a row in the Google Sheet.
Before you start
For this tutorial, you will require:
-
A Zapier service with a Zapier account - using your Zapier account, you will create a Zapier app and configure this app to handle an event triggered from Matrix.
For more information about Zapier’s pricing plans, consult their pricing page. Note also Zapier’s Terms of Service and Privacy Policy, as well as their help documentation. -
A Google account with a new/unedited Google Sheet that will be used and populated by your Zapier app. Provide this Google Sheet with an appropriate name - e.g.
Matrix publication events
and add the following 'field' names along the top row of the default worksheet (e.g.Sheet1
):
-
Date
-
Title
-
Summary
-
URL
-
Author
-
Region.
-
A Matrix system on which to configure a trigger for your Zapier app - your Matrix account type must be system administrator and your user account located within the
user group.
-
Create your Zapier app for integration with Matrix
These procedures describe how to create your Zapier app (or "Zap"), for integration with Matrix. In this case, your Zap is a Zapier webhook event handler (for Matrix events) and Google Sheet, whose content is populated by data in Matrix.
Configure the Zapier app’s webhook event handler
This configuration process of the Zapier app is common to all Zaps you want to integrate with Matrix, where the Zap is executed by an event triggered in Matrix.
-
Ensure you have logged in to your Zapier account. Upon successfully logging/signing in to Zapier, you should see the Dashboard tab of the Home page.
-
Click Make a Zap! to begin making your Zapier app that populates a Google Sheet with data from Matrix.
-
In the top-left Name your zap field, enter the name for your Zapier app - e.g.
Matrix publication event recorder
. -
In the When this happens > Choose App & Event field, start typing the name of the Zapier application (i.e.
Webhooks by Zapier
) that will handle the Matrix event to acquire data (for your Google Sheet) from this event. -
Click the filtered Webhooks by Zapier application icon.
-
Under Choose Trigger Event, choose Catch Hook and select CONTINUE.
-
Under Customize Hook, select CONTINUE.
(Ignore the other options at this point). -
Under Find Data, select SKIP TEST.
(Ignore the test at this point since Matrix will be configured later).
Keep the page open.
Configure the Zapier app’s Google Sheet manipulation process
This configuration process of the Zapier app is specific to the action you want your Zap to perform, based on the event triggered in Matrix.
-
In Do this > Choose App & Event section of the page, start typing the name of the application (i.e.
Google Sheets
) to which Zapier will populate data from the Matrix event. -
Click the filtered Google Sheets application icon.
-
Under Choose Action Event, choose Create Spreadsheet Row and select CONTINUE.
-
Under Choose Account, select Sign in to Google Sheets.
-
In the new browser window, choose your Google Account and Allow Zapier to access this Google Account.
-
Back in the Zapier window, select CONTINUE under Choose Account.
-
In Customize Spreadsheet Row, choose:
-
Your Google Drive (if necessary),
-
Your Google Sheet under Spreadsheet (e.g.
Matrix publication events
) and -
Your default Worksheet (e.g.
Sheet1
) and observe that the pre-configured fields in the top row of your Google Sheet’s default worksheet appear below:-
Date
-
Title
-
Summary
-
URL
-
Author
-
Region.
-
-
-
Under Send Data, select SKIP TEST. (Again, ignore the test at this point since Matrix will be configured later).
You should now see a message indicating that your Zap is ready.
However, do not turn on your Zapier app at this stage.
You will now configure Matrix to trigger the event that will be handled by your Zapier app.
After configuring this trigger, you can then re-test the steps you skipped above and then turn on your Zapier app.
Keep this page open.
Configure your Matrix trigger for Zapier
-
Ensure you are logged in to your Matrix site in admin mode as a user with the system administrator account type (according to the Before you start section above).
-
Add a new trigger asset through .
-
On the Create a new trigger page, specify a Name value of "When a page goes live, send an event to Zapier".
-
In the Events section, select the Before status changed checkbox.
-
In the Conditions section, add the following conditions and select Save:
-
Asset status being changed to
-
Asset is of type
-
Tree location
-
-
Choose the following values for these conditions:
-
Asset status being changed to - select Live.
-
Asset is of type > Match any one of these types: choose Page and select the Inherit checkbox.
-
Tree location - select the site or part of the site where you want pages going live to trigger the notification.
-
-
In the Actions section, choose Call REST resource and select Save.
-
In the Call REST resource section, set the following field values:
-
METHOD - choose POST.
-
URL(S) - copy the Custom Webhook URL value from the top Catch Hook > Customize Hook Zapier app configuration web page you left open (above) and paste this value into the first of these fields in Matrix. Your URL should begin with
https://hooks.zapier.com/hooks/catch/…
. -
REQUEST BODY - copy and paste the following JSON code snippet into this text field:
{ "Date":"%globals_asset_updated%", "Title":"%globals_asset_name%", "Summary":"%globals_asset_attribute_summary%", "URL":"%globals_asset_url%", "Author":"%globals_asset_updated_by_name%", "Region" :"%globals_asset_metadata_client.news.region%" }
-
-
At the top of the page, change the Status of the trigger to Enabled, which makes the trigger live.
This JSON code snippet makes extensive use of Matrix keyword replacements. Read more about how to configure other element values of this request body in the Keyword Replacements section of the Matrix documentation. -
( Optional ) Test that the trigger functions correctly by selecting the RUN TEST checkbox.
-
Click Save to save changes to the trigger.
Confirm that the Zapier app’s integration with Matrix is correctly configured
Although you may have selected the RUN TEST checkbox when you saved your trigger (above), which returned a non-erroneous value within Matrix, you should confirm that your Zapier app is configured correctly with Matrix and generates the correct keyword replacement values from Matrix in your Google Sheet.
-
Ensure you are logged in to your Matrix site in admin mode as a user with admin access to your site’s asset tree specified in Tree location (in the previous tutorial step).
-
Follow the instructions in Adding assets to create a standard page asset within this asset tree.
-
Access the new page asset’s Details screen (if not already visible), and if necessary, select Edit.
-
Select Approve and make live from the Change status field and select the Cascade status change check box.
-
Select Save to save the status change update to the page and observe the row added to your Google Sheet. Amongst other keyword replacement values, confirm that this row contains the correct
%globals_asset_name%
and%globals_asset_url%
keyword replacement values.