In order to route the SMS Messages to the Salesforce Agentforce Agent, we have to make use of Omni-Channel Flow. In the Omni-Channel Flow, use Route Work Flow element and invoke the Agentforce Service Agent.
Prerequisite:
1. Salesforce SMS Messaging Channel is required. You can use the following link for reference.
2. Active Agentforce Service Agent.
Steps:
1. Create an Agentforce Service Agent. Activate the Agentforce Agent.
2. Create an Omni-Channel Flow. Use the “Route Work” Flow element.

Here, recordId is an input variable in the Salesforce Flow. When the Messaging Session is routed, the Omni-Channel will contain or hold the Messaging Session record Id in the recordId input variable. The API Name of the input variable is case-sensitive.

3. In the SMS Messaging Channel Configuration, use the Routing Type as “Omni-Flow” and select the Omni-Channel Flow in the “Flow Definition”.
