Salesforce Agentforce connector
Agentforce uses OAuth client credentials, a session per thread, an incrementing message sequence and optional SSE streaming.
Prerequisites
- Salesforce org domain
- Agentforce agent ID
- External client app client ID and secret
- Agent deployed and active for API access
Manifest
{
"schema_version": 1,
"key": "agentforce",
"version": "1.0.0",
"name": "Salesforce Agentforce",
"description": "Agentforce Agent API connector",
"icon": "agent",
"runtime": "agentforce",
"auth": [
{
"key": "client_credentials",
"type": "basic",
"username_credential": "client_id",
"password_credential": "client_secret"
}
],
"config_schema": {
"type": "object",
"required": ["agent_id", "domain_url"],
"properties": {
"agent_id": {
"type": "string",
"title": "Agent ID"
},
"domain_url": {
"type": "string",
"title": "Salesforce domain URL",
"format": "uri"
},
"timezone": {
"type": "string",
"title": "Timezone"
},
"bypass_user": {
"type": "string",
"title": "Bypass user (true/false)"
},
"base_url": {
"type": "string",
"title": "API base URL"
}
}
},
"operations": {}
}
Install
- Open Connectors → Catalog.
- Select Salesforce Agentforce → Install.
- Enter:
- Agent ID — for example
0Xxaj000004VGHVCA4 - Salesforce domain URL — for example
https://orgfarm-....my.salesforce.com - Timezone — for example
America/Los_Angeles - Bypass user —
truefor headless API access - API base URL — defaults to
https://api.salesforce.com/einstein/ai-agent/v1
- Agent ID — for example
- Enter the client ID and secret.
- Test with a message.
How the adapter works
1. OAuth token
POST {domain_url}/services/oauth2/token
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials
client_id=...
client_secret=...
The access token is cached until shortly before expiry.
2. Start session
POST {base_url}/agents/{agent_id}/sessions
Authorization: Bearer <token>
{
"externalSessionKey": "<uuid>",
"instanceConfig": { "endpoint": "<domain_url>" },
"tz": "America/Los_Angeles",
"variables": [
{
"name": "$Context.EndUserLanguage",
"type": "Text",
"value": "en_US"
}
],
"bypassUser": true,
"featureSupport": "Streaming",
"streamingCapabilities": { "chunkTypes": ["Text"] }
}
3. Send message
POST {base_url}/sessions/{sessionId}/messages
Authorization: Bearer <token>
{
"message": {
"sequenceId": 1,
"type": "Text",
"text": "Hello"
}
}
The sequence is tracked per thread and incremented for each message. Streaming chunks are parsed into the final reply.
Agent registration
Use Create agent from the installed connector. The agent uses the native
agentforce adapter and asks for client ID/secret at creation time.
Troubleshooting
| Symptom | Fix |
|---|---|
| Token endpoint 401 | Check client ID/secret and external client app settings |
| Session 404 | Check agent ID and API base URL |
| 429 | Reduce concurrency or retry with backoff |
| Empty reply | Confirm the agent is deployed and streaming chunks include text |
domain_url mismatch | The instance endpoint must match the org domain |