Salesforce
Query and update Salesforce records — leads, contacts, opportunities, accounts, and
custom objects — straight from an InTouch job or the AI assistant. It talks to the
Salesforce REST API
using SOQL for reads and the sObject resource for record CRUD. Standard library
only — no requests, no SDK.
What it does
Branches on operation and calls the matching Salesforce REST endpoint under
{instanceUrl}/services/data/{apiVersion}:
| operation | method | endpoint | purpose |
|---|---|---|---|
query |
GET | /query?q=<SOQL> |
Run a SOQL query |
get_record |
GET | /sobjects/{sobject}/{recordId} |
Read one record by Id |
create_record |
POST | /sobjects/{sobject} |
Create a record |
update_record |
PATCH | /sobjects/{sobject}/{recordId} |
Update fields on a record |
Every response is returned as a JSON string in result, with the HTTP status in
status. A successful update_record returns HTTP 204 with no body, which the
tool normalizes to {"success": true}.
Authentication (apiKey setup)
Salesforce uses OAuth 2.0 bearer tokens. The apiKey input is your access
token, sent as Authorization: Bearer <token>. You also pass instanceUrl,
the org-specific host that the OAuth response returns alongside the token.
- In Salesforce Setup, create a Connected App (App Manager → New Connected
App) with OAuth enabled and the
apiscope. - Run an OAuth 2.0 flow against your connected app (web server, JWT bearer, or
client-credentials). The token response contains both
access_tokenandinstance_url. - Pass
access_tokenasapiKeyandinstance_urlasinstanceUrl.
Access tokens are short-lived. Refresh them out of band and pass the current token each run. Because the OAuth exchange needs a connected app + (often) a refresh token or signed JWT, a single static key cannot mint the token — obtain it before invoking the tool.
Inputs
| input | required | description |
|---|---|---|
apiKey |
yes | OAuth access token (bearer) |
operation |
yes | query, get_record, create_record, or update_record |
instanceUrl |
yes | Org URL, e.g. https://yourorg.my.salesforce.com |
apiVersion |
no | REST version path, default v59.0 |
soql |
for query |
SOQL statement |
sobject |
for record ops | sObject API name (Lead, Contact, Opportunity, Account, custom MyObj__c) |
recordId |
for get_record/update_record |
15- or 18-char record Id |
fields |
for create_record/update_record |
JSON object of field API name → value |
Examples
Run a SOQL query for recent leads:
operation: query
instanceUrl: https://acme.my.salesforce.com
apiKey: <access_token>
soql: SELECT Id, Name, Email FROM Lead WHERE Status = 'Open - Not Contacted' LIMIT 25
Read one opportunity by Id:
operation: get_record
sobject: Opportunity
recordId: 0065g00000ABcDeAAH
Create a lead:
operation: create_record
sobject: Lead
fields: {"LastName":"Doe","Company":"Acme Corp","Email":"[email protected]"}
Update an opportunity stage:
operation: update_record
sobject: Opportunity
recordId: 0065g00000ABcDeAAH
fields: {"StageName":"Closed Won","Amount":50000}
Notes
- Bodies are capped at ~5 MB.
- HTTP errors (4xx/5xx) are returned with the Salesforce error JSON in
resultand the real status code instatus, rather than throwing — so callers can inspecterrorCode/message. - License: MIT.