> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ada.cx/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ada.cx/_mcp/server.

# Salesforce Messaging agent availability

## Overview

Set up a Salesforce Flow to retrieve agent availability and wait time attributes. Use these values to display information to end users or apply conditional logic before a [Handoff](/docs/handoffs) to Salesforce.

## Quick start

Complete these steps to set up agent availability checking. See [Implementation & usage](#implementation--usage) for detailed instructions.

#### Create an External Client App

Set up an External Client App in Salesforce with the Client Credentials Flow enabled.

#### Create a custom Flow

Build an Autolaunched Flow that checks queue availability and returns agent status.

#### Configure HTTP Request blocks in Ada

Add blocks to call the token endpoint and custom flow endpoint before the Handoff.

## Implementation & usage

Configure Salesforce and Ada to check agent availability before Handoffs.

### Set up the External Client App in Salesforce

Create an External Client App so Ada can authenticate and call the availability endpoint using client credentials.

**To set up the External Client App:**

1. Go to **Setup > App Manager**, then click **New External Client App**.

2. Under the basic details, complete the following fields:

   | Field                  | Notes                                                                    |
   | ---------------------- | ------------------------------------------------------------------------ |
   | **Name**               | Displayed in the App Manager. The **API Name** auto-fills from the name. |
   | **Contact Email**      | The contact email for Salesforce to use in the event of an error.        |
   | **Distribution State** | Set to `Local` unless you are packaging the app.                         |

3. Expand the **Enable OAuth** section and select the **Enable OAuth** check box.

4. In the **Callback URL** field, enter a value. The Client Credentials Flow does not redirect, so a placeholder such as `https://localhost` is sufficient.

5. Under **OAuth Scopes**, add the scopes required for server-to-server API access. The `Manage user data via APIs (api)` scope is typically sufficient. The `Perform requests at any time (refresh_token, offline_access)` scope is not required, because the Client Credentials Flow does not issue refresh tokens.

6. Select the **Enable Client Credentials Flow** check box.

7. Save the app, then find it in the **External Client App Manager**. Select the dropdown, then select **Edit Policies**.

   The Client Credentials Flow requires an explicit Run As user assigned at the policy level.

8. Under **Client Credentials Flow**, set the **Run As** user to your integration or service user, then click **Save**.

   ![Set the Run As user under Client Credentials Flow](/_fern-img/962b2150ea3eb48f65aa64f73363456748a6019d349408a18f68ac986e97827c.webp)

9. To retrieve your credentials, return to the **External Client App Manager**, select the dropdown, then select **Edit Settings**. Verify via email to reveal the **Consumer Key** (client ID) and **Consumer Secret** (client secret).

   ![Reveal the Consumer Key and Consumer Secret](/_fern-img/8c84b481e66f0249aac08e63d023d265f64a3056b73964dd8768666547f56adb.webp)

### Set up the Flow in Salesforce

Create a custom Flow to return queue availability and wait time attributes.

**To set up the Flow:**

1. Go to **Process Automation > Flows** in **Setup**, and select **New Flow**

2. Select **Autolaunched Automations > Autolaunched Flow (No Trigger)**

   ![New Process Automation](/_fern-img/a4a312bd57e70b9ec21d5a2cf454830a1352af4a441913244f58473e8f52fb25.webp)

3. Between the Start and End elements, select the **+** symbol and add an **Action** element, selecting the **Check Availability for Routing** action. Select the following options:

   ![Check Availability for Routing](/_fern-img/16daf3f66ee86f17ec8dfd7c4439337b38eb711bcd19888f60fc98d0d1650453.webp)

   1. *Service Channel:* Messaging

   2. *Check Availability for:* Queue

   3. *Queue > Use variable:* \{!queueId}

      > **Note**
      >
      > You can also set a fixed queue with *Select Queue*.

   4. *Select Output:* Return all

   5. Check *Manually assign variables*

      * Add variables to the respective fields.

        ![Assign Variables](/_fern-img/76275f3b132d6405fd8be7321c06ffd8f9fa81de8f043212890dea7e7cba9363.webp)

   6. On the upper left, select Toolbox and go to Manager > Resources > Variables.

      1. Ensure that **queueId** has *Available for input* selected.

      2. Ensure that the other variables (from *Store Output Values*) has *Available for output* selected.

         ![Store Output Variables](/_fern-img/0ba533367caba807e008311e62c6ca5f53406049a3c44f2a6a1ee7a869dbd137.webp)

### Set up the Handoff in Ada

Configure HTTP Request blocks in your [Handoff](/docs/handoffs) to call the Salesforce endpoints.

**To set up the Handoff:**

1. **The token endpoint**: Add an HTTP Request block to generate an access token for calling the flow endpoint. Store the Client ID and Client Secret in the token vault, and save the access\_token as a sensitive variable.

   For example: `https://**{{subdomain}}**.sandbox.my.salesforce.com/services/oauth2/token?grant_type=client_credentials&client_id=**{{salesforce_client_id}}**&client_secret=**{{salesforce_client_secret}}**`

   ![HTTP Request Block Setup](/_fern-img/04c970df18cd87f89354177d7ef9aae6624023f996d4a89d8dc9da82473c26ae.webp)

2. **The custom flow endpoint**, called by adding the flow name to the URL and passing the access token as a bearer token in the request header.

   > **Tip**
   >
   > If you're using a variable to select the queue, pass the id in the body using this key: `inputs[0].queueId`.

   For example: `https://**{{subdomain}}**.sandbox.my.salesforce.com/services/data/v64.0/actions/custom/flow/**{{flow_name}}**`.

   ![Call Custom Endpoints](/_fern-img/0a8435f44b761b7a727a191b005721f009ead4177eb1210b09e7a6b2c8f4d40f.webp)

From there, you can store the relevant outputs using the `key 0.outputValues.{{variableName}}`. These values can then be used in conditional logic or surfaced to end users via a Text block before reaching the Salesforce Messaging Utils block.

---

Have any questions? Contact your Ada team, or email us at [](mailto:help@ada.cx?subject=Help%20Docs%20inquiry).