Salesforce Messaging agent availability

Overview

This section explains how to set up a Salesforce Flow to retrieve agent availability and wait time attributes, which you can use to display information to end users or apply conditional logic before handing off to Salesforce.

Set up the Connected App in Salesforce

For Ada to authenticate and call the relevant endpoint, you’ll need to create a Connected App so that an access token can be generated using client credentials.

  1. In the Quick Find search field, search for External Client Apps. Then, under Apps > External Client Apps, select Settings.

  2. On the External Client App Settings page, under Connected Apps, click New Connected App.

    External Client App Settings
  3. On the New Connected App page, under Basic Information, complete the following fields:

    FieldNotes
    Connected App NameDisplayed in the App Manager and on its App Launcher tile.
    API NameThe API name used to reference your app programmatically. By default, this is a version of the app name with spaces removed. Only letters, numbers, and underscores are allowed, so if the original app name contains other characters, update the default value accordingly.
    Contact EmailThe contact email for Salesforce to use when contacting you or your support team in the event of an error.
  4. Go to Setup > Apps > App Manager, then go to the right drop-down of the respective Connected App and select Edit.

  5. Under API (Enable OAuth Settings), toggle Enable Client Credentials Flow on. Click Save at the bottom.

    Enable Client Credentials Flow
  6. Go to Apps > Manage Connected Apps and select Edit on the respective app. Next, under Client Credentials Flow at the bottom, add your profile for Run As .

    Profile to Client Credentials Flow

Set up the Flow in Salesforce

Once the Connected App with Client Credentials enabled is set up to generate an access token, you can create a custom flow to return the relevant queue attributes.

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

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

    New Process Automation
  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
    1. Service Channel: Messaging

    2. Check Availability for: Queue

    3. Queue > Use variable: {!queueId}

      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
    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

Setting up the Handoff in Ada

Once the Connected App and Custom Flow has been set up in Salesforce, you will need to set up two HTTP Request blocks in the respective Handoff:

  1. The token endpoint, 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}}**

    Call Custom Endpoints
  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.

    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}}**.

    HTTP Request Block Setup

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.