> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://apidocs.polytomic.com/2024-02-08/guides/code-examples/adding-contacts-from-snowflake-to-gong-engage/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server. ## Code Set your Polytomic API key as an environment variable: ```bash 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](/guides/ip-whitelisting) for the source addresses to allow. #### cURL ```bash 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" } }' ``` #### Python ```python import os from polytomic.client import Polytomic client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.connections.create( name="Snowflake Connection", type="snowflake", configuration={ "account": "uc193736182", "username": "user", "password": "secret", "dbname": "database" } ) print(resp.data) ``` #### Typescript ```typescript import { PolytomicClient } from 'polytomic'; const polytomic = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.connections.create({ name: "Snowflake Connection", type: "snowflake", configuration: { account: "uc193736182", username: "user", password: "secret", dbname: "database" }, }).then((res) => { console.log(res) }) ``` #### Go ```golang import ( "context" "fmt" polytomic "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "github.com/polytomic/polytomic-go/option" ) client := polytomicgoclient.NewClient( option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")), ) resp, err := client.Connections.Create( context.TODO(), &polytomic.CreateConnectionRequestSchema{ Name: "Snowflake Connection", Type: "snowflake", Configuration: map[string]interface{}{ "account": "uc193736182", "username": "user", "password": "secret", "dbname": "database", }, }, ) if err != nil { panic(err) } fmt.Println(resp) ``` ## 2. Create a Gong connection The following request creates a Gong Connection that authenticates through Polytomic Connect's [embedded OAuth modal](/guides/embedding-authentication). You can also run OAuth yourself and pass the client credentials to Polytomic — see the [Gong connection configuration](/guides/configuring-your-connections/connections/gong) for details. #### cURL ```bash 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"}}' ``` #### Python ```python import os from polytomic.client import Polytomic client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.connections.create( name="My Gong Connection", type="gong", configuration={ "auth_method": "oauth" } ) print(resp.data) ``` #### Typescript ```typescript import { PolytomicClient } from 'polytomic'; const polytomic = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.connections.create({ name: "My Gong Connection", type: "gong", configuration: { auth_method: "oauth" }, }).then((res) => { console.log(res) }) ``` #### Go ```golang import ( "context" "fmt" polytomic "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "github.com/polytomic/polytomic-go/option" ) client := polytomicgoclient.NewClient( option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")), ) resp, err := client.Connections.Create( context.TODO(), &polytomic.CreateConnectionRequestSchema{ Name: "My Gong Connection", Type: "gong", Configuration: map[string]interface{}{ "auth_method": "oauth", }, }, ) if err != nil { panic(err) } fmt.Println(resp) ``` 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 ```bash 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" }' ``` #### Python ```python import os from polytomic.client import Polytomic client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.models.create( name="Active Users", configuration={ "query": "SELECT contact_id FROM salesforce_contacts WHERE subscription_plan = 'gold'", }, connection_id="YOUR-SNOWFLAKE-CONNECTION-ID" ) print(resp.data) ``` #### Typescript ```typescript import { PolytomicClient } from 'polytomic'; const polytomic = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.models.create({ name: "Active Users", configuration: { query: "SELECT contact_id FROM salesforce_contacts WHERE subscription_plan = 'gold'", }, connection_id: "YOUR-SNOWFLAKE-CONNECTION-ID", }).then((res) => { console.log(res) }) ``` #### Go ```golang import ( "context" "fmt" polytomic "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "github.com/polytomic/polytomic-go/option" ) client := polytomicgoclient.NewClient( option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")), ) resp, err := client.Models.Create( context.TODO(), &polytomic.CreateModelRequest{ Name: "Active Users", Configuration: map[string]interface{}{ "query": "SELECT contact_id FROM salesforce_contacts WHERE subscription_plan = 'gold'", }, ConnectionId: "YOUR-SNOWFLAKE-CONNECTION-ID", }, ) if err != nil { panic(err) } fmt.Println(resp) ``` ## 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 ```bash 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}" ``` #### Python ```python import os from polytomic.client import Polytomic client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.model_sync.get_target_objects( id="YOUR_GONG_CONNECTION_ID", ) print(resp.data) ``` #### Typescript ```typescript import { PolytomicClient } from 'polytomic'; const polytomic = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.modelSync.getTargetObjects( "YOUR_GONG_CONNECTION_ID" ).then((resp) => { console.log(resp); }) ``` #### Go ```golang import ( "context" "fmt" polytomic "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "github.com/polytomic/polytomic-go/option" ) client := polytomicgoclient.NewClient( option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")), ) resp, err := client.ModelSync.GetTargetObjects( context.TODO(), "YOUR_GONG_CONNECTION_ID", ) if err != nil { panic(err) } fmt.Println(resp) ``` ## 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 ```bash 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" ``` #### Python ```python import os from polytomic.client import Polytomic client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.model_sync.get_target_fields( id="YOUR_GONG_CONNECTION_ID", target="YOUR_GONG_ENGAGE_FLOW_ID" ) print(resp.data) ``` #### Typescript ```typescript import { PolytomicClient } from 'polytomic'; const client = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.modelSync.getTargetFields("YOUR_GONG_CONNECTION_ID", { target: "YOUR_GONG_ENGAGE_FLOW_ID }).then((resp) => { console.log(resp); }) ``` #### Go ```golang import ( option "github.com/polytomic/polytomic-go/option" polytomicgo "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "context" "fmt" ) client := polytomicgoclient.NewClient( option.WithToken("POLYTOMIC_API_KEY"), ) response, err := client.ModelSync.GetTargetFields( context.TODO(), "YOUR_GONG_CONNECTION_ID", &polytomicgo.ModelSyncGetTargetFieldsRequest{ Target: "YOUR_GONG_ENGAGE_FLOW_ID" }, ) if err != nil { panic(err) } fmt.Println(resp) ``` ## 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 ```bash 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" } }' ``` #### Python ```python import os from polytomic.client import Polytomic from polytomic import ModelSyncField, Source, Identity, Schedule, ScheduleFrequency, Target client = Polytomic( token=os.getenv("POLYTOMIC_API_KEY"), ) resp = client.model_sync.create( name="Snowflake to Gong Engage Sync", mode="updateOrCreate",p identity=Identity( source=Source( field= "contact_id", model_id= "YOUR_SNOWFLAKE_MODEL_ID" ), target="Id", function="equality" ), schedule=Schedule( frequency=ScheduleFrequency.MANUAL, ), target=Target( connection_id="YOUR_GONG_CONNECTION_ID", object="my-gong-engage-flow" ) ) print(resp.data) ``` #### Typescript ```typescript import { Polytomic, PolytomicClient } from 'polytomic'; const polytomic = new PolytomicClient({ token: "POLYTOMIC_API_KEY", }); polytomic.modelSync.create({ name: "Snowflake to Gong Engage Sync", mode: "create", identity: { source: { field: "contact_id", model_id: "YOUR_SNOWFLAKE_MODEL_ID" }, target: "Id", function: "equality" }, schedule: { frequency: Polytomic.ScheduleFrequency.Continuous }, target: { connection_id: "YOUR_GONG_CONNECTION_ID", object: "my-gong-engage-flow" } }).then((resp) => { console.log(resp); }) ``` #### Go ```golang import ( "context" "fmt" polytomic "github.com/polytomic/polytomic-go" polytomicgoclient "github.com/polytomic/polytomic-go/client" "github.com/polytomic/polytomic-go/option" ) client := polytomicgoclient.NewClient( option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")), ) resp, err := client.ModelSync.Create( context.TODO(), &polytomic.CreateModelSyncRequest{ Name: "Snowflake to Gong Engage Sync", Identity: &polytomic.Identity{ Source: &polytomic.Source{ Field: "contact_id", ModelId: "YOUR_SNOWFLAKE_MODEL_ID", }, Target: "Id", Function: "Equality", }, Schedule: &polytomic.Schedule{ Frequency: pointer.ToString(string(polytomic.ScheduleFrequencyManual)), }, Target: &polytomic.Target{ ConnectionId: "YOUR_GONG_CONNECTION_ID", Object: "my-gong-engage-flow", }, }, ) if err != nil { panic(err) } fmt.Println(resp) ```