Building Custom Integrations
When the pre-built integrations do not cover your needs, build a custom integration using the SalesOS REST API and webhooks. This guide covers architecture patterns, best practices, and common scenarios.Integration Patterns
One-Way Sync (SalesOS to External)
Push data from SalesOS to another system:- Set up webhooks for the events you care about (e.g.,
deal.won,lead.created) - Build a receiver that processes webhook payloads
- Transform and push the data to your target system
One-Way Sync (External to SalesOS)
Pull or push data from an external system into SalesOS:- Listen for events in your external system (or poll on a schedule)
- Transform the data to match SalesOS field formats
- Call the SalesOS API to create or update records
Two-Way Sync
Keep data synchronized between SalesOS and another system:- Webhook from SalesOS updates the external system
- Webhook or poll from external updates SalesOS
- Conflict resolution handles simultaneous changes
Scheduled Batch Sync
For systems that do not support real-time events:- Run on a schedule (e.g., every hour via cron)
- Fetch changes since last sync using
updated_afterfilters - Process changes in batches
- Track sync state (last sync timestamp, page cursors)
Building Your Integration
Step 1: Plan Your Data Flow
Before writing code, document:- Which SalesOS entities you need (leads, deals, users)
- Which fields map between systems
- Which direction data flows (one-way or two-way)
- How often data needs to sync (real-time, hourly, daily)
- How to handle conflicts and errors
Step 2: Set Up Authentication
Create an API client with the minimum required scopes:Step 3: Implement the Integration
- Node.js
- Python
Step 4: Handle Errors
Your integration should handle:- Rate limiting — Respect
429responses and back off using theRetry-Afterheader - Validation errors — Log
422responses and fix data mapping issues - Network failures — Implement retry logic with exponential backoff
- Duplicate detection — Handle
409 Conflictresponses gracefully
Step 5: Monitor and Maintain
- Log all API calls and responses for debugging
- Set up alerts for integration failures
- Monitor API usage against rate limits
- Keep your token refresh mechanism working
- Test after SalesOS updates
Webhook Receiver Example
A minimal webhook receiver in Node.js (Express):Best Practices
- Use idempotent operations — Your integration should produce the same result if the same event is processed twice
- Map external IDs — Store the external system’s ID in a SalesOS custom field to enable lookups and deduplication
- Log everything — Comprehensive logging makes debugging much easier
- Test with staging — Use the SalesOS staging environment to test before going to production
- Handle partial failures — In batch operations, do not let one failure stop the entire batch
Next Steps
API Conventions
Review API conventions
Webhooks
Set up webhook endpoints

