Create a Sample Outbound Flow and Handle Routing for Agentforce Service Agents

To help your customers efficiently set up an AI agent with Bring Your Own Channel for CCaaS, create a sample outbound Omni-Channel flow and include it in your managed package. When the Salesforce admin sets up the AI agent, they associate the agent with this outbound flow.

Setting up an AI agent for Bring Your Own Channel for CCaaS includes determining who handles routing for the messaging sessions to and from the AI agent. Routing can be owned by Salesforce Omni-Channel or by the partner system.

  • If Salesforce Omni-Channel owns the routing (routingOwner is Salesforce in the Conversation Channel Definition record), partners don’t need to handle routing to or from the AI agent. Salesforce handles this automatically.
  • If routing is partner-owned (routingOwner is Partner in the Conversation Channel Definition record), partners handle routing for the messaging session to and from the AI agent. After you or the Salesforce admin sets up an AI agent, follow the Handle Partner-Owned Routing steps to finish setting up routing for the flows associated with your AI agent. You will need the flow ID and fallback queue ID.

Before you begin, verify that you’ve enabled Bring Your Own Channel for CCaaS.

Create and package a sample Omni-Channel outbound flow to escalate conversations from an AI agent to reps when needed. When the Salesforce admin sets up the AI agent, they associate the agent with this outbound flow.

For your package, we recommend creating a flow configuration that reflects the expected business logic of your customers. Before you package the flow template, optionally test it to ensure that it's properly set up.

  1. Follow the steps in the Route Work Items to a Specific Agent Salesforce Help page to create a sample outbound Omni-Channel flow. The Salesforce admin uses this flow as a template to create the outbound flow for the AI agent. When you save the flow, select Template to save it as a template.
  2. Test the flow. This step is optional. Follow the steps to Set Up an Agentforce Service Agent for Bring Your Own Channel or Bring Your Own Channel for CCaaS. During the setup process, you'll associate the agent with the sample outbound flow you just created. Adjust the sample flow as needed.
  3. Create the managed package, adding the outbound Omni-Channel flow template to the package.

If routingOwner is Partner in the Conversation Channel Definition record, partners handle routing for the messaging session to and from the AI agent. If routingOwner is Salesforce, partners don’t need to handle routing to or from the AI agent. Salesforce handles this automatically.

Perform the API calls in the order listed to handle routing for the inbound Omni-Channel flow that connects a messaging end user to an AI agent.

  • Call the Interaction API (POST /api/v1/interactions) to create a conversation messaging session and a messagingEndUser record. This API execution returns a conversationIdentifier value used in the next step.
  • Call the Route API (POST /api/v1/route) with routingType set to initial and conversationIdentifier set to the conversationIdentifier value returned from the previous step. This executes the inbound Omni-Channel flow that’s associated with the messaging channel.
    • In the Route API payload, pass in the ID of flowDefinitionViewfor the flowId field. For the queueId field, pass in the ID of fallbackQueue. The customer provides these values.
    • The Route API response includes the salesforceBotId and psrId.

The AI agent is added to the conversation and sends a welcome message to the end user.

Perform the API calls in the order listed to handle routing for the outbound Omni-Channel flow that transfers a messaging end user from an AI agent to a rep.

  • A routing request event provides the flow ID of the outbound Omni-Channel flow. The flow can be customer-configured.
  • Call the Route API (POST /api/v1/route) with routingType set to transfer to execute the flow ID provided by the routing request event. Alternatively, transfer to the fallbackQueueId if the transfer to the outbound Omni-Channel flow fails.
  • The Omni-Channel flow uses the logic in the flow to route the conversation to a rep or queue. The flow returns the psrId with the userId (agent) or queueId (queue).
  • Call the agentWork API (POST /api/v1/agentWork) to create an AgentWork record when the system finds a potential rep or queue to handle the work item.
  • After routing completes, call the routingResult API (POST /api/v1/routingResult) to notify Salesforce whether the conversation succeeded or failed.

See Also