Salesforce Integration
Dispatch receives Salesforce record events from an Apex trigger or Flow HTTP callout in your org. Salesforce has no native outbound webhook product, so the customer-side trigger pushes JSON to your Dispatch source URL.
Connecting Salesforce
- Open your project's Sources page
- Click Add Source → Salesforce
- Authorize the Connected App in your Salesforce org
- Click Generate webhook URL — Dispatch shows you the URL and a freshly generated signing secret
- Copy both into your Apex trigger / Flow HTTP callout
Sandboxes: log in via https://test.salesforce.com instead of the production login URL.
Sending events from Apex
The receiver accepts a small, opinionated JSON shape. The event type comes from the X-Salesforce-Event header (or from event_type in the body), and the record fields go under record:
{
"event_type": "Opportunity.updated",
"instance_url": "https://example.my.salesforce.com",
"record": {
"Id": "0061x00000D4eF5AAD",
"Name": "Acme - Enterprise Renewal",
"StageName": "Closed Won",
"Amount": 135000,
"IsClosed": true,
"IsWon": true
},
"old": {
"StageName": "Negotiation/Review"
}
}
Required headers:
Content-Type: application/json
X-Salesforce-Event: Opportunity.updated
X-Salesforce-Signature: sha256=<hex hmac-sha256 of body using your signing secret>
The old object is optional but lets Dispatch render stage-transition embeds.
Supported events
The event picker covers every standard CRM and Service Cloud object. You are not limited to this list — any <SObject>.<action> string is accepted, and custom objects (MyObject__c.created) are auto-detected.
| Category | Examples |
|---|---|
| CRM core | Account.created, Contact.updated, Lead.converted |
| Sales pipeline | Opportunity.created, Opportunity.updated, Quote.accepted, Order.activated, Contract.activated |
| Catalogue | Product2.created, PricebookEntry.updated |
| Marketing | Campaign.created, CampaignMember.created |
| Service Cloud | Case.created, Case.escalated, CaseComment.created |
| Activities | Task.completed, Event.created |
| Platform | User.created, Asset.created |
| Custom objects | *__c.created, *__c.updated, *__c.deleted |
Signature verification
X-Salesforce-Signature is an HMAC-SHA256 hex digest of the raw request body keyed with the source signing secret. The sha256= prefix is optional.
When the source is created without a signing secret, signature verification is skipped (handy for testing from Postman).
Auto-formatted embeds
When no template is assigned, Dispatch generates rich Discord embeds tailored to the SObject:
- Account — name, type, industry, annual revenue, owner
- Contact — name, title, email, phone, account
- Lead — name, company, status, source, email
- Opportunity — stage transition (
Old → New), amount, probability, close date, account; colour-coded green for won, red for lost - Case — number, subject, status, priority, origin; colour-coded by priority
- Quote / Order / Contract — totals, status, dates
- Campaign / Product / Activity / User / Asset — relevant headline fields
- Custom objects — name + action with the raw record fields available to templates
If instance_url and the record Id are present, the embed title links straight to the Lightning record page.
Disconnecting
- Open Sources and find the Salesforce endpoint
- Click Disconnect
Dispatch deactivates the endpoint. Remove or disable the matching Apex trigger / Flow in Salesforce so it stops sending callouts.