Syncing contacts from Google Cloud Storage to webhooks
Code
Set your Polytomic API key as an environment variable:
This example covers five steps:
- Create a webhook Connection.
- Create a Google Cloud Storage Connection.
- Verify the Connection is ready.
- Create a model over a Google Cloud Storage CSV file.
- Sync the model to your webhook.
1. Create a webhook connection
Create the webhook Connection through Polytomic Connect’s embedded authentication or the Create Connection endpoint. See the webhook configuration reference for the required fields.
2. Create a Google Cloud Storage connection
The following request creates a Google Cloud Storage Connection.
cURL
Python
Typescript
Go
3. Verify connection readiness
Before syncing, poll the Get Schema Status endpoint for your Google Cloud Storage Connection ID until cache_status is true. Once it is, the Connection is ready to use.
4. Create a source model over the GCS CSV
Next, create a model over a CSV file in Google Cloud Storage (GCS). A model is a view — a collection of fields you can sync to other systems in whole or in part.
Call the Create Model endpoint to expose every column in high_paying_users.csv:
cURL
Python
Typescript
Go
5. Sync the GCS model to the webhook
The sync sends email, first_name, and last_name from the GCS model to the webhook. Add more entries to the fields array to sync additional columns.
Create the sync with the Create Sync endpoint:
cURL
TypeScript
Python
Go
This example uses a manual schedule, so the sync runs only when you trigger it. Use a manual schedule when you drive syncs from your own orchestration. To run the sync on a recurring schedule instead, set a different schedule frequency.
