Skip to main content

Set Up the Messaging Connection

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain how the Messaging connection and Omni-Channel flows route conversations.
  • Configure a service channel, routing configuration, and queue.
  • Build inbound and outbound Omni-Channel flows for messaging.
  • Describe how the Escalation subagent hands off to a service rep.

Start Where Customers Chat

Warren's rollout plan at Northern Trail Outfitters (NTO) starts with messaging, which is the channel that its customers reach for first. But before Warren can drop a chat window onto the website, he has to solve a more fundamental question: When a customer sends a message, how does it reach the agent? And when the AI agent can't help, how does the conversation then reach a service rep? That's the job of the Messaging connection and its routing.

For the service agent that NTO is deploying, Warren will create an Enhanced Web Chat channel that can be embedded on its website.

How Routing Works

Agentforce can use Omni-Channel to route conversations to and from your agent. The Messaging connection relies on two Omni-Channel flows.

  • Inbound flow: When a new conversation starts, this flow routes it to the AI agent.
  • Outbound flow: When the agent needs to escalate, this flow routes the conversation from the AI agent to a queue of your service reps.

Set Up the Prerequisites

Warren builds three prerequisites that the Omni-Channel flows depend on.

  • Service channel
  • Routing configuration
  • Queue

Create a Service Channel

The service channel links the routing configuration and Omni-Channel flows to the Messaging Session object.

  1. From Setup, in the Quick Find box, enter Service Channels, and then select Service Channels.
  2. If you already have a Messaging service channel, go to the next step. If not, click New.
    1. For the name of the service channel, Warren enters NTO Help Center.
    2. For the Salesforce object, select Messaging Session.
  3. Save the service channel.

Create a Routing Configuration

The routing configuration defines how messaging sessions in the queue are assigned to service reps.

  1. From Setup, in the Quick Find Box, enter Routing, and then select Routing Configurations.
  2. Click New.
    1. For the routing configuration name, enter Messaging Routing.
    2. For the routing priority, enter 1.
    3. For the routing model, select Least Active.
    4. For the capacity type, select Inherited.
    5. For the percentage of capacity, enter 25.
  3. Save the routing configuration.

A screenshot of a routing configuration that determines how messaging sessions in the queue are assigned to service reps.

Create a Queue

When your inbound Omni-Channel flow can't route a conversation to your agent, or when your agent escalates a conversation, the conversation routes to this queue. The queue assigns the messaging session to service rep based on your routing configuration settings.

  1. From Setup, in the Quick Find Box, enter Queues, and then select Queues.
  2. Click New.
  3. For the label, enter Messaging.
  4. For the routing configuration, enter Messaging_Routing.
  5. For the supported objects, select Messaging Session.
  6. For the queue members, select yourself as the service rep.
  7. Save the queue.

A screenshot of a queue that assigns messaging sessions to service reps.

With all the pieces in place, Warren can build the outbound and inbound flows in Flow Builder.

How the Outbound Flow Works

Agentforce Service agents use the Escalation subagent and an outbound Omni-Channel flow to escalate conversations to destinations like service reps and queues.

Like any subagent, the Escalation subagent has instructions that tell the agent when to act. For example, the agent might escalate the conversation when:

  • A customer explicitly asks for a person.
  • Sentiment turns negative.
  • The request falls outside the scope of what the agent can handle.

When those conditions are met, the AI agent would trigger the outbound flow.

The flow verifies if service reps are available in the Messaging queue. If available, it updates the messaging session and applies the Route Work action to forward the session and conversation history to that queue. Then a service rep can pick up right where the agent left off. The result is a smooth handoff: The agent handles what it can, and the customer never has to repeat themselves when a service rep steps in.

If no reps are available and escalation fails, the agent resumes the conversation using the Escalation subagent, retaining pre-escalation context. Escalation is attempted only once per session.

Create the Outbound Omni-Channel Flow

Warren creates an outbound Omni-Channel flow to route escalated conversations from the AI agent to a messaging queue for Northern Trail Outfitter’s service reps. If you’re not sure how to build an outbound flow, see Transfer Conversations from an Agent with an Omni-Channel Flow in Salesforce Help.

For a step-by-step walkthrough of an outbound escalation flow, check out the Deploy Your Agent to Channels chapter of the Agentforce Implementation Guide.

