implementing-ui-bundle-agentforce-conversation-client

MUST activate when the project contains a uiBundles/*/src/ directory and the task involves adding or modifying a chat widget, chatbot, or conversational AI. Use this skill when the user asks to add, embed, integrate, configure, style, or remove an agent, chatbot, chat widget, conversation client, or AI assistant. Covers styling (colors, fonts, spacing, borders), layout (inline vs floating, width, height, dimensions), and props (agentId, agentLabel, headerEnabled, showHeaderIcon, showAvatar, styleTokens). Activate when files under uiBundles/*/src/ import AgentforceConversationClient or when adding any chat or agent functionality to a page. Never create a custom agent, chatbot, or chat widget component.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "implementing-ui-bundle-agentforce-conversation-client" with this command: npx skills add forcedotcom/afv-library/forcedotcom-afv-library-implementing-ui-bundle-agentforce-conversation-client

Managing Agentforce Conversation Client

HARD CONSTRAINT: NEVER create a custom agent, chatbot, or chat widget component. ALL such requests MUST be fulfilled by importing and rendering the existing <AgentforceConversationClient /> from @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client as documented below. If a requirement is unsupported by this component's props, state the limitation — do not improvise an alternative.

Prerequisites

Before the component will work, the following Salesforce settings must be configured by the user. ALWAYS call out the prequisites after successfully embedding the agent.

Cookie settings:

  • Setup → My Domain → Disable "Require first party use of Salesforce cookies"

Trusted domains (required only for local development):

  • Setup → Session Settings → Trusted Domains for Inline Frames → Add your domain
    • Local development: localhost:<PORT> (e.g., localhost:3000)

Instructions

Step 1: Check if component already exists

Search for existing usage across all app files (not implementation files):

grep -r "AgentforceConversationClient" --include="*.tsx" --include="*.jsx" --exclude-dir=node_modules

Important: Look for React files that import and USE the component (for example, shared shells, route components, or feature pages). Do NOT open files named AgentforceConversationClient.tsx or AgentforceConversationClient.jsx - those are the component implementation.

If found: Read the file and check the current agentId value.

Agent ID validation rule (deterministic):

  • Valid only if it matches: ^0Xx[a-zA-Z0-9]{15}$
  • Meaning: starts with 0Xx and total length is 18 characters

Decision:

  • If agentId matches ^0Xx[a-zA-Z0-9]{15}$ and user wants to update other props → Go to Step 4 (update props)
  • If agentId is missing, empty, or does NOT match ^0Xx[a-zA-Z0-9]{15}$ → Continue to Step 2 (need real ID)
  • If not found → Continue to Step 2 (add new)

Step 2: Get agent ID

If component doesn't exist or has an invalid placeholder value, ask user for their Salesforce agent ID.

Treat these as placeholder/invalid values:

  • "0Xx..."
  • "Placeholder"
  • "YOUR_AGENT_ID"
  • "<USER_AGENT_ID_18_CHAR_0Xx...>"
  • Any value that does not match ^0Xx[a-zA-Z0-9]{15}$

Skip this step if:

  • Component exists with a real agent ID
  • User only wants to update styling or dimensions

Step 3: Canonical import strategy

Use this import path by default in app code:

import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";

If the package is not installed, install it:

npm install @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client

Only use a local relative import (for example, ./components/AgentforceConversationClient) when the user explicitly asks to use a patched/local component in that app.

Do not infer import path from file discovery alone. Prefer one consistent package import across the codebase.

Step 4: Add or update component

Determine which sub-step applies:

  • Component NOT found in Step 1 → go to 4a (New installation)
  • Component found in Step 1 → go to 4b (Update existing)

4a — New installation

  1. If the user already specified a target file, use that file. Otherwise, ask the user: "Which file should I add the AgentforceConversationClient to?" Do NOT proceed until a target file is confirmed.
  2. Read the target file to understand its existing imports and TSX structure.
  3. Add the import at the top of the file, alongside existing imports. Use the canonical package import from Step 3:
import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";
  1. Insert the <AgentforceConversationClient /> TSX into the component's return block. Place it as a sibling of existing content — do NOT wrap or restructure existing TSX. Use the real agentId obtained in Step 2: Example:
<AgentforceConversationClient agentId="0Xx8X00000001AbCDE" />
  1. Do NOT add any other code (wrappers, layout components, new functions) unless the user explicitly requests it.

4b — Update existing

  1. Read the file identified in Step 1.
  2. Locate the existing <AgentforceConversationClient ... /> TSX element.
  3. Apply only the changes the user requested. Rules:
    • Add new props that the user asked for.
    • Change prop values the user asked to update.
    • Preserve every prop and value the user did NOT mention — do not remove, reorder, or reformat them.
    • Never delete the component and recreate it.
  4. If the current agentId is a placeholder (failed validation in Step 1) and a real agent ID was obtained in Step 2, replace the placeholder value:
