routing-inbound-messaging-to-agentforce-agent
Installation
SKILL.md
Routing Inbound Messaging to an Agentforce Agent
What this skill is for
When a customer opens an In-App or Web messaging widget and starts a chat, Salesforce creates a MessagingSession and invokes the channel's session-handler flow to decide where the conversation goes. This skill builds the whole inbound path so a new chat lands on an Agentforce (ASA) agent:
Customer opens web/in-app chat (fills pre-chat form: Phone, First, Last)
→ MessagingChannel (EmbeddedMessaging) invokes its sessionHandlerFlow
→ RoutingFlow (recordId = MessagingSession Id, CustomerPhone = pre-chat phone)
Get MessagingSession → findMatchingIndividuals(phone) → Get Contact
→ Update MessagingEndUser.ContactId (links the caller)
→ routeWork(routingType=Copilot → BotDefinition) ← hands to the agent
→ EmbeddedServiceConfig (the deployment/snippet the site embeds)
Two artifacts you (Claude) deploy by metadata, plus one artifact a human must build by hand in the Setup UI — Claude/the AI cannot create it end to end: