Integrate Zapier with Matrix

This guide shows you how to integrate Zapier with Matrix, which allows you to 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 guide demonstrates this Zapier configuration process by the example of configuring a Google Sheet in Zapier (via 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.

Prerequisites

For this guide, 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 instance 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 click CONTINUE.

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

  8. Under Find Data, click 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 click CONTINUE.

  4. Under Choose Account, click 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, click 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, click 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 prerequisites above).

  2. Add a new trigger asset through System Management > Trigger Manager.

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

  4. In the Events section, select the Before Status Changed checkbox.

  5. In the Conditions section, add the following conditions and click Save at the lower right:

    • Asset Status Being Changed To

    • Asset is of type

    • Tree Location

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

  7. In the Actions section, choose Call REST Resource and click Save at the lower right.

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

  11. Click Save at the lower right in Matrix 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 (above).

  2. Create a test Page or Standard Page asset within this asset tree.

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

  4. Select Approve and Make Live from the Change Status field and select the Cascade Status Change check box.

  5. Click Save at the lower right 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.

© 2015-2020 Squiz Pty Ltd