| name | salesforce-webhooks-events |
| description | Implement Salesforce Platform Events, Change Data Capture (CDC), and Outbound Messages.
Use when building real-time integrations, listening for record changes,
or implementing event-driven architecture with Salesforce.
Trigger with phrases like "salesforce events", "salesforce CDC",
"salesforce platform events", "salesforce streaming", "salesforce outbound message", "salesforce real-time".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*), Bash(sf:*) |
| version | 1.7.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","crm","salesforce"] |
| compatibility | Designed for Claude Code |
Salesforce Webhooks & Events
Overview
Salesforce doesn't use traditional webhooks. Instead, it offers Platform Events, Change Data Capture (CDC), and Outbound Messages for real-time data flow. All use the CometD (Bayeux) streaming protocol via jsforce.
Prerequisites
- jsforce installed with connection configured
- Platform Events or CDC enabled in your org
- Understanding of publish/subscribe patterns
- Express.js for Outbound Message endpoints
Event Mechanism Comparison
| Mechanism | Direction | Use Case | Retention |
|---|
| Platform Events | Bi-directional | Custom event bus | 72 hours |
| Change Data Capture (CDC) | Salesforce → External | Record change notifications | 3 days |
| Outbound Messages | Salesforce → External | Workflow-triggered HTTP POST | Until confirmed |
| Streaming API (PushTopics) | Salesforce → External | SOQL-based subscriptions | No replay |
Instructions
Step 1: Subscribe to Change Data Capture (CDC)
import jsforce from 'jsforce';
const conn = new jsforce.Connection({
loginUrl: process.env.SF_LOGIN_URL,
});
await conn.login(process.env.SF_USERNAME!, process.env.SF_PASSWORD! + process.env.SF_SECURITY_TOKEN!);
const subscription = conn.streaming.topic('/data/AccountChangeEvent').( {
header = message..;
.(, header.);
.(, header.);
.(, header.);
.(, header.);
(header. === ) {
.(, message.);
}
});