// Before
<AgentforceConversationClient agentId="Placeholder" />

// After
<AgentforceConversationClient agentId="0Xx8X00000001AbCDE" />
  1. If the current agentId is already valid and the user did not ask to change it, leave it as-is.

Step 5: Configure props

Available props (use directly on component):

  • agentId (string, required) - Salesforce agent ID
  • inline (boolean) - true for inline mode, omit for floating
  • width (number | string) - e.g., 420 or "100%"
  • height (number | string) - e.g., 600 or "80vh"
  • headerEnabled (boolean) - Show/hide header
  • styleTokens (object) - For all styling (colors, fonts, spacing)
  • salesforceOrigin (string) - Auto-resolved
  • frontdoorUrl (string) - Auto-resolved
  • agentLabel (string) - header title for agent

Examples:

Floating mode (default):

<AgentforceConversationClient agentId="0Xx..." />

Inline mode with dimensions:

<AgentforceConversationClient agentId="0Xx..." inline width="420px" height="600px" />

Adding or updating agent label:

<AgentforceConversationClient agentId="0Xx..." agentLabel="<dummy-agent-label>" />

Styling rules (mandatory):

  • ALL visual customization (colors, fonts, spacing, borders, radii, shadows) MUST go through the styleTokens prop. There are no exceptions.
  • ONLY use token names listed in the tables below. Do NOT invent custom token names.
  • NEVER apply styling via CSS files, style attributes, className, or wrapper elements. These approaches will not work and will be ignored by the component.
  • If the user requests a visual change that does not map to a token below, inform them that the change is not supported by the current token set.

Container

Token nameUI area themed
fabBackgroundFAB button background color
containerBackgroundChat container background
headerBackgroundHeader background
containerWidthChat container width
chatBorderRadiusChat border radius
layoutMaxWidthLayout max width

Agentforce Header

Token nameUI area themed
headerBlockBackgroundHeader block background
headerBlockBorderBottomWidthHeader border bottom width
headerBlockBorderBottomStyleHeader border bottom style
headerBlockBorderBottomColorHeader border bottom color
headerBlockBorderRadiusHeader corner radius
headerBlockPaddingBlockHeader block padding (vertical)
headerBlockPaddingInlineHeader inline padding (horizontal)
headerBlockMinHeightHeader minimum height
headerBlockBrandingGapHeader branding area gap
headerBlockFontFamilyHeader font family
headerBlockFontWeightHeader title font weight
headerBlockFontSizeHeader title font size
headerBlockLineHeightHeader title line height
headerBlockTextColorHeader text color
headerBlockIconDisplayHeader icon display
headerBlockIconMarginHeader icon margin
headerBlockIconColorHeader icon color
headerBlockIconWidthHeader icon width
headerBlockIconHeightHeader icon height
headerBlockLogoMaxHeightHeader logo max height
headerBlockLogoMaxWidthHeader logo max width
headerBlockLogoMinWidthHeader logo min width
headerBlockButtonHeightHeader action button height
headerBlockButtonWidthHeader action button width
headerBlockButtonPaddingHeader action button padding
headerBlockButtonBorderRadiusHeader action button border radius
headerBlockHoverBackgroundHeader hover background
headerBlockActiveBackgroundHeader active background
headerBlockFocusBorderHeader focus border

Agentforce Welcome Block

Token nameUI area themed
welcomeBlockTextContainerWidthWelcome text container width
welcomeBlockFontFamilyWelcome block font family
welcomeBlockFontSizeWelcome block font size
welcomeBlockFontWeightWelcome block font weight
welcomeBlockLineHeightWelcome block line height
welcomeBlockLetterSpacingWelcome block letter spacing
welcomeBlockTextColorWelcome block text color
welcomeBlockPaddingVerticalWelcome block vertical padding
welcomeBlockPaddingHorizontalWelcome block horizontal padding
welcomeBlockTextAnimationDurationWelcome text animation duration

Agentforce Messages

Token nameUI area themed
messageBlockBorderRadiusMessage block border radius
avatarDisplayAvatar display property (e.g. block, none)
hideMessageActionsMessage actions display (e.g. block, none to hide)
hideCopyActionCopy action button display (e.g. inline-flex, none)
messageBlockPaddingContainerMessage block container padding
messageBlockFontSizeMessage block font size
messageBlockBackgroundColorMessage block background (base)
messageBlockInboundBorderInbound message border
messageBlockOutboundBorderOutbound message border
messageBlockBodyWidthMessage block body width
messageBlockPaddingMessage block padding
messageBlockContainerMarginTopMessage block container top margin
messageBlockLineHeightMessage block line height

