Adding contacts from Snowflake to Gong Engage

Code

Before getting started make sure to set your Polytomic API key as an environment variable:

$export POLYTOMIC_API_KEY=YOUR-API-TOKEN

This example tutorial will cover 6 steps:

  1. Connecting to Snowflake.
  2. Connecting to Gong.
  3. Surfacing user data from Snowflake using a custom SQL query.
  4. Retrieving the list of Gong Engage flows from Gong.
  5. Retrieving the list of target fields for a specific flow.
  6. Adding users from Snowflake to a Gong Engage flow.

1. Create a Snowflake Connection

The Snowflake instance must be network-accessible from Polytomic. You can see Polytomic whitelist IP addresses here.

$ 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 will create a Gong connection using Polytomic Connect’s embedded OAuth modal. You can also handle OAuth yourself and provide the client credentials to Polytomic. See configuration config parameters here.

$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’re using OAuth to authenticate to Gong rather than an API key, you’ll need to follow the link returned in the auth_url parameter in the response

Redirection


By default, the API expects the auth_url to be opened in a new browser window. If you’d like to modify the redirect behavior, there is an optional redirect_url parameter that can be added to the request body.

3. Create a Snowflake data model

The Snowflake query here is an example; you can replace it with any query of 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. Obtain the list of Gong Engage flows

Polytomic can sync to Accounts, People, and Cadences. All Gong Engage flows are listed as target objects.

$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. Retrieve the list of target fields for a Gong Engage flow

To retrieve the list of available target fields for the Gong Engage flow you want to sync to, you can make a call to the Get Sync Target Fields API. The fields you map to in Step 6 below will 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 contacts from your Snowflake model to a Gong Engage flow

When adding contacts to Gong Engage flows, you need to supply your CRM’s contact ID (e.g. HubSpot or Salesforce’s contact ID). These IDs can come from anywhere (including Snowflake, as in this example), but they need to also exist the CRM you integrated Gong with.

This sync uses the id field from Snowflake to add contacts with this ID from HubSpot/Salesforce to a Gong Engage flow.

The Gong Engage flow that you are adding contacts to needs to be specified using the target.object argument:

$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"
> }
> }'