Connect a CRM & sync
Goal: link a CRM to a product so leads import in and stages/fields/tags/messages sync out.
A CRM connection has two layers: a company-level integration (the CRM account) and a product binding (which product uses it, with its mapping).
1. Create the integration
OAuth-based CRMs — amoCRM, Kommo, Bitrix24, FastTrack, Usedesk — are connected through their own OAuth flow, not through this API. The one CRM you create directly here is Google Sheets:
curl -s https://api.sance.ai/v1/crm-integrations/google-sheets \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "company_id": 10, "name": "Sheet CRM", "crm_type": "google_sheets",
"config": { "secrets": { "service_account_json": { "client_email": "...", "...": "..." } } } }'
The response includes service_account_email — share your spreadsheet with that email.
List existing integrations with GET /v1/crm-integrations/.
2. Bind it to a product
curl -s https://api.sance.ai/v1/product_crm_integrations/ \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "product_id": 42, "crm_integration_id": 5, "config": {} }'
3. Inspect & operate
Fetch CRM metadata to build your mapping, and trigger a classification-fields resync:
curl -s "https://api.sance.ai/v1/crm-integrations/5/pipelines" -H "Authorization: Bearer $TOKEN"
curl -s "https://api.sance.ai/v1/crm-integrations/5/users" -H "Authorization: Bearer $TOKEN"
curl -s -X POST "https://api.sance.ai/v1/product_crm_integrations/42/5/classification-sync" \
-H "Authorization: Bearer $TOKEN"
What happens next: background workers import new/updated leads from the CRM and push lead
stage moves, CRM fields, tags, and messages back. The binding tracks last_import_at /
last_sync_at.
See: POST /v1/crm-integrations/google-sheets, GET /v1/crm-integrations/,
GET /v1/crm-integrations/{id}/pipelines, POST /v1/product_crm_integrations/,
POST /v1/product_crm_integrations/{product_id}/{crm_integration_id}/classification-sync.