productivity
Salesforce CLI for AI Agents
Use the Salesforce CLI from KosmoKrator to call Salesforce tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Salesforce CLI Setup
Salesforce can be configured headlessly with `kosmokrator integrations:configure salesforce`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure salesforce --set access_token="$SALESFORCE_ACCESS_TOKEN" --set instance_url="$SALESFORCE_INSTANCE_URL" --enable --read allow --write ask --json
kosmokrator integrations:doctor salesforce --json
kosmokrator integrations:status --json Credentials
Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | SALESFORCE_ACCESS_TOKEN | Secret secret | yes | OAuth2 Access Token |
instance_url | SALESFORCE_INSTANCE_URL | Text string | yes | Instance URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call salesforce.salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs salesforce --json
kosmo integrations:docs salesforce.salesforce_create_lead --json
kosmo integrations:schema salesforce.salesforce_create_lead --json
kosmo integrations:search "Salesforce" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
salesforce.salesforce_create_lead
Create a new lead in Salesforce. Supports FirstName, LastName, Company, Email, Phone, Title, Website, and additional custom fields via other_fields. Returns the created lead ID and success status.
write - Parameters
- first_name, last_name, company, email, phone, title, website, other_fields
kosmo integrations:call salesforce.salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json salesforce.salesforce_get_lead
Retrieve a Salesforce lead by its ID. Returns the lead's fields, attributes, and associated data.
read - Parameters
- id
kosmo integrations:call salesforce.salesforce_get_lead '{"id":"example_id"}' --json kosmo integrations:salesforce salesforce_get_lead '{"id":"example_id"}' --json salesforce.salesforce_update_lead
Update an existing Salesforce lead by ID. Supports FirstName, LastName, Company, Email, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.
write - Parameters
- id, first_name, last_name, company, email, phone, other_fields
kosmo integrations:call salesforce.salesforce_update_lead '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_update_lead '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","other_fields":"example_other_fields"}' --json salesforce.salesforce_create_contact
Create a new contact in Salesforce. Supports FirstName, LastName, Email, Phone, AccountId, Title, and additional custom fields via other_fields. Returns the created contact ID and success status.
write - Parameters
- first_name, last_name, email, phone, account_id, title, other_fields
kosmo integrations:call salesforce.salesforce_create_contact '{"first_name":"example_first_name","last_name":"example_last_name","email":"example_email","phone":"example_phone","account_id":"example_account_id","title":"example_title","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_create_contact '{"first_name":"example_first_name","last_name":"example_last_name","email":"example_email","phone":"example_phone","account_id":"example_account_id","title":"example_title","other_fields":"example_other_fields"}' --json salesforce.salesforce_get_contact
Retrieve a Salesforce contact by its ID. Returns the contact's fields, attributes, and associated data.
read - Parameters
- id
kosmo integrations:call salesforce.salesforce_get_contact '{"id":"example_id"}' --json kosmo integrations:salesforce salesforce_get_contact '{"id":"example_id"}' --json salesforce.salesforce_create_account
Create a new account in Salesforce. Supports Name, Website, Phone, Industry, BillingCity, BillingCountry, and additional custom fields via other_fields. Returns the created account ID and success status.
write - Parameters
- name, website, phone, industry, billing_city, billing_country, other_fields
kosmo integrations:call salesforce.salesforce_create_account '{"name":"example_name","website":"example_website","phone":"example_phone","industry":"example_industry","billing_city":"example_billing_city","billing_country":"example_billing_country","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_create_account '{"name":"example_name","website":"example_website","phone":"example_phone","industry":"example_industry","billing_city":"example_billing_city","billing_country":"example_billing_country","other_fields":"example_other_fields"}' --json salesforce.salesforce_get_account
Retrieve a Salesforce account by its ID. Returns the account's fields, attributes, and associated data.
read - Parameters
- id
kosmo integrations:call salesforce.salesforce_get_account '{"id":"example_id"}' --json kosmo integrations:salesforce salesforce_get_account '{"id":"example_id"}' --json salesforce.salesforce_update_account
Update an existing Salesforce account by ID. Supports Name, Website, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.
write - Parameters
- id, name, website, phone, other_fields
kosmo integrations:call salesforce.salesforce_update_account '{"id":"example_id","name":"example_name","website":"example_website","phone":"example_phone","other_fields":"example_other_fields"}' --json kosmo integrations:salesforce salesforce_update_account '{"id":"example_id","name":"example_name","website":"example_website","phone":"example_phone","other_fields":"example_other_fields"}' --json salesforce.salesforce_create_opportunity
Create a new opportunity in Salesforce. Supports Name, Amount, StageName, CloseDate, AccountId, and Probability. Returns the created opportunity ID and success status.
write - Parameters
- name, amount, stage_name, close_date, account_id, probability
kosmo integrations:call salesforce.salesforce_create_opportunity '{"name":"example_name","amount":1,"stage_name":"example_stage_name","close_date":"example_close_date","account_id":"example_account_id","probability":1}' --json kosmo integrations:salesforce salesforce_create_opportunity '{"name":"example_name","amount":1,"stage_name":"example_stage_name","close_date":"example_close_date","account_id":"example_account_id","probability":1}' --json salesforce.salesforce_get_opportunity
Retrieve a Salesforce opportunity by its ID. Returns the opportunity's fields, attributes, and associated data.
read - Parameters
- id
kosmo integrations:call salesforce.salesforce_get_opportunity '{"id":"example_id"}' --json kosmo integrations:salesforce salesforce_get_opportunity '{"id":"example_id"}' --json salesforce.salesforce_query
Execute a SOQL (Salesforce Object Query Language) query. Use SOQL to search records in Salesforce. Example: SELECT Id, Name FROM Account LIMIT 10 Returns query results with total size and records.
read - Parameters
- soql
kosmo integrations:call salesforce.salesforce_query '{"soql":"example_soql"}' --json kosmo integrations:salesforce salesforce_query '{"soql":"example_soql"}' --json salesforce.salesforce_search
Execute a SOSL (Salesforce Object Search Language) search. Use SOSL for text-based searches across multiple object types. Example: FIND {test} IN ALL FIELDS RETURNING Account(Id, Name) Returns search results grouped by object type.
read - Parameters
- sosl
kosmo integrations:call salesforce.salesforce_search '{"sosl":"example_sosl"}' --json kosmo integrations:salesforce salesforce_search '{"sosl":"example_sosl"}' --json salesforce.salesforce_describe_object
Get metadata for a Salesforce object type. Returns field definitions, relationships, record types, and other metadata. Example object types: Account, Contact, Lead, Opportunity, Case, Task, User.
read - Parameters
- object_type
kosmo integrations:call salesforce.salesforce_describe_object '{"object_type":"example_object_type"}' --json kosmo integrations:salesforce salesforce_describe_object '{"object_type":"example_object_type"}' --json salesforce.salesforce_list_objects
List all available Salesforce objects (standard and custom). Returns object names, labels, and key prefixes.
read - Parameters
- none
kosmo integrations:call salesforce.salesforce_list_objects '{}' --json kosmo integrations:salesforce salesforce_list_objects '{}' --json salesforce.salesforce_create_task
Create a new task in Salesforce. Supports Subject, Description, Status, Priority, WhoId (contact/lead), WhatId (account/opportunity), and ActivityDate. Returns the created task ID and success status.
write - Parameters
- subject, description, status, priority, who_id, what_id, activity_date
kosmo integrations:call salesforce.salesforce_create_task '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","who_id":"example_who_id","what_id":"example_what_id","activity_date":"example_activity_date"}' --json kosmo integrations:salesforce salesforce_create_task '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","who_id":"example_who_id","what_id":"example_what_id","activity_date":"example_activity_date"}' --json salesforce.salesforce_create_case
Create a new case in Salesforce. Supports Subject, Description, Status, Priority, Origin, ContactId, and AccountId. Returns the created case ID and success status.
write - Parameters
- subject, description, status, priority, origin, contact_id, account_id
kosmo integrations:call salesforce.salesforce_create_case '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","origin":"example_origin","contact_id":"example_contact_id","account_id":"example_account_id"}' --json kosmo integrations:salesforce salesforce_create_case '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","origin":"example_origin","contact_id":"example_contact_id","account_id":"example_account_id"}' --json salesforce.salesforce_list_recent
List recently accessed items in Salesforce. Returns recently viewed or modified records across all object types. Optionally specify a limit to control the number of items returned.
read - Parameters
- limit
kosmo integrations:call salesforce.salesforce_list_recent '{"limit":1}' --json kosmo integrations:salesforce salesforce_list_recent '{"limit":1}' --json salesforce.salesforce_get_user
Retrieve a Salesforce user by their ID. Returns the user's name, email, profile, role, and other fields.
read - Parameters
- id
kosmo integrations:call salesforce.salesforce_get_user '{"id":"example_id"}' --json kosmo integrations:salesforce salesforce_get_user '{"id":"example_id"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
salesforce.salesforce_create_lead 8 parameters
kosmo integrations:schema salesforce.salesforce_create_lead --json | Parameter | Type | Required | Description |
|---|---|---|---|
first_name | string | no | Lead first name. |
last_name | string | yes | Lead last name. |
company | string | yes | Lead company name. |
email | string | no | Lead email address. |
phone | string | no | Lead phone number. |
title | string | no | Lead job title. |
website | string | no | Lead website URL. |
other_fields | object | no | Additional custom fields as key-value pairs to merge into the request body. |
salesforce.salesforce_get_lead 1 parameters
kosmo integrations:schema salesforce.salesforce_get_lead --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce lead ID (18 or 15 character). |
salesforce.salesforce_update_lead 7 parameters
kosmo integrations:schema salesforce.salesforce_update_lead --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce lead ID to update. |
first_name | string | no | Lead first name. |
last_name | string | no | Lead last name. |
company | string | no | Lead company name. |
email | string | no | Lead email address. |
phone | string | no | Lead phone number. |
other_fields | object | no | Additional custom fields as key-value pairs to merge into the request body. |
salesforce.salesforce_create_contact 7 parameters
kosmo integrations:schema salesforce.salesforce_create_contact --json | Parameter | Type | Required | Description |
|---|---|---|---|
first_name | string | no | Contact first name. |
last_name | string | yes | Contact last name. |
email | string | no | Contact email address. |
phone | string | no | Contact phone number. |
account_id | string | no | Salesforce Account ID to associate the contact with. |
title | string | no | Contact job title. |
other_fields | object | no | Additional custom fields as key-value pairs to merge into the request body. |
salesforce.salesforce_get_contact 1 parameters
kosmo integrations:schema salesforce.salesforce_get_contact --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce contact ID (18 or 15 character). |
salesforce.salesforce_create_account 7 parameters
kosmo integrations:schema salesforce.salesforce_create_account --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Account name. |
website | string | no | Account website URL. |
phone | string | no | Account phone number. |
industry | string | no | Account industry (e.g. Technology, Finance). |
billing_city | string | no | Billing address city. |
billing_country | string | no | Billing address country. |
other_fields | object | no | Additional custom fields as key-value pairs to merge into the request body. |
salesforce.salesforce_get_account 1 parameters
kosmo integrations:schema salesforce.salesforce_get_account --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce account ID (18 or 15 character). |
salesforce.salesforce_update_account 5 parameters
kosmo integrations:schema salesforce.salesforce_update_account --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce account ID to update. |
name | string | no | Account name. |
website | string | no | Account website URL. |
phone | string | no | Account phone number. |
other_fields | object | no | Additional custom fields as key-value pairs to merge into the request body. |
salesforce.salesforce_create_opportunity 6 parameters
kosmo integrations:schema salesforce.salesforce_create_opportunity --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Opportunity name. |
amount | number | no | Opportunity amount (numeric). |
stage_name | string | yes | Sales stage (e.g. Prospecting, Qualification, Closed Won). |
close_date | string | yes | Expected close date (YYYY-MM-DD). |
account_id | string | no | Salesforce Account ID to associate the opportunity with. |
probability | number | no | Win probability as a percentage (0-100). |
salesforce.salesforce_get_opportunity 1 parameters
kosmo integrations:schema salesforce.salesforce_get_opportunity --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce opportunity ID (18 or 15 character). |
salesforce.salesforce_query 1 parameters
kosmo integrations:schema salesforce.salesforce_query --json | Parameter | Type | Required | Description |
|---|---|---|---|
soql | string | yes | SOQL query string (e.g. SELECT Id, Name FROM Account LIMIT 10). |
salesforce.salesforce_search 1 parameters
kosmo integrations:schema salesforce.salesforce_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
sosl | string | yes | SOSL search string (e.g. FIND {test} IN ALL FIELDS RETURNING Account(Id, Name)). |
salesforce.salesforce_describe_object 1 parameters
kosmo integrations:schema salesforce.salesforce_describe_object --json | Parameter | Type | Required | Description |
|---|---|---|---|
object_type | string | yes | Salesforce object API name (e.g. Account, Contact, Lead). |
salesforce.salesforce_list_objects 0 parameters
kosmo integrations:schema salesforce.salesforce_list_objects --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
salesforce.salesforce_create_task 7 parameters
kosmo integrations:schema salesforce.salesforce_create_task --json | Parameter | Type | Required | Description |
|---|---|---|---|
subject | string | yes | Task subject/title. |
description | string | no | Task description or body. |
status | string | no | Task status (e.g. Not Started, In Progress, Completed). |
priority | string | no | Task priority (e.g. Normal, High, Low). |
who_id | string | no | ID of the related Contact or Lead. |
what_id | string | no | ID of the related Account, Opportunity, or other object. |
activity_date | string | no | Due date for the task (YYYY-MM-DD). |
salesforce.salesforce_create_case 7 parameters
kosmo integrations:schema salesforce.salesforce_create_case --json | Parameter | Type | Required | Description |
|---|---|---|---|
subject | string | yes | Case subject/title. |
description | string | no | Case description or details. |
status | string | no | Case status (e.g. New, Working, Escalated, Closed). |
priority | string | no | Case priority (e.g. Low, Medium, High, Critical). |
origin | string | no | Case origin (e.g. Web, Email, Phone). |
contact_id | string | no | ID of the related Contact. |
account_id | string | no | ID of the related Account. |
salesforce.salesforce_list_recent 1 parameters
kosmo integrations:schema salesforce.salesforce_list_recent --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of items to return (default 25). |
salesforce.salesforce_get_user 1 parameters
kosmo integrations:schema salesforce.salesforce_get_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | Salesforce user ID (18 or 15 character). |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.