Search documentation...

K
ChangelogBook a demoSign up

Trigger syncs with Mage

Overview

Mage provides a native HightouchClient to trigger Hightouch syncs. Check out the Mage's integration documentation for usage details.

Setup

To use Mage to trigger syncs, you need a Hightouch API key.

Create an API key

The first step is to create a Hightouch API key in your Hightouch workspace settings.

  1. From the API keys tab on the Settings page, select Add API key.
  2. Enter a descriptive Name for your key.
  3. Copy your API key and store it in a safe location. The key will only be displayed once.
  4. Click Create API key.
Your API key provides read/write access to sensitive Hightouch resources and should be kept secure. If you believe your API key may have been compromised, revoke it immediately.

Set sync schedule type

For the Mage extension to trigger syncs via the Hightouch API, you must set the syncs' schedules to Manual.

You can do this by going to the Syncs overview page, selecting the particular sync you want to trigger with Mage, and opening the Schedule tab. Here, make sure the Schedule type is set to Manual. You should do this for each sync you want to trigger with Mage.

Manual sync Hightouch UI

You can also find the sync ID on this page, which you need for scheduling syncs in the next step.

A sync ID in the Hightouch UI

Usage

You can then trigger a sync with Mage's HightouchClient:

from mage_ai.services.hightouch.hightouch import HightouchClient

client = HightouchClient(config=dict(api_key='api_key'))
syncs = client.list_syncs()      # Get all the syncs
sync_id = syncs['data'][0]['id'] # Get sync id
client.sync_and_poll(sync_id)    # Trigger sync and poll status

If successful, the output looks like this:

Polling Hightouch Sync [id]. Current status: querying. 0% completed.
Polling Hightouch Sync [id]. Current status: success. 100% completed.
Sync request status: success. Polling complete

Ready to get started?

Jump right in or a book a demo. Your first destination is always free.

Book a demoSign upBook a demo

Need help?

Our team is relentlessly focused on your success. Don't hesitate to reach out!

Feature requests?

We'd love to hear your suggestions for integrations and other features.

Last updated: Mar 13, 2023

On this page

OverviewSetupCreate an API keySet sync schedule typeUsage

Was this page helpful?