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 System management  System administrators 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.

  1. 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.

  2. Click Make a Zap! to begin making your Zapier app that populates a Google Sheet with data from Matrix.

  3. In the top-left Name your zap field, enter the name for your Zapier app - e.g. Matrix publication event recorder.

  4. 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.

  5. Click the filtered Webhooks by Zapier application icon.

  6. Under Choose Trigger Event, choose Catch Hook and select CONTINUE.

  7. Under Customize Hook, select CONTINUE.
    (Ignore the other options at this point).

  8. 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.

  1. 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.

  2. Click the filtered Google Sheets application icon.

  3. Under Choose Action Event, choose Create Spreadsheet Row and select CONTINUE.

  4. Under Choose Account, select Sign in to Google Sheets.

  5. In the new browser window, choose your Google Account and Allow Zapier to access this Google Account.

  6. Back in the Zapier window, select CONTINUE under Choose Account.

  7. 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.

  8. 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

  1. 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).

  2. Add a new trigger asset through System management  Trigger manager.

  1. On the Create a new trigger page, specify a Name value of "When a page goes live, send an event to Zapier".

  2. In the Events section, select the Before status changed checkbox.

  3. In the Conditions section, add the following conditions and select Save:

    • Asset status being changed to

    • Asset is of type

    • Tree location

  4. 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.

  5. In the Actions section, choose Call REST resource and select Save.

  6. 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…​.

    • REQUEST BODY - copy and paste the following JSON code snippet into this text field:

          "Region" :""
  7. 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.
  8. ( Optional ) Test that the trigger functions correctly by selecting the RUN TEST checkbox.

  9. 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.

  1. 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).

  2. Follow the instructions in Adding assets to create a standard page asset within this asset tree.

  3. Access the new page asset’s Details screen (if not already visible), and if necessary, select Edit.

  4. Select Approve and make live from the Change status field and select the Cascade status change check box.

  5. 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.