sshvarzman-salesforce/claude-skills

sf-agent-api-setup

Agent API onboarding — External Client App (ECA), OAuth client credentials flow, token minting, and agent ID retrieval.

Voir la source

Mode d’emploi

  1. Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
  2. Consultez le document original pour les outils, identifiants et environnements requis.
  3. Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/sshvarzman-salesforce/claude-skills --skill sf-agent-api-setup

Avant de commencer

  • L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
  • Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

Agent API Setup and Authentication

Use This Skill When

  • Standing up access to the Agentforce Agent API (einstein/ai-agent/v1) for the first time.
  • Creating the External Client App (ECA) and choosing OAuth scopes and flow settings.
  • Minting a bearer token via the client credentials flow.
  • Resolving the correct base endpoint (api.salesforce.com vs api.gov.salesforce.com) and My Domain URL.
  • Finding the agent ID from the Legacy or new Agentforce Builder.

Prerequisites

  • Agentforce enabled with at least one activated agent.
  • Agent API is not supported for agents of type "Agentforce (Default)".
  • A Run As user with at least API Only access for the client credentials flow.

Quick Start (Setup Path)

Follow these steps in order. For screen-by-screen ECA settings and the full token/response reference, see reference.md.

1. Create the External Client App

Setup → External Client Apps Manager → New External Client App. Set name + contact email, enable OAuth, and add these scopes:

  • api — Manage user data via APIs
  • refresh_token, offline_access — Perform requests at any time
  • chatbot_api — Access chatbot services
  • sfap_api — Access the Salesforce API Platform

Enable Client Credentials Flow and Issue JWT-based access tokens for named users. Deselect the three "Require secret / Require PKCE" options. Then on the Policy tab, enable Client Credentials Flow and set Run As to an API-only user.

2. Get the consumer key and secret

App Settings tab → OAuth Settings → Consumer Key and Secret. Copy both. Never commit these.

3. Mint a token (client credentials)

bash
curl https://{MY_DOMAIN_URL}/services/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={CONSUMER_KEY}' \
--data-urlencode 'client_secret={CONSUMER_SECRET}'

Copy access_token from the JSON response. This bearer token is required on every Agent API call.

4. Get the agent ID

  • Legacy Agentforce Builder: open the Agent Overview page in Setup; copy the 18-character ID at the end of the URL (for example 0XxSB000000IPCr0AO).
  • New Agentforce Builder: the bot ID is the agent ID. Query BotDefinition:
sql
SELECT Id, DeveloperName FROM BotDefinition WHERE DeveloperName = 'Agentforce_Service_Agent'

Or via CLI: sf data query --query "SELECT Id, DeveloperName, AgentType FROM BotDefinition"

5. Make your first call

bash
curl --location -X POST https://api.salesforce.com/einstein/ai-agent/v1/agents/{AGENT_ID}/sessions \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--data '{
  "externalSessionKey": "{RANDOM_UUID}",
  "instanceConfig": { "endpoint": "https://{MY_DOMAIN_URL}" },
  "streamingCapabilities": { "chunkTypes": ["Text"] },
  "bypassUser": true
}'

Endpoint Reference

PurposeBase URL
Standardhttps://api.salesforce.com/einstein/ai-agent/v1
Government Cloudhttps://api.gov.salesforce.com/einstein/ai-agent/v1

instanceConfig.endpoint must be your My Domain URL (https://xxx.my.salesforce.com), not the Lightning URL (*.lightning.force.com).

Guardrails

  • Store the consumer secret and access token server-side only; never ship them to a browser or commit them to source control.
  • Use the My Domain URL for instanceConfig.endpoint — using the Lightning URL causes EngineConfigLookupException (HTTP 500).
  • bypassUser: true runs as the agent-assigned user; false runs as the token user. Pick deliberately based on data-access requirements.
  • Government Cloud orgs must use api.gov.salesforce.com everywhere — the standard host returns 404.
  • Tokens are short-lived; build refresh into the client rather than pasting a static token.

Deliverables

  • Configured ECA with the four required scopes and client credentials flow enabled.
  • A documented token-minting command/secret-storage plan.
  • The resolved agent ID and My Domain URL captured for the target org.
  • A verified first Start Session response.

Additional Resources

Tâches connexes

du même dépôt

Autres Skills

Tous les Skills
sshvarzman-salesforce
Communauté

activating-datacloud

Salesforce Data Cloud Act phase. Use this skill when the user manages activations, activation targets, data actions, or downstream delivery of Data Cloud audiences and data. TRIGGER when: user manages activations, activation targets, data actions, or downstream delivery of Data Cloud audiences and data. DO NOT TRIGGER when: the task is segment creation (use segmenting-datacloud), data retrieval/search work (use retrieving-datacloud), or STDM/session tracing (use observing-agentforce).

installations
1
GitHub Stars
0
Mis à jour
15 oct.
sshvarzman-salesforce
Communauté

agentforce-skills-research

Research Agentforce configuration patterns — topics, actions, instructions, CLTs, knowledge, planner behavior. Searches Salesforce docs, Trailhead, internal repos (git.soma), Slack channels, and Google Docs to find working examples, known issues, and best practices.

installations
1
GitHub Stars
0
Mis à jour
15 oct.
sshvarzman-salesforce
Communauté

harmonizing-datacloud

Salesforce Data Cloud Harmonize phase. Use this skill when the user works with DMOs, mappings, relationships, identity resolution, unified profiles, data graphs, or universal IDs. TRIGGER when: user works with DMOs, mappings, relationships, identity resolution, unified profiles, data graphs, or universal IDs. DO NOT TRIGGER when: the task is only about streams/DLOs (use preparing-datacloud), segments/insights (use segmenting-datacloud), retrieval/search (use retrieving-datacloud), or STDM/sessio

installations
1
GitHub Stars
0
Mis à jour
15 oct.
sshvarzman-salesforce
Communauté

preparing-datacloud

Salesforce Data Cloud Prepare phase. Use this skill when the user creates or manages Data Cloud data streams, DLOs, transforms, or Document AI configurations. TRIGGER when: user creates or manages Data Cloud data streams, DLOs, transforms, or Document AI configurations, or asks about ingestion into Data Cloud. DO NOT TRIGGER when: the task is connection setup only (use connecting-datacloud), DMOs and identity resolution (use harmonizing-datacloud), or query/search work (use retrieving-datacloud)

installations
1
GitHub Stars
0
Mis à jour
15 oct.