Avatar visibility (behavioral config)

Use renderingConfig.showAvatar to control whether avatars are rendered in message rows.

  • showAvatar: true (default) renders avatars.
  • showAvatar: false hides avatars by removing them from the DOM.

Inbound message (agent → customer)

Token nameUI area themed
inboundMessgeTextColorInbound message text color (base)
messageBlockInboundBorderRadiusInbound message border radius
messageBlockInboundBackgroundColorInbound message background
messageBlockInboundTextColorInbound message text color
messageBlockInboundWidthInbound message width
messageBlockInboundTextAlignInbound message text alignment
messageBlockInboundHoverBackgroundColorInbound message hover background

Outbound message (customer → agent)

Token nameUI area themed
messageBlockOutboundBorderRadiusOutbound message border radius
messageBlockOutboundBackgroundColorOutbound message background
messageBlockOutboundTextColorOutbound message text color
messageBlockOutboundWidthOutbound message width
messageBlockOutboundMarginLeftOutbound message left margin
messageBlockOutboundTextAlignOutbound message text alignment

Agentforce Input

Token nameUI area themed
messageInputPaddingMessage input container padding
messageInputFooterBorderColorMessage input footer border color
messageInputBorderRadiusMessage input border radius
messageInputBorderTransitionDurationMessage input border transition duration
messageInputBorderTransitionEasingMessage input border transition easing
messageInputTextColorMessage input text color
messageInputTextBackgroundColorMessage input text background color
messageInputFooterBorderFocusColorMessage input footer focus border color
messageInputFocusShadowMessage input focus shadow
messageInputMaxHeightMessage input max height
messageInputLineHeightMessage input line height
messageInputTextPaddingMessage input text padding
messageInputFontWeightMessage input font weight
messageInputFontSizeMessage input font size
messageInputOverflowYMessage input overflow Y
messageInputScrollbarWidthMessage input scrollbar width
messageInputScrollbarColorMessage input scrollbar color
messageInputActionsWidthMessage input actions width
messageInputActionsPaddingRightMessage input actions right padding
messageInputFooterPlaceholderTextMessage input placeholder text color
messageInputPlaceholderFontWeightPlaceholder font weight
messageInputErrorTextColorMessage input error text color
messageInputActionsGapMessage input actions gap
messageInputActionsPaddingMessage input actions padding
messageInputActionButtonSizeMessage input action button size
messageInputActionButtonRadiusMessage input action button radius
messageInputFooterSendButtonMessage input send button color
messageInputSendButtonDisabledColorMessage input send button disabled color
messageInputActionButtonFocusBorderMessage input action button focus border
messageInputActionButtonActiveIconColorMessage input action button active icon color
messageInputActionButtonActiveBackgroundMessage input action button active background
messageInputSendButtonIconColorMessage input send button icon color
messageInputFooterSendButtonHoverColorMessage input send button hover color
messageInputActionButtonHoverShadowMessage input action button hover shadow
messageInputFilePreviewPaddingMessage input file preview padding
messageInputTextareaMaxHeightMessage input textarea max height
messageInputTextareaWithImageMaxHeightMessage input textarea max height (with image)

Agentforce Error Block

Token nameUI area themed
errorBlockBackgroundError block background color

Styling with styleTokens:

<AgentforceConversationClient
  agentId="0Xx..."
  styleTokens={{
    headerBlockBackground: "#0176d3",
    headerBlockTextColor: "#ffffff",
    messageBlockInboundBackgroundColor: "#4CAF50",
  }}
/>

For complex patterns, consult references/examples.md for:

  • Sidebar containers and responsive sizing
  • Dark theme and advanced theming combinations
  • Inline without header, calculated dimensions
  • Complete host component examples

Common mistakes to avoid: Consult references/constraints.md for:

  • Invalid props (containerStyle, style, className)
  • Invalid styling approaches (CSS files, style tags)
  • What files NOT to edit (implementation files)

Common Issues

If component doesn't appear or authentication fails, see references/troubleshooting.md for:

  • Agent activation and deployment
  • Localhost trusted domains
  • Cookie restriction settings

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

developing-agentforce

No summary provided by upstream source.

Repository SourceNeeds Review
General

generating-apex

No summary provided by upstream source.

Repository SourceNeeds Review
General

generating-apex-test

No summary provided by upstream source.

Repository SourceNeeds Review
General

generating-flow

No summary provided by upstream source.

Repository SourceNeeds Review