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. Click Generate webhook URL — Dispatch shows you the URL and a freshly generated signing secret. Your org signs each request it sends with that secret, so Dispatch can verify it came from your org.
  4. Get both values into your org, one of two ways:
    • Install the Dispatch package (recommended, when offered). Click Connect Salesforce and authorize the Connected App in the org you'll install into, then click Install in Salesforce. Keep the dialog open while the install finishes: Dispatch detects the package and writes the webhook URL and signing secret into your org for you.
    • Your own Apex trigger or Flow. Copy the URL and signing secret into your Apex trigger / Flow HTTP callout (see below).
  5. Click Done

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.

A source without a signing secret does not accept unsigned deliveries: each request must carry a project API key, or the source must be explicitly marked Public in its settings. For testing from Postman without signing, mark the source as public or send an API key in the Authorization header.

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.

Removing a Salesforce source​

  1. In Dispatch, delete the source from the Sources page (see Deleting and Archiving)
  2. In Salesforce, remove or disable the matching Apex trigger / Flow, so your org stops sending callouts to it