Adding users from Snowflake to Salesloft Cadence

UI demo video

You can watch a demo video of these operations in Polytomic’s admin console here.

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 5 steps:

  1. Connecting to Snowflake.
  2. Connecting to Salesloft.
  3. Surfacing user data from Snowflake using a custom SQL query.
  4. Retrieving the list of cadences from Salesloft.
  5. Adding users from Snowflake to a Salesloft cadence.

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 Salesloft connection

The following request will create a Salesloft connection using Polytomic Connect’s embedded OAuth modal. You can also connect with a Salesloft API key or handle OAuth yourself and 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 Salesloft Connection","type": "salesloft", "configuration": {"auth_method": "oauth"}}'

If you’re using OAuth to authenticate to Salesloft 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 MAX(last_activity_date) AS last_activity_date, plan, first_name, last_name, email FROM users GROUP BY plan, first_name, last_name, email",
> },
> "connection_id": "YOUR-SNOWFLAKE-CONNECTION-ID"
> }'

4. Obtain the list of Salesloft target objects

Polytomic can sync to Accounts, People, and Cadences. All Salesloft candences are listed as target objects along with Accounts and People.

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

5. Sync users from your Snowflake model to a Salesloft Cadence

This sync uses the email field from Snowflake to match against existing Person records in Salesloft. It also syncs the first_name and last_name fields from Snowflake.

If the Person record does not exist in Salesloft, Polytomic will create it first before adding it to the cadence. If the Person does exist, Polytomic will update it with the values of the mapped fields in the sync config before adding it to the cadence:

The Salesloft Cadence to add people to is 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 Salesloft Cadence Sync",
> "mode": "updateOrCreate",
> "identity": {
> "source": {
> "field": "email",
> "model_id": "YOUR_SNOWFLAKE_MODEL_ID"
> },
> "target": "Email",
> "function": "equality"
> },
> "fields": [
> {
> "source": {
> "field": "first_name",
> "model_id": "YOUR_SNOWFLAKE_MODEL_ID"
> },
> "target": "FirstName"
> },
> {
> "source": {
> "field": "last_name",
> "model_id": "YOUR_SNOWFLAKE_MODEL_ID"
> },
> "target": "LastName"
> }
> ],
> "schedule": {
> "frequency": "manual"
> },
> "target": {
> "connection_id": "YOUR_SALESLOFT_CONNECTION_ID",
> "object": "my-salesloft-cadence"
> }
> }'