Integrations / Salesforce
Salesforce
CRM: leads, contacts, accounts, opportunities and tasks, with SOQL and SOSL search. Works against the connected org's own Salesforce host (REST API v67.0).
10 actions
OAuth 2
6 read3 write1 destructive
Calls login.salesforce.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "salesforce" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
api | Read and write Salesforce records through the REST API |
refresh_token | Stay connected without asking you to sign in again |
openid | Identify the connected Salesforce user |
email | Show which Salesforce user is connected, by email address |
Actions
Create recordwritesalesforce.create_recordCreate a record of any object type from a map of field API names to values. Lead needs LastName and Company; Contact needs LastName; Account needs Name; Opportunity needs Name, StageName and CloseDate.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
sobject | string | Required | API name of the object, e.g. Lead, Contact, Account, Opportunity, Task |
fields | object | Required | Field values keyed by API name, e.g. {"LastName": "Smith", "Company": "Acme"} |
await setu.execute({
userId: "user_1",
action: "salesforce.create_record",
input: {
"sobject": "<sobject>",
"fields": {}
},
});Delete recorddestructivesalesforce.delete_recordDelete a record by object type and id. Salesforce moves it to the Recycle Bin, where an admin can restore it for a limited time.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
sobject | string | Required | API name of the object, e.g. Lead, Contact, Task |
id | string | Required | Salesforce record id |
await setu.execute({
userId: "user_1",
action: "salesforce.delete_record",
input: {
"sobject": "<sobject>",
"id": "<id>"
},
confirm: true,
});Describe object fieldsreadsalesforce.describe_sobjectList the field API names, types and picklist-ness of an object, so you know what to put in a query or record. Use before writing to unfamiliar or custom objects.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
sobject | string | Required | API name of the object, e.g. Lead, Opportunity, Invoice__c |
await setu.execute({
userId: "user_1",
action: "salesforce.describe_sobject",
input: {
"sobject": "<sobject>"
},
});Get recordreadsalesforce.get_recordGet one record by object type and 15 or 18 character id (Lead, Contact, Account, Opportunity, Task or any custom object). Optionally limit the fields returned.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
sobject | string | Required | API name of the object, e.g. Lead, Contact, Account, Opportunity, Task, or a custom object like Invoice__c |
id | string | Required | Salesforce record id |
fields | array of string | Optional | Field API names to return, e.g. [Id, Name, Email]. Omit for all fields. |
await setu.execute({
userId: "user_1",
action: "salesforce.get_record",
input: {
"sobject": "<sobject>",
"id": "<id>"
},
});List objectsreadsalesforce.list_sobjectsList the API names of all objects (standard and custom) available in the connected org.
Needs scope: api
No input.
await setu.execute({
userId: "user_1",
action: "salesforce.list_sobjects",
input: {},
});Log a task or notewritesalesforce.log_taskCreate a Task (a logged call, email, follow-up or note) and optionally attach it to a person with WhoId (Lead or Contact id) and a record with WhatId (Account or Opportunity id).
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
subject | string | Required | Task subject line |
description | string | Optional | Longer notes or call summary |
status | string | Optional | Task status picklist value, e.g. Not Started, In Progress, Completed (org picklists may differ) |
priority | string | Optional | Task priority picklist value, e.g. High, Normal, Low |
due_date | string | Optional | Due date, YYYY-MM-DD |
who_id | string | Optional | Lead or Contact id the task is about |
what_id | string | Optional | Account, Opportunity or other record id the task relates to |
await setu.execute({
userId: "user_1",
action: "salesforce.log_task",
input: {
"subject": "<subject>"
},
});Run SOQL queryreadsalesforce.queryRun a SOQL query (for example SELECT Id, Name, Email FROM Contact WHERE LastName = 'Smith' LIMIT 10). Returns records plus nextRecordsUrl when more pages exist.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
q | string | Required | A complete SOQL statement. Field and object names are case-insensitive but conventionally PascalCase (Lead, Contact, Account, Opportunity, Task). |
await setu.execute({
userId: "user_1",
action: "salesforce.query",
input: {
"q": "<q>"
},
});Get next page of query resultsreadsalesforce.query_moreFetch the next page of a SOQL query using the locator id from a previous result's nextRecordsUrl (the last path segment, such as 01gD0000002HU6KIAW-2000).
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
locator | string | Required | The final path segment of nextRecordsUrl, e.g. 01gD0000002HU6KIAW-2000 |
await setu.execute({
userId: "user_1",
action: "salesforce.query_more",
input: {
"locator": "<locator>"
},
});Search with SOSLreadsalesforce.searchSearch across many objects at once with SOSL, for example FIND {Acme} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Name, Email).
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
q | string | Required | A complete SOSL statement starting with FIND {...} |
await setu.execute({
userId: "user_1",
action: "salesforce.search",
input: {
"q": "<q>"
},
});Update recordwritesalesforce.update_recordUpdate fields on an existing record by object type and id. Only the fields you pass change. Returns no content on success.
Needs scope: api
| Input | Type | Description | |
|---|---|---|---|
sobject | string | Required | API name of the object, e.g. Lead, Contact, Account, Opportunity |
id | string | Required | Salesforce record id |
fields | object | Required | Field values to change keyed by API name, e.g. {"Status": "Working - Contacted"} |
await setu.execute({
userId: "user_1",
action: "salesforce.update_record",
input: {
"sobject": "<sobject>",
"id": "<id>",
"fields": {}
},
});