Salesforce service cloud

Learn how to use Salesforce service cloud with Composio

Overview

SLUG: SALESFORCE_SERVICE_CLOUD

Description

Salesforce Service Cloud is a customer service platform providing case management, knowledge base, omnichannel support, and service automation to deliver exceptional customer experiences

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to full,refresh_token
bearer_token
string
subdomain
stringDefaults to loginRequired
suffix.one
stringDefaults to /services/data/v61.0Required

Connecting to Salesforce service cloud

Create an auth config

Use the dashboard to create an auth config for the Salesforce service cloud toolkit. This allows you to connect multiple Salesforce service cloud accounts to Composio for agents to use.

1

Select App

Navigate to [Salesforce service cloud](https://platform.composio.dev?next_page=/marketplace/Salesforce service cloud).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Salesforce service cloud Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4salesforce_service_cloud_auth_config_id = "ac_YOUR_SALESFORCE_SERVICE_CLOUD_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Salesforce service cloud: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, salesforce_service_cloud_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Salesforce service cloud toolkit’s playground](https://app.composio.dev/app/Salesforce service cloud)

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["SALESFORCE_SERVICE_CLOUD"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Agent Sensitive Data Rule Triggered

Description

Tool to set sensitive data rules for the chat agent. Use after session starts to apply filtering or privacy rules to agent messages.

Action Parameters

api_version
string
chatId
stringRequired
rules
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Chasitor Sneak Peek

Description

Tool to send in-progress message text for sneak peek to agents. Use when providing live typing updates before the actual message is sent.

Action Parameters

affinity
stringRequired
api_version
stringRequired
position
integerRequired
sequence
integerRequired
session_key
stringRequired
text
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Composite Batch

Description

Tool to execute multiple independent REST subrequests in one batch call. Use when bundling up to 25 independent operations to minimize round trips. Subrequests cannot reference each other.

Action Parameters

batchRequests
arrayRequired
haltOnError
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Composite Request

Description

Tool to execute multiple dependent Salesforce REST subrequests in one call. Use when you need to perform several related operations atomically or sequentially, optionally rolling back on error.

Action Parameters

allOrNone
boolean
compositeRequest
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Composite SObject Tree

Description

Tool to create one or more nested sObject trees. Use when you need to insert multiple related records in a single call.

Action Parameters

objectApiName
stringRequired
records
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Case Record

Description

Tool to create or upsert a Salesforce Case record. Use when you need to add a new Case or update via external ID.

Action Parameters

accept
string
case_fields
objectRequired
external_id_field
string
external_id_value
string
sforce_auto_assign
boolean
sforce_call_options
string
x_pretty_print
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Case Record

Description

Tool to delete a Salesforce Case record. Use when you need to remove a case by its record ID.

Action Parameters

case_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Describe Case SObject

Description

Tool to retrieve metadata of the Case sObject. Use when you need to inspect field definitions, relationships, and supported features for Case objects.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Describe SObject

Description

Tool to retrieve metadata of any sObject. Use when you need to inspect field definitions, relationships, and supported features for objects like Account, Contact, Case, etc.

Action Parameters

sObjectName
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: End Chat Session

Description

Tool to end a Live Agent chat session. Use after obtaining session key and affinity token to terminate the chat.

Action Parameters

affinity
stringRequired
api_version
stringRequired
session_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Generate Request ID

Description

Tool to generate a UUIDv4 RequestId. Use when you need a unique x-request-id header for Salesforce API calls to ensure idempotent requests.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Generate Signed JWT Assertion

Description

Tool to generate a signed JWT assertion for Salesforce JWT bearer OAuth flow. Use when you need to perform server-to-server authentication using a connected app’s certificate. Use before exchanging the assertion for an access token.

Action Parameters

audience
string
client_id
string
expiration
integerDefaults to 300
generate_private_key
boolean
private_key
string
username
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Case Record

Description

Tool to retrieve a Case by ID. Use when you need to fetch Case record details via Salesforce sObject API.

Action Parameters

case_id
stringRequired
fields
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Chat Messages

Description

Tool to long-poll for chat messages/events. Use after CreateChatSession to retrieve incoming chat events. Returns empty messages list when no new messages (HTTP 204). Call with ack from prior response to maintain sequence.

Action Parameters

ack
integerDefaults to -1
affinity
stringRequired
api_version
stringRequired
session_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Live Agent API Version

Description

Tool to retrieve current Live Agent API version. Use when initializing chat sessions to ensure subsequent calls target the correct REST API version.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Einstein Bots

Description

Tool to list all Einstein Bots in the org. Use when you need valid bot IDs and metadata to select a Bot.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query All SOQL

Description

Tool to execute a SOQL query including deleted and archived records. Use when you need to fetch all rows including soft-deleted data in Salesforce.

Action Parameters

q
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Query SOQL

Description

Tool to execute a SOQL query. Use when you need to retrieve records from Salesforce via SOQL.

Action Parameters

soql_query
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reconnect Chat Session

Description

Tool to reconnect a live chat session. Use after an affinity token error to reestablish the session before resyncing state.

Action Parameters

X-LIVEAGENT-SEQUENCE
integerDefaults to 1
affinity
stringRequired
api_version
string
session_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Resync Chasitor State

Description

Tool to reestablish visitor state after ReconnectSession. Use after a reconnect session to restore visitor context before resuming chat.

Action Parameters

X-LIVEAGENT-SEQUENCE
integerDefaults to 1
affinity_token
stringRequired
api_version
string
organizationId
string
session_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve Connected App Private Key

Description

Tool to retrieve RSA private key PEM for a Salesforce Connected App. Use when signing JWT assertions for OAuth flows. Provide the app's Connected App ID and optional secret name or file path. Use before generating signed JWTs.

Action Parameters

connected_app_id
stringRequired
secret_name
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve Salesforce Username

Description

Tool to retrieve the Salesforce username. Use when you need the current authenticated user's username. Use after completing OAuth2 authentication.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Send Custom Event

Description

Tool to send a custom event from the chat visitor. Use when you need to notify the agent of a custom event during an active chat session (after session establishment).

Action Parameters

affinity_token
stringRequired
api_version
string
data
stringRequired
sequence
integerRequired
session_key
stringRequired
type
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Set Breadcrumb

Description

Tool to set a breadcrumb URL for the visitor's current page. Use after a visitor navigates to a new page during an active chat session.

Action Parameters

api_version
stringRequired
location
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upload File to S3

Description

Tool to upload a file to managed S3 storage. Use when you need to persist files externally.

Action Parameters

file
objectRequired
file_path
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upsert Case Record

Description

Tool to upsert a Case record by external ID. Use when you have an external ID on Case and want to insert or update in one call.

Action Parameters

external_id
stringRequired
external_id_field
stringRequired
record
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Visitor Sensitive Data Rule Triggered

Description

Tool to trigger sensitive data rules for the chat visitor. Use after detecting sensitive content to apply visitor masking or handling rules.

Action Parameters

affinity
stringRequired
api_version
stringRequired
rules
arrayRequired
sequence
integerRequired
session_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired