Salesforce Tool
Connection Setup GuideThe Salesforce tool provides your agent with direct access to your CRM data, allowing it to perform essential sales and service operations. It can create new leads, find customer information, and update existing records, turning your agent into a productive member of your revenue team.
Key Use Cases:
- Lead Creation: "Create a new lead for 'john.doe@example.com' with the company 'Acme Corp' and a status of 'Open - Not Contacted'."
- Account Lookup: "Find the account ID and owner for 'Globex Corporation'."
- Opportunity Updates: "Update the 'Globex Corp - 1000 Widgets' opportunity to the 'Negotiation/Review' stage and add a note that the customer requested a new quote."
- Contact Search: "What is the phone number for Tim Smith at Initech?"
salesforce_tool.search_records
Searches for records using Salesforce Object Search Language (SOSL). Best for finding a piece of text across multiple types of objects.
Parameters
Name | Type | Description |
---|---|---|
search_term |
string |
The text to search for. Example: 'John Smith' or 'Acme Corp'. |
object_type |
string |
Optional: a specific object to search in, like 'Lead' or 'Contact'. If omitted, searches across common objects. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.search_records",
"arguments": {
"search_term": {
"type": "string",
"description": "The text to search for. Example: 'John Smith' or 'Acme Corp'."
},
"object_type": {
"type": "string",
"description": "Optional: a specific object to search in, like 'Lead' or 'Contact'. If omitted, searches across common objects."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.search_records",
"arguments": {
"search_term": {
"type": "string",
"description": "The text to search for. Example: 'John Smith' or 'Acme Corp'."
},
"object_type": {
"type": "string",
"description": "Optional: a specific object to search in, like 'Lead' or 'Contact'. If omitted, searches across common objects."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
salesforce_tool.get_record_details
Retrieves the full details of a single record given its ID.
Parameters
Name | Type | Description |
---|---|---|
record_id |
string |
The 15 or 18-digit ID of the Salesforce record. |
object_type |
string |
The API name of the object, e.g., 'Account', 'Lead', 'Opportunity'. |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.get_record_details",
"arguments": {
"record_id": {
"type": "string",
"description": "The 15 or 18-digit ID of the Salesforce record."
},
"object_type": {
"type": "string",
"description": "The API name of the object, e.g., 'Account', 'Lead', 'Opportunity'."
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.get_record_details",
"arguments": {
"record_id": {
"type": "string",
"description": "The 15 or 18-digit ID of the Salesforce record."
},
"object_type": {
"type": "string",
"description": "The API name of the object, e.g., 'Account', 'Lead', 'Opportunity'."
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
salesforce_tool.create_record
Creates a new record for a specified object type (e.g., Lead, Account, Case).
Parameters
Name | Type | Description |
---|---|---|
object_type |
string |
The API name of the object to create, e.g., 'Lead'. |
fields |
object |
A dictionary of fields and values to set on the new record. Example: {'LastName': 'Smith', 'Company': 'Acme Inc'} |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.create_record",
"arguments": {
"object_type": {
"type": "string",
"description": "The API name of the object to create, e.g., 'Lead'."
},
"fields": {
"type": "object",
"description": "A dictionary of fields and values to set on the new record. Example: {'LastName': 'Smith', 'Company': 'Acme Inc'}"
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.create_record",
"arguments": {
"object_type": {
"type": "string",
"description": "The API name of the object to create, e.g., 'Lead'."
},
"fields": {
"type": "object",
"description": "A dictionary of fields and values to set on the new record. Example: {'LastName': 'Smith', 'Company': 'Acme Inc'}"
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
salesforce_tool.update_record
Updates an existing record's fields.
Parameters
Name | Type | Description |
---|---|---|
record_id |
string |
The ID of the record to update. |
object_type |
string |
The API name of the object to update, e.g., 'Opportunity'. |
fields |
object |
A dictionary of fields and values to update. Example: {'StageName': 'Closed Won'} |
curl -X POST https://toolstream.dev/v1/tools/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.update_record",
"arguments": {
"record_id": {
"type": "string",
"description": "The ID of the record to update."
},
"object_type": {
"type": "string",
"description": "The API name of the object to update, e.g., 'Opportunity'."
},
"fields": {
"type": "object",
"description": "A dictionary of fields and values to update. Example: {'StageName': 'Closed Won'}"
}
}
}
}'
import requests
import json
API_KEY = "YOUR_API_KEY"
TOOLSTREAM_URL = "https://toolstream.dev/v1/tools/execute"
payload = {
"connection_name": "YOUR_CONNECTION_NAME",
"tool_call": {
"name": "salesforce_tool.update_record",
"arguments": {
"record_id": {
"type": "string",
"description": "The ID of the record to update."
},
"object_type": {
"type": "string",
"description": "The API name of the object to update, e.g., 'Opportunity'."
},
"fields": {
"type": "object",
"description": "A dictionary of fields and values to update. Example: {'StageName': 'Closed Won'}"
}
}
}
}
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
response = requests.post(TOOLSTREAM_URL, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
result = response.json()
print(json.dumps(result, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)