Skip to main content

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

  1. Open your project's Sources page
  2. Click Add Source → Salesforce
  3. Authorize the Connected App in your Salesforce org
  4. Click Generate webhook URL — Dispatch shows you the URL and a freshly generated signing secret
  5. 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.

CategoryExamples
CRM coreAccount.created, Contact.updated, Lead.converted
Sales pipelineOpportunity.created, Opportunity.updated, Quote.accepted, Order.activated, Contract.activated
CatalogueProduct2.created, PricebookEntry.updated
MarketingCampaign.created, CampaignMember.created
Service CloudCase.created, Case.escalated, CaseComment.created
ActivitiesTask.completed, Event.created
PlatformUser.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

  1. Open Sources and find the Salesforce endpoint
  2. Click Disconnect

Dispatch deactivates the endpoint. Remove or disable the matching Apex trigger / Flow in Salesforce so it stops sending callouts.