Adding contacts from Snowflake to Gong Engage

Code

Set your Polytomic API key as an environment variable:

$export POLYTOMIC_API_KEY=YOUR-API-TOKEN

This example covers six steps:

  1. Create a Snowflake Connection.
  2. Create a Gong Connection.
  3. Create a Snowflake model over a custom SQL query.
  4. List the available Gong Engage flows.
  5. List the target fields on a specific flow.
  6. Sync users from Snowflake into a Gong Engage flow.

1. Create a Snowflake connection

The Snowflake instance must be reachable from Polytomic over the network. See the Polytomic IP allowlist for the source addresses to allow.

$ curl --request POST \
> --url https://app.polytomic.com/api/connections \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2024-02-08" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "name": "Snowflake Connection",
> "type": "snowflake",
> "configuration": {
> "account": "uc193736182",
> "username": "user",
> "password": "secret",
> "dbname": "database"
> }
> }'

2. Create a Gong connection

The following request creates a Gong Connection that authenticates through Polytomic Connect’s embedded OAuth modal. You can also run OAuth yourself and pass the client credentials to Polytomic — see the Gong connection configuration for details.

$curl --request POST \
> --url https://app.polytomic.com/api/connections \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2024-02-08" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{"name": "My Gong Connection","type": "gong", "configuration": {"auth_method": "oauth"}}'

If you authenticate to Gong with OAuth instead of an API key, open the URL returned in the auth_url field of the response to complete the flow.

OAuth redirection

By default, the API expects auth_url to open in a new browser window. Set the optional redirect_url parameter in the request body to change the redirect target.

3. Create a Snowflake model

The following request creates a model over a Snowflake query. Replace the query with your own:

$curl --request POST \
> --url https://app.polytomic.com/api/models \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "X-Polytomic-Version: 2024-02-08" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "name": "Active Users",
> "configuration": {
> "query": "SELECT contact_id FROM salesforce_contacts WHERE subscription_plan = 'gold'",
> },
> "connection_id": "YOUR-SNOWFLAKE-CONNECTION-ID"
> }'

4. List the Gong Engage flows

Polytomic can sync to Gong Accounts, People, and Cadences. Every Gong Engage flow appears as a target object:

$curl --request POST \
> --url https://app.polytomic.com/api/connections/YOUR_GONG_CONNECTION_ID/modelsync/targetobjects \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}"

5. List the target fields on a Gong Engage flow

Call the Get Sync Target Fields endpoint to list the target fields available on the flow you plan to sync to. The fields you map in Step 6 come from this set:

$curl -G \
> --url https://app.polytomic.com/api/connections/YOUR_GONG_CONNECTION_ID/modelsync/target/fields \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> --url-query "target=YOUR_GONG_CADENCE_ID"

6. Sync Snowflake contacts into a Gong Engage flow

Adding contacts to a Gong Engage flow requires your CRM’s contact ID — for example, a HubSpot or Salesforce contact ID. You can source that ID from anywhere (including Snowflake, as below), but the ID must also exist in the CRM linked to Gong.

This sync uses the contact_id field from Snowflake to add the matching CRM contacts to a Gong Engage flow. Specify the target flow with target.object:

$curl --request POST \
> --url https://app.polytomic.com/api/syncs \
> --header "accept: application/json" \
> --header "content-type: application/json" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
> -d '{
> "name": "Snowflake to Gong Engage Sync",
> "mode": "updateOrCreate",
> "identity": {
> "source": {
> "field": "contact_id",
> "model_id": "YOUR_SNOWFLAKE_MODEL_ID"
> },
> "target": "Id",
> "function": "equality"
> },
> "schedule": {
> "frequency": "manual"
> },
> "target": {
> "connection_id": "YOUR_GONG_CONNECTION_ID",
> "object": "my-gong-engage-flow"
> }
> }'