Publish and subscribe to Salesforce Platform Events from an external system
domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
In-depth guide
Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.
Steps
Define a Platform Event object in Setup with the required fields, and note its API name ending in __e
From an external system, publish events by POSTing to /services/data/vXX.0/sobjects/<EventName__e> with a JSON body containing the event field values — treat it like a standard sObject insert
For batch publishing, use the Composite API sObject collection endpoint to insert up to 200 event records in a single request
To subscribe, open a CometD connection and subscribe to /event/<EventName__e>; implement replayId persistence identically to CDC subscriptions
Process the event payload — fields are nested under the sobject key in the CometD message data envelope
Monitor publishing limits: Platform Events count against the org's daily API request limit and have a separate high-volume event allocation — check System Overview in Setup to avoid throttling
Known gotchas
Platform Events published via Apex in a trigger are only committed when the transaction commits — if the transaction rolls back, the events are discarded even if the publish call succeeded within the transaction
Standard-volume Platform Events have a 250,000 events/day limit by default; exceeding it silently drops events rather than returning an error to the publisher
CometD subscriptions to Platform Events from external systems must re-subscribe after each Salesforce server-side maintenance window; the advisory channel /meta/connect returning a 503 is the signal to reconnect
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?