Home About Services Clients Products → E2E Sales → StockPro Case Studies → Employee Reviews → Newsletter → Culture & Gallery Contact Get Started
Case Study · MuleSoft · Salesforce Integration

Real-Time Listing & Image Sync Across
Two Salesforce Instances via MuleSoft

Project: Salesforce-to-Salesforce Listing & Image Sync Middleware: MuleSoft Anypoint Platform Duration: June – Oct 2025 Delivered By: Gagstek
Auto
Full Listing Lifecycle
Create, Update & Delete
Live
Real-Time Event-Driven
Salesforce Sync
Zero
Manual Errors in
Listing & Image Publishing
Reuse
API-Led Architecture
for Future Marketplaces

An Event-Driven Integration Between Two Salesforce Instances

Gagstek implemented MuleSoft as middleware between a source Salesforce system (holding advertisement and media data) and a target Salesforce system — automating listing creation, updates, image uploads, and deletions in real time.

The solution listens to Salesforce Platform Events, enriches data via SOQL queries, transforms records into target payloads using DataWeave 2.0, and calls target REST APIs with full OAuth2 token management. The result: a reusable, secure, API-led architecture that eliminated manual errors, reduced time-to-market for listings, and laid the groundwork for rapid onboarding of future marketplace channels.

Three Pain Points Blocking Reliable Listing Sync

  • Manual publishing and image uploads from the source Salesforce to the target system were error-prone, slow, and created a significant operational overhead for the team
  • No reliable sync between Salesforce advertisement records and target listings — discrepancies between systems led to outdated or incorrect listings being shown to end customers
  • No retryable or observable communication with the target APIs — transient failures went undetected, and there was no secure or centralized token management strategy in place

Two System APIs Following MuleSoft's API-Led Connectivity Model

Gagstek designed and built two System APIs following MuleSoft's API-led connectivity model — isolating concerns between the source and target systems for maximum maintainability and reuse.

SFDC System API — Event Listener
Listens to Platform Events (Advertisement_Sync_Event__e) via Replay Listener. Executes SOQL queries on Advertisement, Vehicle, and ModelVariant objects, then triggers the Target System API.
DataWeave 2.0 Transformations
Advanced DataWeave mappings transform Salesforce SObjects into the exact payload format required by the target system — including conditional logic, field enrichment, and binary handling for image data.
Target System API — Listing Lifecycle
Manages the full listing lifecycle: create (POST), update (PUT), and delete (DELETE) operations. Handles image uploads as multipart/form-data, image set operations, and writes listing IDs back to Salesforce.
OAuth2 Token Management
Uses MuleSoft Object Store for OAuth token caching with TTL expiry. Automatically re-fetches tokens on 401 errors — eliminating race conditions and ensuring uninterrupted API access.
Retry & Resilience Patterns
All external API calls wrapped in Until Successful scopes with controlled backoff — ensuring transient failures are automatically recovered without manual intervention or data loss.
Observability & Error Handling
Consistent Logger placement across all critical flows, a Global Error Handler for uniform error output, and monitoring hooks compatible with Anypoint Monitoring for full pipeline visibility.

How Data Flows Through the Integration Pipeline

The integration follows a clean event → enrich → transform → act pattern across two decoupled System APIs:

Salesforce Platform Events └─▶ SFDC System API (Replay Listener) ├─ SOQL: Advertisement__c, Vehicle__c, ModelVariant__c ├─ DataWeave Transform → Target Payload └─▶ Target Salesforce System API (HTTP) ├─ Get / Cache Access Token (Object Store + TTL) ├─ Create / Update / Delete Listing ├─ Upload Images (multipart/form-data) ├─ Set Image IDs on Listing (PUT) └─ Write Listing ID back to Salesforce

Each layer is independently deployable and testable, following MuleSoft's System → Process → Experience API pattern — making the architecture easy to extend to additional marketplaces or data sources without rebuilding core logic.

Engineering a Resilient, Observable Integration

Salesforce Connectors
Used salesforce:replay-channel-listener, salesforce:query-all, and salesforce:update to interact natively with Salesforce at every stage.
Binary Image Handling
Fetches binary image data from Salesforce ContentVersion.VersionData, converts it using dw::core::Binaries, and posts as multipart/form-data to the target image endpoint.
Object Store Caching
OAuth tokens stored in MuleSoft Object Store with TTL-based expiry. Stale tokens are automatically refreshed — preventing failures caused by token expiry or race conditions under load.
Idempotency & Traceability
Listing IDs extracted from Location response headers and written back to Salesforce — ensuring every record is traceable and re-runnable operations don't create duplicate listings.

A Fully Auditable, Low-Touch Publishing Pipeline

Zero
Errors
Automated listing lifecycle eliminated manual errors — create, update, and delete operations now trigger automatically from Salesforce events with no human intervention.
Faster
Publish
Reduced time-to-market for listings — advertisements go live on the target platform as soon as they are published in Salesforce, cutting the previous manual lag entirely.
Full
Trace
Improved traceability with logs and Salesforce record updates — every listing operation is logged, and listing IDs are written back to Salesforce for a complete audit trail.
Reuse
Ready
Reusable APIs enable rapid onboarding of new marketplaces — the API-led architecture means new target channels can be added without rebuilding the core integration logic.
Self
Heal
Resilient retry patterns handle transient failures automatically — Until Successful scopes recover from intermittent API errors without manual monitoring or reprocessing workflows.
Gagstek delivered a fully auditable, low-touch publishing pipeline — reusable for any future marketplace the client chooses to integrate with Salesforce.

What the Client Said

"GAGSTEK built a resilient, event-driven integration that automatically syncs Salesforce advertisements and images to our target platform. It manages OAuth tokens securely, handles retries for transient failures, converts and uploads image binaries, and writes back identifiers to Salesforce — giving us a fully auditable, low-touch publishing pipeline that's reusable for any future marketplace we add."

T
Technology Leadership
Salesforce-Powered Listings Platform