Salesforce Agentforce v2

Provides integration with Salesforce Agentforce, which runs AI agents that answer questions and perform configured business actions in Salesforce.

Use the Node to discover agents, start a conversation, send successive text messages, and close the session from a Workflow.

Revision History

0.0.0.5 - Updated Runtime compatibility.
0.0.0.1 - Initial release.

Connection

Property Type Description
My Domain URL String Current My Domain URL from Salesforce Setup, including https://. Supply no Lightning URL, path, query, or fragment.
Client ID String Consumer key of the external client app.
Client Secret Masked Consumer secret of the external client app.
API URL String Defaults to https://api.salesforce.com. Use https://api.gov.salesforce.com for Government Cloud.

Setup Notes

Run this Node on a Cloud Runtime. Enable Agentforce and activate an agent that supports the Agent API. Configure a Salesforce external client app with client credentials, a Run As user, and JWT-based access tokens. Configure the required scopes: api, refresh_token / offline_access, chatbot_api, and sfap_api.

Use an HTTPS My Domain host ending in .my.salesforce.com or .my-salesforce.com on port 443. The Connection test checks token issuance only; it does not prove that a particular agent or business action is accessible. Agent discovery also requires permission to query BotDefinition.

Methods

ListAgents

Lists agent definitions visible to the Connection user, following query pages automatically.

Parameter Type Description
Connection Connection Connection used to authenticate the operation.
Return Type Description
Content Array Provider records containing fields such as Id, DeveloperName, MasterLabel, Description, Type, and AgentType. No Flowgear metadata is added. Empty results return zero rows; query failures fail the operation.

StartSession

Starts a session with the selected activated agent.

Parameter Type Description
Connection Connection Connection used to authenticate the operation.
AgentId String Agent identifier, for example Content.Id from ListAgents.
ExternalSessionKey String Optional dashed UUID used to trace the conversation. Omit to generate a new UUID.
BypassUser Boolean Defaults to true, which uses the agent-assigned user. Set false to use the OAuth token user, subject to agent permissions.
Return Type Description
Response Object Provider fields with Flowgear.IsSuccess, Flowgear.Message, and the original request under Flowgear.Request. Retain sessionId and inspect any welcome messages.

SendMessage

Sends one text turn to an existing session and waits for the complete response.

Parameter Type Description
Connection Connection Connection used to authenticate the operation.
SessionId String The sessionId returned by StartSession.
Message String Text instruction or reply, sent unchanged.
SequenceId Integer Positive sequence number. Start at 1 and increase for every subsequent turn in this session.
Return Type Description
Response Object Provider fields with Flowgear.IsSuccess, Flowgear.Message, and the original request under Flowgear.Request. The provider messages retain replies, results, citations, safety flags, and links.

EndSession

Closes an existing session with the UserRequest end reason.

Parameter Type Description
Connection Connection Connection used to authenticate the operation.
SessionId String Identifier of the session to close.
Return Type Description
Response Object Provider fields with Flowgear.IsSuccess, Flowgear.Message, and the original request under Flowgear.Request.

Usage Notes

  1. Select an agent from ListAgents, filtering by DeveloperName or MasterLabel if needed. Discovery can include inactive or API-incompatible definitions; confirm the selected agent is activated and supported.
  2. StartSession and retain Response.sessionId.
  3. SendMessage with SequenceId=1, then serialize further turns using the same session and increasing sequence numbers.
  4. Inspect Response.messages for results, refusals, errors, and confirmation requests.
  5. EndSession when the conversation is complete.

Flowgear.IsSuccess reports API-request success, not completion of the requested business action. Handle the agent's actual reply before proceeding with dependent business operations.

Validation and OAuth failures fail the invocation. Handled HTTP, timeout, and malformed-response errors return Flowgear.IsSuccess=false. Requests are not retried automatically because an action might already have executed before a timeout or lost response.

Known Issues

This Node returns complete JSON replies; it does not expose SSE streaming, agent variables, feedback, or provisioning. The older Agentforce (Default) type is not supported by the Agent API. Marketing operations require the relevant Salesforce entitlements and configured agent actions.