An example of an outbound Omni-Channel flow in Flow Builder that escalates conversations to a service queue.

Add the Messaging Connection

Now that Warren has created the outbound flow, he can start setting up the Messaging connection for the service agent in Agentforce Builder. The Messaging connection includes behind-the-scenes instructions and adaptive response formats that help the agent reason and respond on Enhanced Web Chat channels.

  1. From the App Launcher, enter Agent, and then select the Agentforce Studio app.
  2. On the Agents tab, click the name of your agent.
  3. On the Explorer panel, click + next to Connections. Then select Add Connection.
  4. On the Add Connections window, select the Messaging connection. Then, click Add to Agent.

Connect the Outbound Omni-Channel Flow

To connect the outbound flow to the agent, Warren adds it as an escalation flow in the agent’s Messaging connection settings.

  1. In Agentforce Builder, on the Explorer panel, select the Messaging connection’s Settings page.
  2. On the canvas, in the Escalation section, select the Route Messaging Session to Queue flow that you created. If your flow doesn’t appear in the list, activate the flow and try again.
  3. Edit the escalation message that the agent sends before it transfers a conversation so that customers know what to expect. Enter One moment while I check if there are any Northern Trail Outfitter reps available.
  4. Click Save.
  5. Click Commit Version.
  6. Click Activate. If you don’t activate the agent, it won’t show up as a routing option in Flow Builder when you build the inbound flow.

How the Inbound Flow Works

Now that you know how the outbound flow works, let’s turn our attention to the inbound flow. The inbound flow uses the Route Work action to route a conversation and its associated records to an agent, such as messaging session and email records.

Warren plans to create an inbound omni-channel flow that routes messaging sessions from the company’s website to the NTO service agent. When a customer interacts with an agent on a channel, a messaging session record associated with the conversation is created. Then, the inbound Omni-Channel flow routes the record from the channel to an agent.

The flow receives the messaging session record and details gathered from a pre-chat form. Then, it checks if the messaging user is an existing contact. Finally, it uses the Route Work action to route the session to the agent. If routing to the agent isn’t possible, the flow sends the messaging session to the Messaging queue instead.

Create an Inbound Omni-Channel Flow

Next, Warren rolls up his sleeves and gets started on the inbound flow for the NTO agent. He connects the agent to Messaging using Enhanced Chat v1. But if you don’t use Enhanced Chat v1, you can connect your agent to a different type of messaging channel.

For a step-by-step walkthrough of an inbound flow, see the Deploy Your Agent to Channels chapter of the Agentforce Implementation Guide.

An example of an inbound Omni-Channel flow in Flow Builder that identifies the customer contact record and routes the conversation to the AI service agent.

Customize Connection Instructions and Response Formats

After setting up your routing flows, you can further refine how your agent communicates on the Messaging channel. Connection instructions let you guide how your agent reasons and responds on this specific channel; for example, you can instruct the agent to use a particular response format or follow specific guidelines for messaging interactions. Adaptive response formats let you customize the way the agent structures its responses for the channel.

For more information, see Manage Connection Instructions and Response Formats in Salesforce Help.

Prepare the Service Team for Escalated Conversations

NTO wants to equip its service reps with the tools reps need to manage escalated messaging conversations. By adding the reps as service resources, the reps can receive messaging sessions and have presence statuses that indicate their availability.

Help reps monitor and join conversations by adding the Omni-Channel sidebar and a custom Messaging Session record page to the Service Console app.

  • To let service reps receive messaging sessions, add each rep as a service resource.
  • To indicate if a service rep is available or not to receive messaging sessions, create at least two presence statuses that reps can set in the service console.
  • To let service reps accept and manage messaging sessions in the Service Console app with the Omni-Channel sidebar, add the sidebar with messaging sessions to the Service Console interface and give reps access to it.

Next Up: Testing on the Website

Now that Warren has set up the messaging connection and all the routing, he can actually embed the agent in the NTO website. In the next unit, Warren creates an Experience Cloud site to test the agent on.

Resources

Comparta sus comentarios sobre Trailhead en la Ayuda de Salesforce.

Nos encantaría conocer su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios cuando quiera desde el sitio de la Ayuda de Salesforce.

Más información Continuar para compartir comentarios