Skip to main content
A tool for interacting with Salesforce CRM using LangChain.

Overview

The langchain-salesforce package integrates LangChain with Salesforce CRM, allowing you to query data, manage records, and explore object schemas from LangChain applications.

Key features

  • SOQL Queries: Execute Salesforce Object Query Language (SOQL) queries
  • Object Management: Create, read, update, and delete (CRUD) operations on Salesforce objects
  • Schema Exploration: Describe object schemas and list available objects
  • Async Support: Asynchronous operation support
  • Error Handling: Detailed error messages
  • Environment Variable Support: Load credentials from environment variables

Setup

Install the required dependencies:

Authentication setup

These environment variables will be automatically picked up by the integration.

Getting your security token

If you need a security token:
  1. Log into Salesforce
  2. Go to Settings
  3. Click on “Reset My Security Token” under “My Personal Information”
  4. Check your email for the new token
Set up your Salesforce credentials as environment variables:

Instantiation

Invocation

Query

This example queries Salesforce for 5 contacts.

Describe an object

Fetches metadata for a specific Salesforce object.

List available objects

Retrieves all objects available in the Salesforce instance.

Create a new contact

Creates a new contact record in Salesforce.

Update a contact

Updates an existing contact record.

Delete a contact

Deletes a contact record from Salesforce.

Chaining


API reference

For comprehensive documentation and API reference, see:

Additional resources