Syncing contacts from Google Cloud Storage to webhooks
Code
Before getting started make sure to set your Polytomic API key as an environment variable:
This example tutorial covers five steps:
- Connecting to your webhook.
- Connecting to Google Cloud Storage.
- Verifying connection readiness.
- Creating a Polytomic model on your Google Cloud Storage CSV.
- Creating a contacts sync from Google Cloud Storage to your webhook.
1. Create a webhook connection
Create a connection to your webhook using either Polytomic Connect’s embedded authentication or directly through the Create Connection API. If using the latter, you can see the required connection configuration here.
2. Create a Google Cloud Storage connection
The following request will create a Google Cloud Storage connection.
cURL
Python
Typescript
Go
3. Verify connection readiness
Before using either connection for syncing, verify that the Get Schema Status call for your Google Cloud Storage connection ID returns cache_status = true (you can poll the endpoint until you see this).
When this value is set to true, this connection is ready to be used.
4. Create a Google Cloud Storage source CSV data model
We will now create a data model from a CSV file on Google Cloud Storage (hereafter referred to as ‘GCS’). Data models are collections of fields (i.e. views) from which you can select any subset to sync to other systems.
We will use the Create Model endpoint to surface all columns from a high_paying_users.csv file on GCS:
cURL
Python
Typescript
Go
5. Create a sync from the above GCS model to your webhook
We will now create a sync to send the email, first_name, and last_name fields from the GCS CSV model above to your webhook. The field list can be extended with additional ones from your CSV. That is, Polytomic lets you sync a subset of fields from your CSV.
The following example uses the Create Sync endpoint:
cURL
TypeScript
Python
Go
This example sets the sync schedule to ‘Manual’. This means that the sync will not run on a schedule. Rather, it will only run if you trigger it yourself. This is a common choice if you prefer trigger syncs per your own orchestration. Those who prefer that Polytomic runs syncs on a schedule can change this schedule frequency to something else.
