/sf-agentforce:service-agentforce-channel-configurefrom Salesforce — Agentforce & Data 360
Wires an existing Agentforce agent to a messaging, voice, or email channel by setting up a fallback queue and inbound routing (PATCH SessionHandlerId or RoutingFlow). Use when adding a channel to an existing agent; channel infrastructure must already exist.
Ships in Salesforce — Agentforce & Data 360. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Adds inbound routing between an existing channel and an existing Agentforce agent. The agent receives work items from the channel; a fallback queue handles overflow when the agent is unavailable.
This skill is generic — it works for any Agentforce agent, not just the Help Agent template.
In scope:
QueueSobject SobjectTypesessionHandlerType=AgentforceServiceAgent + sessionHandlerQueue on an existing MessagingChannel, then binding SessionHandlerId via Data API PATCHPstnVoice MessagingChannel already exist (provisioned by the caller, e.g. service-helpagent-coordinate), then creating an inbound RoutingFlow (routingType: Copilot) that routes to the agent with the queue as fallbackBotEmailDefinition (Email Configuration) that links the agent to Service Email and binding it to the routing addressservice-agentforce-human-escalation-configureOut of scope:
agentforce-generate or service-helpagent-coordinateservice-digital-engagement-channel-configureservice-digital-engagement-deployment-configureDeveloperName and agent label (MasterLabel) — must be an existing, active agentDeveloperName (Branch A), or the channel name/context (Branches B/C)Validate AGENT_DEVELOPER_NAME matches ^[A-Za-z][A-Za-z0-9_]{0,79}$, and every other input per references/input-validation.md, before the first command. On a mismatch, stop and ask; never escape and continue.
Steps are sequential. Read references/channel-types.md first to confirm the routing branch before proceeding.
This skill performs metadata/data writes (MessagingChannel edits, RoutingFlow deploys, agent republish). Before any write, classify the target org and refuse real production:
sf data query --target-org $ORG --json \
--query "SELECT Id, IsSandbox, TrialExpirationDate, OrganizationType FROM Organization LIMIT 1"
safe_to_write is true only when IsSandbox=true, OR TrialExpirationDate is non-null (trial/CDO), OR OrganizationType is Developer Edition / Base Edition.safe_to_write is false, stop — state plainly that this is a real production customer org and escalation/channel wiring will not be applied. Do not proceed to any write phase.safe_to_write is true, show the write plan (which MessagingChannel/RoutingFlow/agent will change) and get explicit user confirmation of the target org before continuing.Never bypass this gate — a mistaken production write here reroutes live customer traffic.
Confirm the agent exists and has an active version:
# Get the definition
sf data query --target-org $ORG --json \
--query "SELECT Id, DeveloperName, MasterLabel FROM BotDefinition WHERE DeveloperName='{AGENT_DEVELOPER_NAME}'"
# Check for an Active version
sf data query --target-org $ORG --json \
--query "SELECT Id, Status FROM BotVersion WHERE BotDefinitionId='{BOT_DEFINITION_ID}' AND Status='Active' LIMIT 1"
Stop with a clear message if the definition is not found or no version has Status = Active.
Branch A caveat — an Active BotVersion is necessary but NOT sufficient to bind as
sessionHandlerAsa. The platform only accepts an agent that is provisioned/connected as a deployable Agentforce Service Agent (typically anExternalCopilot). Binding an agent that is merely Active fails the Phase 2 deploy withOnly active Agentforce Service Agents are supported for a Messaging Channel. Confirm bindability read-only before writing: if any MessagingChannel on the org already usessessionHandlerType=AgentforceServiceAgent, retrieve it (sf project retrieve start --metadata "MessagingChannel:{EXISTING}" --target-org $ORG) and read its<sessionHandlerAsa>— that set is the org's provably-bindable ASAs. If the chosen agent is not a provisioned ASA and no bindable ASA exists, stop and reportBLOCKED: provide an agent that is provisioned as an Agentforce Service Agent.
Resolve the fallback queue and routing configuration — follow references/queue-resolution.md:
references/channel-types.md)AskUserQuestion or create newQueueRoutingConfig; create one with the correct capacity percentage if absentQUEUE_DEVELOPER_NAME, QUEUE_NAME, and QUEUE_IDBefore any routing change (Branches A/B: at Phase 2 start; Branch C: after its Step 1 address choice), detect whether the channel already has active inbound routing. If it does, first check whether the user's prompt already answered the timing choice ("do not cut over" / "wire manually" / "review first" → defer silently; "cut over now" / "activate immediately" → proceed silently). Only if the prompt is silent, warn via AskUserQuestion and let the user choose "Re-route now" or "Set up, then wire manually" — and on any ambiguous or no-selection response, default to the deferred path (never to a live re-route). When deferred, set DEFER_INBOUND_ROUTING=true, skip every step that binds the channel or routing address to the agent, and print the manual wiring instructions at the end of Phase 2.
If the channel has no existing routing, skip this gate entirely and proceed directly.
Full detection queries, exact AskUserQuestion block, deferred-flow rules per branch, and manual-wiring copy: references/live-traffic-gate.md.
No RoutingFlow required. Deploy the MessagingChannel with sessionHandlerType + sessionHandlerQueue only, then bind the bot via a Data API PATCH. sessionHandlerAsa is not accepted by the Metadata API at v67 — the deploy silently drops it and SessionHandlerId stays null unless you run the PATCH. The bot must be Active before the PATCH ("Only active Agentforce Service Agents are supported" otherwise).
Run all five steps in order. Perform retrieve and edit in the current SFDX project, so the deploy reads the edited .messagingChannel-meta.xml from force-app; do not use a temporary directory.
Retrieve the current MessagingChannel metadata into the working-directory project:
sf project retrieve start \
--metadata "MessagingChannel:{CHANNEL_DEVELOPER_NAME}" \
--target-org $ORG
Edit the retrieved .messagingChannel-meta.xml in place — set exactly these two fields (do NOT add <sessionHandlerAsa>):
<sessionHandlerType>AgentforceServiceAgent</sessionHandlerType>
<sessionHandlerQueue>{QUEUE_DEVELOPER_NAME}</sessionHandlerQueue>
Apply this edit with the file-editing tool (Edit/Write) so the change is saved to the retrieved file at force-app/main/default/messagingChannels/{CHANNEL_DEVELOPER_NAME}.messagingChannel-meta.xml in the working directory — do not hand-edit it through an inline sed/cat heredoc into a temp path. The deploy in step 3 must read this same on-disk file.
Deploy:
sf project deploy start \
--metadata "MessagingChannel:{CHANNEL_DEVELOPER_NAME}" \
--target-org $ORG
If the deploy fails with Only active Agentforce Service Agents are supported for a Messaging Channel, the agent is not a bindable ASA on this org (see the Phase 1 caveat). Do not retry with the same agent — the channel is left unchanged (the failed deploy is atomic). Report BLOCKED with the remediation: bind an agent already provisioned as an Agentforce Service Agent, or provision this one, then re-run.
Bind the bot via Data API PATCH:
CHAN_ID=$(sf data query --target-org $ORG --json \
--query "SELECT Id FROM MessagingChannel WHERE DeveloperName='{CHANNEL_DEVELOPER_NAME}'" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
BOT_ID=$(sf data query --target-org $ORG --json \
--query "SELECT Id FROM BotDefinition WHERE DeveloperName='{AGENT_DEVELOPER_NAME}'" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
QUEUE_ID=$(sf data query --target-org $ORG --json \
--query "SELECT Id FROM Group WHERE Type='Queue' AND DeveloperName='{QUEUE_DEVELOPER_NAME}'" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
sf api request rest --method PATCH -o $ORG \
"/services/data/v67.0/sobjects/MessagingChannel/${CHAN_ID}" \
--body "{\"SessionHandlerId\":\"${BOT_ID}\",\"FallbackQueueId\":\"${QUEUE_ID}\"}"
# Expected: HTTP 204
Verify:
sf data query --target-org $ORG --json \
--query "SELECT SessionHandlerId, FallbackQueueId FROM MessagingChannel WHERE Id='${CHAN_ID}'"
Both SessionHandlerId and FallbackQueueId must be non-null.
No agent file changes — no republish needed. Proceed to Phase 3 (optional).
Wire the PstnVoice MessagingChannel through an inbound Copilot RoutingFlow, with the queue as fallback, and add the required modality voice: block before republishing the agent.
Follow references/channel-branch-voice.md end to end. Highlights:
PstnVoice MessagingChannel or have service-helpagent-coordinate provision one first using that skill's Voice channel reference; abort if the org uses a partner telephony provider (see references/channel-types.md).references/routing-flow.md, verifying ActiveVersionId is non-null.MessagingChannel metadata file for {CHANNEL_DEVELOPER_NAME} with sessionHandlerType=Flow, sessionHandlerFlow={FLOW_DEVELOPER_NAME}, sessionHandlerQueue={QUEUE_DEVELOPER_NAME}. Without this the flow is never executed and calls hang up. Verify SessionHandlerId starts with 300.modality voice: block (voice_id UgBBYS2sOqTuMpoF3BR0, "Mark", en_US) to the .agent file if missing; do not ask the user. Republish per references/agent-wiring.md.Proceed to Phase 3 (optional).
Let the user choose direct case-owner assignment or an Omni-Channel Copilot RoutingFlow. This branch requires API v68.0+, a connection service_email: surface, and a BotEmailDefinition.
Follow references/channel-branch-email.md end to end. Load-bearing gotchas (full walkthrough in that file):
--metadata-dir Settings:Case deploy, never a source --metadata Settings:Case deploy (it reads sourceApiVersion and mutates the user's project).AskUserQuestion): case-owner (caseOwner = the agent's bot user) or Omni-Channel flow (Copilot RoutingFlow + routingFlow/fallbackQueue). Resolve the bot user either way; routing fields go in the Step 4d deploy.connection service_email: surface via deactivate → publish → activate (a plain publish fails with couldn't find the default agent user). Batch the outbound route here too if escalation is wanted.--metadata-dir, then bind the routing address in one Settings:Case deploy (botEmailDefinition + Step 2 routing fields + the required casePriority). Stop on failure.Branch C is complete once the routing-address binding is verified. Proceed to Phase 3.
Authoritative owner: full agent-to-human escalation is owned by
service-agentforce-human-escalation-configure. This includes the escalation topic, planner coupling, staffed human queue, outbound flow, failure-threshold directives, republish, and deterministic verification.
After inbound routing is confirmed, ask the user:
"Inbound routing is now set up — the channel will route to [agent name]. Do you also want to configure outbound escalation so the agent can hand off to a human when requested?"
If yes, delegate to service-agentforce-human-escalation-configure. Pass the resolved agent,
channel type, context object, and fallback queue as known inputs. Do not duplicate that skill's
write or verification steps here.
| Rule | Rationale |
|---|---|
| Verify the agent exists and is Active before making any changes | Wiring a channel to a non-existent or inactive agent silently fails at runtime |
If the channel already has active inbound routing, honor an explicit defer/cutover intent in the prompt without asking; otherwise warn via AskUserQuestion and default to defer on ambiguity | Re-routing takes effect immediately and affects live traffic — queue and RoutingFlow creation always proceed; only the activation step is gated, and the safe default is non-destructive |
| When deferred, print exact manual wiring instructions before Phase 3 | The operator needs to know precisely what to run when they're ready to cut over |
| Never modify the MessagingChannel without retrieving the current metadata first | Overwriting without retrieval discards existing settings |
Branch A: no RoutingFlow, no agent republish; deploy sessionHandlerType + sessionHandlerQueue via metadata, then bind SessionHandlerId via Data API PATCH | The Metadata API silently drops sessionHandlerAsa at v67, so the bot binds via the PATCH and must be Active first |
| Branches B/C: always create a new RoutingFlow — never reuse existing org flows | OOB platform flows commonly have ActiveVersionId: null and cannot be referenced |
Branches B/C: use routingType: Copilot and copilotLabel — not QueueBased | QueueBased routes to the queue directly; Copilot routes to the agent first with the queue as fallback |
Queue Id must be queried and embedded in the RoutingFlow XML | The queueId parameter requires a hardcoded 18-char record Id — do not leave it empty |
Queue naming: {ChannelTypeLabel} Queue | Named after the channel type, not the agent |
| Outbound escalation is optional — never block inbound routing completion on it | Inbound and outbound are independent; inbound wiring is complete without the outbound step |
Branch C: deploy BotEmailDefinition via --metadata-dir, never --metadata BotEmailDefinition:<name> | Not in the CLI's SDR registry, so the named-type deploy fails; metadata-format works |
Branch C: do not wire an agent carrying a ServiceCustomerVerification topic to email | Detect and stop — do not auto-remove (may be legitimate for a multi-surface agent). See channel-branch-email.md Step 4a |
QueueSobject record with the correct SobjectType for the channel typeQueueRoutingConfig with the correct CapacityPercentage (50 / 100 / 25 for Chat / Voice / Email)SessionHandlerType = AgentforceServiceAgent after deploySessionHandlerId is non-null after the Data API PATCH (matches the bot's BotDefinition.Id, starts with 0Xx)FallbackQueueId is non-null after the Data API PATCH (matches the resolved queue Id)ActiveVersionId is non-nullroutingType = Copilot in the flow's routeWork actioncopilotLabel matches the agent's exact MasterLabelqueueId is populated (non-empty)EmailRoutingAddress record created with correct PersonalName and AddresscaseOrigin, saveEmailHeaders: true, addressType: EmailToCaseEinsteinServiceAgent with a bot user holding agentforceServiceAgentUser; active version carries the ServiceEmail surface; no ServiceCustomerVerification topic on the email agentEmailTemplate is SFX, HTML, public, and contains [[[GENERATED_CONTENT]]] + [[[LEGAL_DISCLOSURE]]]BotEmailDefinition deployed via --metadata-dir with success: true; legalDisclaimer/signature ≥10 charsbotEmailDefinition child set to the deployed component fullNamecaseOwner+caseOwnerType or routingFlow+fallbackQueue, with casePriority presentservice-agentforce-human-escalation-configure returned CONFIGURED or ALREADY-CONFIGURED| File | When to read |
|---|---|
references/input-validation.md | Before any command — input grammars, free text |
references/channel-types.md | Phase 1 — determine SobjectType and routing branch |
references/queue-resolution.md | Phase 1 — queue lookup, creation, and Id capture |
references/live-traffic-gate.md | Phase 2 — detection queries, deferred-flow rules, and manual wiring copy for the live-traffic warning gate |
references/channel-branch-voice.md | Branch B — full Voice inbound wiring: PstnVoice channel selection, RoutingFlow, MessagingChannel assignment, modality voice: republish |
references/channel-branch-email.md | Branch C — full Email-to-Case wiring: API v68.0+ precondition gate, CaseSettings flags, EmailRoutingAddress + read-modify-write patch, inbound RoutingFlow, mandatory connection service_email: surface block, headless BotEmailDefinition deploy, routing-address binding |
references/botemaildefinition.md | Branch C Step 4 — BotEmailDefinition fields, save-time validation order, ASA template rules, --metadata-dir deploy recipe, ServiceEmail surface prerequisite, composite org gate |
references/routing-flow.md | Branches B/C — inbound RoutingFlow XML template, deploy, verify |
references/agent-wiring.md | Phase 3 (optional) — outbound escalation connection block |
assets/BotEmailDefinition.botEmailDefinition-meta.xml | Branch C Step 4c — starting template for the BotEmailDefinition source file |
assets/mdapi-package.xml | Branch C Step 4c — metadata-format package.xml for the --metadata-dir deploy |
assets/email/unfiled$public/AgentforceForServiceEmailTemplate.email + .email-meta.xml | Branch C Step 4b (fallback) — minimal ASA-compliant SFX reply template when the user has none |
scripts/validate-botemaildefinition.py | Branch C Step 4c — validate the BotEmailDefinition file before deploy |
scripts/validate-emailtemplate.py | Branch C Step 4b (fallback) — validate the SFX template before deploy |
assets/BotEmailDefinition.botEmailDefinition-meta.xml (opens in a new tab)assets/email/unfiled$public/AgentforceForServiceEmailTemplate.email (opens in a new tab)assets/email/unfiled$public/AgentforceForServiceEmailTemplate.email-meta.xml (opens in a new tab)assets/mdapi-package.xml (opens in a new tab)assets/settings-mdapi-package.xml (opens in a new tab)references/agent-wiring.md (opens in a new tab)references/botemaildefinition.md (opens in a new tab)references/channel-branch-email.md (opens in a new tab)references/channel-branch-voice.md (opens in a new tab)references/channel-types.md (opens in a new tab)references/input-validation.md (opens in a new tab)references/live-traffic-gate.md (opens in a new tab)references/queue-resolution.md (opens in a new tab)references/routing-flow.md (opens in a new tab)scripts/validate-botemaildefinition.py (opens in a new tab)scripts/validate-emailtemplate.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-agentforce3 plugins in 2 repositories ship this exact skill · first indexed Nov 14, 2026
16 skills in this plugin
/afcc-setup-coordinateOrchestrates end-to-end headless setup of Agentforce Contact Center (AFCC) on a Salesforce org. Scans the org first, presents a delta plan for approval, then sequentially provisions demo users, Omni-Channel base settings, a human queue with routing config and members, presence statuses, permission sets, a PSTN voice number, and an active PstnVoice MessagingChannel wired to the queue. Interactive at key decision points — never assumes country, number type, queue names, or user counts. TRIGGER: set up AFCC, configure Agentforce Contact Center, stand up voice contact center, AFCC migration setup, provision AFCC org headlessly./agentforce-bot-upgradeUse this skill to upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec generation, agentforce-generate authoring, and post-conversion .agent enhancements. TRIGGER when: user asks to migrate, upgrade, or convert one or more Einstein Bots (BotDefinition/BotVersion chatbots) to Agentforce agents; runs a multi-bot bot-to-agent upgrade; needs Einstein Bot metadata turned into Agent Spec handoffs and generated .agent agents; convert bots to agents; upgrade my service bots; move bots to Agentforce. DO NOT TRIGGER when: user already has an approved Agent Spec and only wants direct .agent authoring, deploy, test, or observe flows; user wants to migrate or upgrade an EXISTING Agentforce agent from a legacy GenAiPlannerBundle to an NGA aiAuthoringBundle (that is agentforce-generate's 'Migrate a Legacy Agent to Agent Script' flow, not an Einstein Bot upgrade); the request is unrelated to Einstein Bot migration./agentforce-d360-analyzeData Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use agentforce-architecture-analyze instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud./agentforce-hyperclassifier-configureOnboard a customer org and evaluate or improve Agentforce HyperClassifier routing descriptions against labeled utterances. TRIGGER for classifier evaluation, expected-versus-actual routing reports, repeated regressions, or description optimization with customer ECA authentication. DO NOT TRIGGER for general agent conversation testing, runtime session tracing, or automatic agent deployment./agentforce-observeAnalyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM) alerts. TRIGGER when: user queries STDM session data or Data Cloud trace records; investigates production agent failures, regressions, or performance issues; asks about session traces, conversation logs, or agent metrics; wants to reproduce a reported production issue in preview; runs findSessions or trace analysis queries; creates, lists, updates, or deletes an AHM data alert on an agent metric (escalation rate, deflection, etc.); asks why an alert is not firing or wants to check whether alerts have fired (notification counts, or the per-alert Incidents view). DO NOT TRIGGER when: user creates, modifies, or debugs .agent files during development (use agentforce-generate); writes or runs test specs (use agentforce-test); uses sf agent preview for local development iteration; deploys or publishes agents./agentforce-offline-experimentation-runUse this skill when users want to execute this workflow when a user wants to test how a different LLM model would handle existing Agentforce agent conversations. Trigger when users mention agentforce, offline, experimentation.Other plugins' skills for the same job