Automating Hightouch Syncs into CI/CD Pipelines with GitHub Actions
Data
General
advanced
This playbook will showcase how you can automate Hightouch Syncs with GitHub Actions to ensure you have fresh data in all of your downstream tools.
Made by:Hightouch
3 minutes
GitHub Actions makes it easy to automate all of your data workflows. It is commonly used to build, test, and deploy code right from GitHub. This allows you to automate data transformation jobs and build data models with tools like dbt.
However, the next step is to get the data from the models to the marketing and business tools that need it. Hightouch can be integrated into GitHub workflows to automatically trigger Syncs during a data workflow. This ensures that as soon as GitHub action is executed, that data is pushed to your downstream destinations.
You can view the Hightouch GitHub Action in the GitHub Marketplace.
If you have a GitHub Action that updates a model of user traits you do not want to have a delay before those traits are updated in your marketing automation platform. This could cause personalized emails to be sent with outdated information or cause an inaccurate notification to trigger.
By integrating Hightouch into this workflow, Hightouch syncs can automatically be triggered once your transformation job is complete. Doing so ensures that the destination tool always has fresh, up-to-date data that mirrors the source of truth.
- Create the following directory in your GitHub repository if it already doesn’t exist:
.github/workflows
- Create a
.yml
file for the workflow. You can name this whatever you like. Example:hightouch_sync_trigger.yml
- Paste the following example snippet into your
.yml
file
name: Hightouch Sync
run-name: Triggering a Hightouch Sync
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
HIGHTOUCH_API_KEY: ${{ secrets.HIGHTOUCH_API_KEY }}
jobs:
trigger-hightouch-sync:
runs-on: ubuntu-latest
name: Trigger Hightouch sync
steps:
- uses: hightouchio/hightouch-github-action@v1.0.2
with:
sync-id: ${{ vars.HIGHTOUCH_SYNC_ID }}
The example above will trigger a Hightouch sync given a sync ID every time the repository is pushed or a pull request is merged. If you prefer to use a sync slug, you can specify sync-slug
as the input instead.
See Workflow syntax for GitHub Actions and GitHub Marketplace: Trigger Hightouch Sync to modify the snippet above.
Configure your GitHub project environment variables and secrets by navigating to your GitHub Project > Settings > Secrets and Variables > Actions
Secret:
HIGHTOUCH_API_KEY
is your Hightouch API key. You can retrieve this in the Hightouch app under Settings > API KeysVariable:
HIGHTOUCH_SYNC_ID
is the sync ID of the sync you’d like to trigger with this Action. You can retrieve this in the Hightouch app on any sync page.Commit and push the repo!
If you want to automate multiple syncs in a single workflow, you can create additional steps and pass multiple sync IDs to trigger multiple syncs within a single workflow.
jobs:
trigger-hightouch-sync:
runs-on: ubuntu-latest
name: Trigger Hightouch sync
steps:
- uses: hightouchio/hightouch-github-action@v1.0.2
with:
sync-id: 10000
- uses: hightouchio/hightouch-github-action@v1.0.2
with:
sync-slug: "all-accounts-to-salesforce"
There are countless ways to integrate Hightouch into your CI/CD pipelines. Including this Action in your GitHub workflows enables seamless Hightouch integration whenever data is ready to be synced to a destination. By having Hightouch integrated into your workflows, you never have to worry about manually invoking a Hightouch sync.