> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce Service Cloud Webhook Setup Guide

> Configure Salesforce Service Cloud to deliver events to StackOne.

## Prerequisites

The connector should already be set up, with a Connector Profile and a Linked Account. See [Getting Started](https://docs.stackone.com/connectors/salesforceservicecloud.md#getting-started) on the Salesforce Service Cloud connector page.

## Outbound message and flow per event

Salesforce sends events through outbound messages, and a record-triggered flow decides when each one is sent. Create one outbound message and one flow for every event you want, using the object and trigger listed for it. Email message events use a flow with an HTTP callout instead.

**1. Copy the Native Webhook URL**

The **Native Webhook URL** is generated once an account has been linked. Salesforce sends every outbound message to this URL.

<ul>
  <li>Open the linked account in StackOne.</li>
  <li>Copy the value from **Native Webhook URL**.</li>
</ul>

**2. Select the object**

Sign in to [Salesforce](https://login.salesforce.com), or to [your sandbox](https://test.salesforce.com) for a sandbox org, and open Setup. In the **Quick Find** box, enter `Outbound Messages` and select **Outbound Messages** under **Workflow Actions**.

<ul>
  <li>If the **Understanding Workflow** page opens, click **Continue**.</li>
  <li>Click **New Outbound Message**.</li>
  <li>**Object**: the object for the event:</li>
  <li>**Case**: `case.created`, `case.updated`</li>
  <li>**Case Comment**: `casecomment.created`, `casecomment.updated`</li>
  <li>**Contact**: `contact.created`, `contact.updated`</li>
  <li>**Entitlement**: `entitlement.created`, `entitlement.updated`</li>
  <li>**Service Contract**: `servicecontract.created`, `servicecontract.updated`</li>
  <li>**Task**: `task.created`, `task.updated`</li>
  <li>**User**: `user.created`, `user.updated`</li>
  <li>**Work Order**: `workorder.created`, `workorder.updated`</li>
  <li>Knowledge article and social post objects appear only when Knowledge or Social Customer Service is enabled in the org.</li>
  <li>Click **Next**.</li>
</ul>

![Step 1 of the New Outbound Message wizard with Work Order selected as the Object and the Next button highlighted](https://mintcdn.com/stackone-60/Q-VBNqFeXkuELpVy/connectors/salesforceservicecloud/images/events-select-object.png?fit=max\&auto=format\&n=Q-VBNqFeXkuELpVy\&q=85\&s=138a45c405a63fa68143d90fa1406493)

**3. Fill in the message details**

Each outbound message sends one event, named by the `event` value in its endpoint URL.

<ul>
  <li>**Name**: a name for the event, such as `StackOne Work Order Created`</li>
  <li>**Endpoint URL**: the Native Webhook URL followed by `?event=` and the event code. If the URL already contains `?`, add `&event=` instead of `?event=`.</li>
  <li>Format: `<Native Webhook URL>?event=<event code>`, or `<Native Webhook URL>&event=<event code>`</li>
  <li>Example: for `casecomment.created`, the endpoint URL ends in `event=casecomment.created`</li>
  <li>**User to send as**: a user with read access to the object and the fields you send</li>
</ul>

![Step 2 of the New Outbound Message wizard with the Name, Endpoint URL and User to send as fields highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-outbound-message-details.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=ee831945be990cc53a8968a42eaac78a)

**4. Choose the fields to send**

**Id** is already in **Selected Fields**, and it is the only field StackOne needs. Any other field you add is included in the event payload.

<ul>
  <li>In **Available Fields**, select each extra field you want, such as **LastModifiedDate**.</li>
  <li>Click **Add**.</li>
  <li>Click **Save**.</li>
</ul>

![The Work Order fields to send lists with LastModifiedDate added to Selected Fields, and the Add and Save buttons highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-fields-to-send.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=23cbebbf0edd17311337e1e61fe92653)

## Send each message from a flow

Outbound message actions are only available in record-triggered flows that run after the record is saved. Create one flow for each outbound message.

**1. Create a record-triggered flow**

In the **Quick Find** box, enter `Flows` and select **Flows**.

<ul>
  <li>Click **New Flow**.</li>
  <li>In **New Automation**, select **Record-Triggered Flow**.</li>
</ul>

![The New Automation window in Flow Builder with Record-Triggered Flow highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-new-record-triggered-flow.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=7ec79a173f9ec01a5155311fe6f82e35)

**2. Configure the start**

Set the flow to run for the same object and change as the outbound message.

<ul>
  <li>**Object**: the outbound message's object, such as **Work Order**</li>
  <li>**Trigger the Flow When:** **A record is created** for a `.created` event, or **A record is updated** for an `.updated` event</li>
  <li>**Optimize the Flow for:** **Actions and Related Records**</li>
</ul>

![The Configure Start panel with Work Order as the Object, A record is created selected and Actions and Related Records highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-configure-start.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=6f9f7917db5e10d1d0457f1fe4247416)

**3. Add the outbound message action**

Add the action on the canvas, below **Run Immediately**.

<ul>
  <li>Click the add button.</li>
  <li>Select **Action**.</li>
  <li>In **Search Actions**, enter the outbound message name and select it.</li>
  <li>**Label**: a name for the element, such as `Send to StackOne`</li>
</ul>

![The Action panel with the StackOne Work Order Created outbound message found in Search Actions](https://mintcdn.com/stackone-60/Q-VBNqFeXkuELpVy/connectors/salesforceservicecloud/images/events-select-outbound-action.png?fit=max\&auto=format\&n=Q-VBNqFeXkuELpVy\&q=85\&s=923fc973f8b8b1dfc54485420eeaf44a)

**4. Save and activate the flow**

The action has no inputs. Salesforce passes the triggering record to the outbound message.

<ul>
  <li>Click **Save**.</li>
  <li>**Flow Label**: the same name as the outbound message</li>
  <li>Click **Save**.</li>
  <li>Click **Activate**.</li>
</ul>

![The Save dialog in Flow Builder with the Flow Label field and Save button highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-save-flow.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=a1fab25b360d2683e2a9e144487aa3a4)

## Email message events

Outbound messages can't be created on **Email Message**, so `emailmessage.created` and `emailmessage.updated` are sent by a flow with an HTTP callout. Set up the credential and permission set once, then create one flow per event.

**1. Create the external credential**

In Setup, enter `Named Credentials` in the **Quick Find** box and select **Named Credentials**. Open the **External Credentials** tab and click **New**.

<ul>
  <li>**Label**: `StackOne Webhook`</li>
  <li>**Name**: `StackOne_Webhook`</li>
  <li>**Authentication Protocol**: **No Authentication**</li>
  <li>Click **Save**.</li>
</ul>

![The New External Credential dialog with Label, Name, No Authentication and Save highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-external-credential.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=eec575d98595751f33d6a9bef8e87dfb)

**2. Add a principal**

On the **StackOne Webhook** external credential, click **New** in the **Principals** section.

<ul>
  <li>**Parameter Name**: `StackOne`</li>
  <li>**Sequence Number**: `1`</li>
  <li>Click **Save**.</li>
</ul>

![The Create Principal dialog with Parameter Name, Sequence Number and Save highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-principal.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=e719ae53b853093f44681d01be013017)

**3. Create the named credential**

Open the **Named Credentials** tab and click **New**.

<ul>
  <li>**Label**: `StackOne Webhook`</li>
  <li>**Name**: `StackOne_Webhook`</li>
  <li>**URL**: the Native Webhook URL, exactly as copied from StackOne</li>
  <li>**External Credential**: **StackOne Webhook**</li>
  <li>Click **Save**.</li>
</ul>

![The New Named Credential dialog with Label, Name, URL and External Credential highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-named-credential.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=2601293b88f029382709873d0c68193a)

**4. Grant access to the credential**

The permission set lets users run the callout. In the **Quick Find** box, enter `Permission Sets` and select **Permission Sets**.

<ul>
  <li>Click **New**.</li>
  <li>**Label**: `StackOne Webhook Callouts`</li>
  <li>Click **Save**.</li>
  <li>Click **External Credential Principal Access**.</li>
  <li>Click **Edit**.</li>
  <li>Select **StackOne\_Webhook - StackOne** and click **Add**.</li>
  <li>Click **Save**.</li>
</ul>

![External Credential Principal Access with StackOne\_Webhook - StackOne in Enabled External Credential Principals](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-principal-access.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=33f006ce05ddfaa97dda38266f5f56a6)

**5. Assign the permission set**

Assign the permission set to every user who creates or updates email messages, such as support agents and integration users.

<ul>
  <li>Click **Manage Assignments**.</li>
  <li>Click **Add Assignment**.</li>
  <li>Select the users.</li>
  <li>Click **Next**.</li>
  <li>Click **Assign**.</li>
</ul>

![Select Users to Assign with one user selected and the Next button highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-assign-permission-set.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=c6b61fcaf6ef7607995ec70f8a97e870)

**6. Start the email message flow**

In the **Quick Find** box, enter `Flows` and select **Flows**.

<ul>
  <li>Click **New Flow**.</li>
  <li>Select **Record-Triggered Flow**.</li>
  <li>**Object**: **Email Message**</li>
  <li>**Trigger the Flow When:** **A record is created**</li>
</ul>

![Configure Start with Email Message as the Object and A record is created selected](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-flow-start.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=93563c785b34d52f3338415784ce553d)

**7. Add the asynchronous path**

An HTTP callout can only run on an asynchronous path.

<ul>
  <li>**Optimize the Flow for:** **Actions and Related Records**</li>
  <li>Turn on **Add Asynchronous Path**.</li>
</ul>

![Actions and Related Records selected and the Add Asynchronous Path toggle turned on](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-async-path.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=4166865fbdfe4819f7e0802b4701579a)

**8. Create the HTTP callout**

Add the callout on the **Run Asynchronously** path.

<ul>
  <li>Click the add button below **Run Asynchronously**.</li>
  <li>Select **Action**.</li>
  <li>Click **Create HTTP Callout**.</li>
  <li>**Name**: `StackOneWebhook`</li>
  <li>**Named Credential**: **StackOne Webhook**</li>
  <li>Click **Next**.</li>
</ul>

![The New HTTP Callout window with Name and Named Credential filled in and Next highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-callout-service.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=1a5b17be5df6236d4468d9ff12370f3c)

**9. Set the callout method**

Leave **URL Path** empty.

<ul>
  <li>**Label**: `Send to StackOne`</li>
  <li>**Method**: **POST**</li>
  <li>Click **Next**.</li>
</ul>

![Configure Invocable Action with Label set to Send to StackOne and Method set to POST](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-callout-method.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=48fe6b60d917e195ff6143d32feec7b2)

**10. Paste the sample request**

Paste this into **Sample JSON Request**.

```
{
  "event": "emailmessage.created",
  "recordId": "02s000000000000AAA"
}
```

<ul>
  <li>Click **Review**.</li>
  <li>Click **Next**.</li>
</ul>

![Sample JSON Request with the event and recordId keys and the Review and Next buttons highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-sample-request.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=1dc3f0d0f3ad8816c7994b2aa3cff1bb)

**11. Add the example response**

Select **Use Example Response**, click **Next**, and paste this into **Sample JSON Response**.

```
{
  "Ack": true
}
```

<ul>
  <li>Click **Review**.</li>
  <li>Click **Save**.</li>
</ul>

![Sample JSON Response with the Ack key and the Review and Save buttons highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-sample-response.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=eb7104c0564592508bb1db02c2c9e6c2)

**12. Create the request body**

In the **Send to StackOne** action, under **Set Request Body**, the body needs its own resource.

<ul>
  <li>Open **Value**.</li>
  <li>Select **New Resource**.</li>
  <li>**API Name**: `requestBody`</li>
  <li>Click **Done**.</li>
  <li>**Label**: `Send to StackOne`</li>
</ul>

![The New Resource dialog with API Name set to requestBody and Done highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-request-resource.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=d61d64a05c3ee4a5db39ecbfd20291ba)

**13. Fill in the request body**

Add an assignment between **Run Asynchronously** and **Send to StackOne**.

<ul>
  <li>Click the add button above **Send to StackOne**.</li>
  <li>Select **Assignment**.</li>
  <li>**Label**: `Set request body`</li>
  <li>**requestBody > event** **Equals** `emailmessage.created`</li>
  <li>**requestBody > recordId** **Equals** **Triggering EmailMessage > Email Message ID**, the entry without an arrow</li>
</ul>

![The Set request body assignment with the requestBody event and recordId rows highlighted](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-request-assignment.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=0a45f3af53b372d58eaf464104263c18)

**14. Save and activate the flow**

Save the flow under the name of the event it sends.

<ul>
  <li>Click **Save**.</li>
  <li>**Flow Label**: `StackOne Email Message Created`</li>
  <li>Click **Save**.</li>
  <li>Click **Activate**.</li>
</ul>

**15. Add the update flow**

Copy the flow for updates, change three settings, then save and activate it.

<ul>
  <li>Click **Save As New Flow**.</li>
  <li>**Flow Label**: `StackOne Email Message Updated`</li>
  <li>**Trigger the Flow When:** **A record is updated**</li>
  <li>**Condition Requirements**: **All Conditions Are Met (AND)**, with **Status** **Is Changed** **True**</li>
  <li>In **Set request body**, change `emailmessage.created` to `emailmessage.updated`.</li>
</ul>

![Configure Start with A record is updated selected and a Status Is Changed True condition](https://mintcdn.com/stackone-60/ZclRmqMQ2BgqOdte/connectors/salesforceservicecloud/images/events-email-update-condition.png?fit=max\&auto=format\&n=ZclRmqMQ2BgqOdte\&q=85\&s=6c5a5136ba6e15a3164fdd521f5f329e)

## Available webhook events

The following events can be delivered to StackOne. Salesforce sends only the outbound messages an administrator has configured, so an event is delivered only once its outbound message and flow exist and are active.

**1. Case events**

Events related to cases and their comments.

<ul>
  <li>**Case Created** (`case.created`) — Fired when a Case record is inserted</li>
  <li>**Case Updated** (`case.updated`) — Fired when a Case record is edited</li>
  <li>**Case Comment Created** (`casecomment.created`) — Fired when a CaseComment is added to a case</li>
  <li>**Case Comment Updated** (`casecomment.updated`) — Fired when a CaseComment is edited</li>
</ul>

**2. Field service events**

Events related to work orders and service contracts.

<ul>
  <li>**Work Order Created** (`workorder.created`) — Fired when a WorkOrder record is inserted</li>
  <li>**Work Order Updated** (`workorder.updated`) — Fired when a WorkOrder record is edited</li>
  <li>**Service Contract Created** (`servicecontract.created`) — Fired when a ServiceContract record is inserted</li>
  <li>**Service Contract Updated** (`servicecontract.updated`) — Fired when a ServiceContract record is edited</li>
</ul>

**3. Entitlement events**

Events related to entitlements.

<ul>
  <li>**Entitlement Created** (`entitlement.created`) — Fired when an Entitlement record is inserted</li>
  <li>**Entitlement Updated** (`entitlement.updated`) — Fired when an Entitlement record is edited</li>
</ul>

**4. Knowledge events**

Events related to knowledge article versions.

<ul>
  <li>**Knowledge Article Created** (`knowledgearticle.created`) — Fired when a Knowledge article version is inserted</li>
  <li>**Knowledge Article Updated** (`knowledgearticle.updated`) — Fired when a Knowledge article version is edited</li>
</ul>

**5. People and activity events**

Events related to contacts, agents, and tasks logged against cases.

<ul>
  <li>**Contact Created** (`contact.created`) — Fired when a Contact record is inserted</li>
  <li>**Contact Updated** (`contact.updated`) — Fired when a Contact record is edited</li>
  <li>**User Created** (`user.created`) — Fired when a User record is inserted</li>
  <li>**User Updated** (`user.updated`) — Fired when a User record is edited</li>
  <li>**Task Created** (`task.created`) — Fired when a Task record is inserted</li>
  <li>**Task Updated** (`task.updated`) — Fired when a Task record is edited</li>
</ul>

**6. Customer communication events**

Events related to email and social messages logged against cases. Email message events are sent by a flow with an HTTP callout instead of an outbound message.

<ul>
  <li>**Email Message Created** (`emailmessage.created`) — Fired when an EmailMessage record is inserted</li>
  <li>**Email Message Updated** (`emailmessage.updated`) — Fired when an EmailMessage record changes, such as when an incoming email is read</li>
  <li>**Social Post Created** (`socialpost.created`) — Fired when a SocialPost record is inserted</li>
  <li>**Social Post Updated** (`socialpost.updated`) — Fired when a SocialPost record is edited</li>
</ul>

## Delivery format

Details of how Salesforce delivers outbound messages to StackOne.

**1. Batched payloads**

A single SOAP message can include up to 100 notifications. Each notification contains an ID that uniquely identifies a record, and a reference to the data in the record.

**2. Retries and delivery guarantees**

Salesforce queues messages until they are delivered.

<ul>
  <li>If the endpoint is unavailable, messages stay in the queue until sent successfully or until they are 24 hours old. After 24 hours, messages are dropped from the queue.</li>
  <li>If a message cannot be delivered, the interval between retries increases exponentially, up to a maximum of 2 hours between retries.</li>
  <li>Messages are retried independent of their order in the queue, so they can arrive out of order.</li>
  <li>A message is usually delivered once, but it can be delivered more than once.</li>
</ul>

**3. Payload contents**

The notification carries only the fields selected on the outbound message, alongside the record ID and the sending organization's ID.

<ul>
  <li>If the record changes after the notification is queued but before it is sent, only the latest data is delivered.</li>
</ul>

## Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.