Integrations/Salesforce

Salesforce in Python

Call the Salesforce REST API from Python services, run SOQL queries with pagination, create and upsert records idempotently, and sync your CRM with other systems on a schedule.

REST
API client
SOQL
queries and pagination
24/7
scheduled syncs
7
guides and docs
salesforce_service.py

Records in, records out

Create records from a REST channel or pull them out with SOQL on a schedule, all with the same services.

Everything for Salesforce integrations

The REST API, SOQL and scheduled syncs, with the reliability patterns Salesforce leaves to you.

The REST API from Python
Call the Salesforce REST API with self.salesforce - get, post, patch and delete against any sObject path, with OAuth tokens obtained and attached for you.
SOQL and pagination
Query records with SOQL, traverse parent relationships in one request and page through large result sets with nextRecordsUrl.
Upserts and external IDs
Create-or-update in one idempotent call, keyed by your own identifiers instead of Salesforce record IDs.
Scheduled syncs
Pull changed records on a schedule, correlate them with other systems and update only what drifted - no cron jobs or external workers.
Errors and API limits
Read Salesforce error arrays, watch your daily API request allowance and decide per record whether to continue or fail the run.
Configuration as YAML
Define Salesforce connections declaratively with enmasse and deploy them across environments.

Learn by building

Step-by-step guides for building API integrations in Python.

Salesforce integration guides

Each guide covers one part of a Salesforce integration, with complete Python services you can copy and run.

Frequently asked questions

Create a connected app in your Salesforce org and take its consumer key and consumer secret, then store them together with a username and password in a Zato Salesforce connection. Your services never handle tokens - Zato obtains and attaches OAuth access tokens for every request. The getting started guide shows where to find each credential.

The REST API - the same one behind Salesforce's own tooling. You call sObject and query paths such as /sobjects/Campaign/ or /query/ and Zato prefixes them with the address and API version of your connection.

The API version is a field on the connection definition, e.g. 54.0. Upgrading is a one-field change in the Dashboard or in your enmasse YAML, with no code redeployment.

SOQL responses carry done and nextRecordsUrl fields - when done is false, follow nextRecordsUrl until it is true. The SOQL guide has the complete loop.

Upsert by an external ID field instead of creating blindly - one idempotent call that creates the record if it is missing and updates it if it exists. The upserts guide covers external IDs and parent references.

A JSON array of objects with errorCode and message fields, e.g. REQUIRED_FIELD_MISSING or INVALID_SESSION_ID, and some operations report success per record rather than per request. The error handling guide shows how to read both.

Every org has a rolling 24-hour API request allowance. Prefer one SOQL query with relationship traversal over many per-record lookups, batch your work with the scheduler and read the Sforce-Limit-Info response header - the limits guide explains the arithmetic.

Point a Salesforce outbound message or an Apex callout at a Zato REST channel. The webhooks guide includes a Salesforce example with signature verification.

Yes - define Salesforce connections in YAML with enmasse and import them per environment, with credentials read from environment variables.

Create is a post to /sobjects/Type/, Update is a patch to the record path, Upsert is a patch to an external-ID path, Delete is a delete on the record path and Query is a get on /query/. The getting started guide has the full mapping table.

Ready to build Salesforce integrations?

Get started with Zato and connect Salesforce to your enterprise systems in minutes.

Open source In Python