Loading...
Loading...
**INTERNAL USE ONLY — invoked by `service-de-headless-channel-configure` orchestrator.** Insert an Enhanced messaging `MessagingChannel` record (plus its child `MessagingChannelUsage` as a free server-side side-effect) of any supported type — WhatsApp, LINE, Apple Business Chat, Facebook, or SMS (Text). Given a `{MESSAGE_TYPE}` and the corresponding type-specific inputs, runs the shared preflight → Connect-insert → verify flow and branches only where a type genuinely differs (request body, prerequisites, error classes). Uses the sanctioned `POST /services/data/v{V}/connect/livemessage/channels` Connect REST endpoint — no Aura session, no token extracted into shell state. **Users should always invoke `service-de-headless-channel-configure` instead — it handles insert → route → activate in one flow.** Use this skill when inserting a messaging channel of any type; it replaces the four former per-type creation skills.
npx skill4agent add forcedotcom/sf-skills service-de-channel-create| Reference file | Load when |
|---|---|
| |
| |
| |
| |
| |
| Shared authProviderId lookup + Connect POST + response-classification detail (Stage 4). |
| End-to-end traces per type (fresh insert, preflight short-circuit, OAuth). |
{MESSAGE_TYPE}MessagingChannelPlatformType=EnhancedIsActive=falseLiveMessageSetupServiceImpl.addChannelLiveMessageChannelsUtil.findOrCreateCsotMessagingChannelMessagingChannelUsageDeploymentType=ConversationDeploymentStatus=NewDisabledPOST /services/data/v{V}/connect/livemessage/channelssf api request rest(MessagingPlatformKey, MessageType)MessagingChannel{ok, channelId, mcuId, developerName, isActive:false, messageType, messagingPlatformKey, path, created, durationMs} | Platform key ( | Prerequisite (caller supplies) | Body extras | Ref |
|---|---|---|---|---|
| Phone Number ID | | | |
| LINE channel id | LINE id + secret + token (LINE Developers Console) | | |
| Apple BC Account ID (GUID) | Apple BC Account ID (register.apple.com/business-chat) | (none — empty config) | |
| Facebook Page ID | OAuth handled internally | | |
| Phone number / short code | number already provisioned (caller supplies) | | |
WeChatMsCopilotAlexaunsupported-typeservice-de-headless-channel-configureservice-de-channel-routing-configureservice-de-channel-activatechannelId{MESSAGE_TYPE}WhatsAppLineAppleBusinessChatFacebookTextTextSMS{ORG_ALIAS}sfsf config get target-org{API_VERSION}sf org display --json | jq -r '.result.apiVersion'{CHANNEL_NAME}AppleBusinessChat{WABA_ID}externalAccountId{PHONE_NUMBER_ID}{ISO_COUNTRY_CODE}US{LINE_CHANNEL_ID}{LINE_CHANNEL_SECRET}{LINE_ACCESS_TOKEN}{VERIFY_TOKEN_FIRST}true{APPLE_BC_ID}{PAGE_ID}{SMS_NUMBER}{SMS_PROVIDER}smsProvidersmsProvider""""{ISO_COUNTRY_CODE}US{"ok": true, "channelId": "0Mj...", "mcuId": "0gL...", "developerName": "...",
"isActive": false, "messageType": "{MESSAGE_TYPE}", "messagingPlatformKey": "...",
"path": "connect" | "preflight", "created": true | false, "durationMs": 1234}created: falsepath: "preflight"{"ok": false, "kind": "wrong-skill", "correctSkill": "service-de-headless-channel-configure", "hint": "..."}
{"ok": false, "kind": "unsupported-type", "supportedTypes": ["WhatsApp","Line","AppleBusinessChat","Facebook","Text"], "hint": "..."}
{"ok": false, "kind": "missing-input", "missing": ["..."], "hint": "caller must provide all required inputs for this type"}
{"ok": false, "kind": "auth", "hint": "OAuth token invalid / expired — run 'sf org login web'"}
{"ok": false, "kind": "business", "message": "...", "errorCode": "..."}
{"ok": false, "kind": "transport","status": 500, "message": "..."}
{"ok": false, "kind": "verify-failed", "hint": "Connect returned 201 but follow-up SOQL shows no matching channel"}partnership-blockeduser-declinedwaba-manage-failedmeta-preconditionline-token-invalidapple-preconditionoauth-not-completeoauth-failedservice-de-headless-channel-configure{
"ok": false,
"kind": "wrong-skill",
"hint": "This is an internal insertion skill. For end-to-end channel setup (insert → route → activate), invoke 'service-de-headless-channel-configure' instead with the desired MESSAGE_TYPE.",
"correctSkill": "service-de-headless-channel-configure"
}Error: Wrong skill invoked.
This skill (service-de-channel-create) only handles the insertion step.
For complete channel setup, use: /service-de-headless-channel-configure
That orchestrator runs: insert → configure routing → activate in one flow.service-de-headless-channel-configure{MESSAGE_TYPE}unsupported-typemissing-input{WABA_ID} != {PHONE_NUMBER_ID}{ok:false, kind:"invalid-input", hint:"WABA_ID and PHONE_NUMBER_ID must differ — WABA_ID is the WhatsApp Business Account ID; PHONE_NUMBER_ID is a specific phone number within it. Find both in Meta Business Manager → WhatsApp Accounts."}{T0} = Date.now()durationMs/tmpSCRATCH_DIR="$(mktemp -d "${outputDir:-${TMPDIR:-/tmp}}/icc.XXXXXX")"${outputDir}${TMPDIR}/tmp${SCRATCH_DIR}/${outputDir}{PAGE_ID}references/facebook.md(SELECT ... FROM MessagingChannelUsages)INVALID_TYPEwadtestingsf data query --target-org '{ORG_ALIAS}' \
--query "SELECT Id, DeveloperName, MasterLabel, IsActive, MessagingPlatformKey FROM MessagingChannel WHERE MessagingPlatformKey = '{PLATFORM_KEY}' AND MessageType = '{MESSAGE_TYPE}'" \
--json > "${SCRATCH_DIR}/preflight.json"records.length === 1{CHANNEL_ID}{DEVELOPER_NAME}{IS_ACTIVE}sf data query --target-org '{ORG_ALIAS}' \
--query "SELECT Id, DeploymentStatus FROM MessagingChannelUsage WHERE MessagingChannelId = '{CHANNEL_ID}'" \
--json > "${SCRATCH_DIR}/preflight-mcu.json"{MCU_ID}path: "preflight", created: falserecords.length > 1records.length === 0service-de-waba-integratePOST /connect/livemessage/whatsapp/business-accountreferences/whatsapp.mdhttps://api.line.me/v2/bot/info{VERIFY_TOKEN_FIRST}references/line.mdreferences/facebook.mdreferences/apple.mdsmsProviderreferences/sms.mdsf data query --target-org '{ORG_ALIAS}' \
--query "SELECT Id FROM AuthProvider WHERE DeveloperName = 'LiveMessageSetup'" \
--json > "${SCRATCH_DIR}/authprovider.json"{AUTH_PROVIDER_ID}TextauthProviderId{AUTH_PROVIDER_ID}WhatsAppLineAppleBusinessChatFacebook{ok:false, kind:"business", message:"No AuthProvider 'LiveMessageSetup' found — run the Messaging Setup wizard once on this org first"}400 ILLEGAL_QUERY_PARAMETER_VALUE "Missing argument authProviderId"TextTextauthProviderIdauthProviderId400 JSON_PARSER_ERROR "Unrecognized field 'authProviderId'"{CHANNEL_NAME}--body @...authProviderId?authProviderId=ILLEGAL_QUERY_PARAMETER_VALUEURL="/services/data/v{API_VERSION}/connect/livemessage/channels"
[ -n "${AUTH_PROVIDER_ID:-}" ] && URL="${URL}?authProviderId=${AUTH_PROVIDER_ID}"
sf api request rest "${URL}" \
--method POST --target-org '{ORG_ALIAS}' \
--header 'Content-Type: application/json' --header 'Accept: application/json' \
--body @"${SCRATCH_DIR}/body.json" --include > "${SCRATCH_DIR}/connect-response.txt" 2>&1--include-wsf api request restDUPLICATE_VALUEAUTH_PROVIDER_NEEDS_AUTHreferences/connect-insert.mdExternalAccountIdMessagingPlatformsf data query --target-org '{ORG_ALIAS}' \
--query "SELECT Id, DeveloperName, MasterLabel, MessageType, IsActive, MessagingPlatformKey FROM MessagingChannel WHERE Id = '{CHANNEL_ID}'" --json
sf data query --target-org '{ORG_ALIAS}' \
--query "SELECT Id, DeploymentStatus, DeploymentType FROM MessagingChannelUsage WHERE MessagingChannelId = '{CHANNEL_ID}'" --jsonIsActive=falseDeploymentType=ConversationDeploymentStatus{New, Disabled}NewDisabled{ok:false, kind:"verify-failed", hint:"Connect returned {CHANNEL_ID} but no child MessagingChannelUsage was created"}MasterLabelDeveloperName{"ok": true, "channelId": "{CHANNEL_ID}", "mcuId": "<from Stage 5>",
"developerName": "<authoritative, from Stage 5>", "isActive": false,
"messageType": "{MESSAGE_TYPE}", "messagingPlatformKey": "{PLATFORM_KEY}",
"path": "connect", "created": true, "durationMs": <Date.now() - T0>}Success — MessagingChannel {CHANNEL_ID} ({developerName}) created via {path}. MCU {mcuId} auto-created. IsActive=false — run routing, then consent, then activate next.Info: Channel already exists — {CHANNEL_ID} ({developerName}). Proceed to routing/activation.Error: {kind}: {message or hint}service-de-channel-routing-configurechannelIdservice-de-channel-consent-configureservice-de-channel-activateMessagingChannel.IdMessagingChannelUsage.Id"whatsapp""WhatsApp"MessagingChannelservice-de-headless-channel-configurereferences/<type>.md