Skip to main content
2 answers
  1. Apr 13, 5:04 PM

    Initiating Employee Agent Conversations from a Button or LWC

    Yes, you can programmatically initiate an Agentforce Employee Agent (internal-facing agent) session from a button or LWC using the Agentforce API or the Einstein Bots/Agent REST APIs.

    Recommended approaches:

    1. Embedded Service / Agent API: Use the Agent REST API (POST /einstein/ai-agent/v1/sessions) to create a new agent session server-side from an Apex action, then surface the session in your LWC via a custom UI or the Salesforce Messaging In-App SDK.

    2. LWC + Apex callout pattern: In your LWC, call an Apex method (wire or imperative) that invokes the Agent API to start a session and returns the session ID. Render the conversation UI using the returned session context.

    3. AgentforceConversationKit (if available in your org): Check Setup [right arrow] Agents for any LWC-compatible conversation components provided out-of-the-box for embedding agent chat in internal pages.

    Note: Employee agents require the user to be authenticated in the org. External/unauthenticated initiation is not supported for this agent type.

0/9000