# langchain-salesforce
This package contains the LangChain integration with Salesforce, providing tools to interact with Salesforce CRM data using LangChain's framework.
## Features
- Salesforce CRM integration with LangChain
- SOQL query execution
- Object schema inspection
- CRUD operations on Salesforce objects
- Comprehensive error handling
## Installation
```bash
pip install -U langchain-salesforce
```
## Configuration
Configure your Salesforce credentials by setting the following environment variables:
* `SALESFORCE_USERNAME` - Your Salesforce username
* `SALESFORCE_PASSWORD` - Your Salesforce password
* `SALESFORCE_SECURITY_TOKEN` - Your Salesforce security token
* `SALESFORCE_DOMAIN` - Your Salesforce domain (defaults to "login", use "test" for sandbox)
## Usage
The `SalesforceTool` class provides a comprehensive interface to interact with Salesforce CRM:
```python
from langchain_salesforce import SalesforceTool
# Initialize the tool
tool = SalesforceTool(
username="your-username",
password="your-password",
security_token="your-security-token",
domain="login" # or "test" for sandbox
)
# Query contacts
result = tool.run({
"operation": "query",
"query": "SELECT Id, Name, Email FROM Contact LIMIT 5"
})
# Get object schema
schema = tool.run({
"operation": "describe",
"object_name": "Account"
})
# Create new contact
new_contact = tool.run({
"operation": "create",
"object_name": "Contact",
"record_data": {"LastName": "Smith", "Email": "smith@example.com"}
})
# Update a contact
updated_contact = tool.run({
"operation": "update",
"object_name": "Contact",
"record_id": "003XXXXXXXXXXXXXXX",
"record_data": {"Email": "new.email@example.com"}
})
# Delete a contact
delete_result = tool.run({
"operation": "delete",
"object_name": "Contact",
"record_id": "003XXXXXXXXXXXXXXX"
})
# List available objects
objects = tool.run({
"operation": "list_objects"
})
```
## Supported Operations
- `query`: Execute SOQL queries
- `describe`: Get object schema information
- `list_objects`: List available Salesforce objects
- `create`: Create new records
- `update`: Update existing records
- `delete`: Delete records
## Development
To contribute to this project:
1. Clone the repository
2. Install dependencies with Poetry:
```bash
poetry install
```
3. Run tests:
```bash
make test
```
4. Run linting:
```bash
make lint
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/colesmcintosh/langchain-salesforce",
"name": "langchain-salesforce",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "langchain, salesforce, crm, ai, llm",
"author": "Cole McIntosh",
"author_email": "colemcintosh6@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/81/31/39db0ac8e998ceced0d8ef4887a529946dded75e4dd48e5ade11c0191d8b/langchain_salesforce-0.1.1.tar.gz",
"platform": null,
"description": "# langchain-salesforce\n\nThis package contains the LangChain integration with Salesforce, providing tools to interact with Salesforce CRM data using LangChain's framework.\n\n## Features\n\n- Salesforce CRM integration with LangChain\n- SOQL query execution\n- Object schema inspection\n- CRUD operations on Salesforce objects\n- Comprehensive error handling\n\n## Installation\n\n```bash\npip install -U langchain-salesforce\n```\n\n## Configuration\n\nConfigure your Salesforce credentials by setting the following environment variables:\n\n* `SALESFORCE_USERNAME` - Your Salesforce username\n* `SALESFORCE_PASSWORD` - Your Salesforce password\n* `SALESFORCE_SECURITY_TOKEN` - Your Salesforce security token\n* `SALESFORCE_DOMAIN` - Your Salesforce domain (defaults to \"login\", use \"test\" for sandbox)\n\n## Usage\n\nThe `SalesforceTool` class provides a comprehensive interface to interact with Salesforce CRM:\n\n```python\nfrom langchain_salesforce import SalesforceTool\n\n# Initialize the tool\ntool = SalesforceTool(\n username=\"your-username\",\n password=\"your-password\",\n security_token=\"your-security-token\",\n domain=\"login\" # or \"test\" for sandbox\n)\n\n# Query contacts\nresult = tool.run({\n \"operation\": \"query\",\n \"query\": \"SELECT Id, Name, Email FROM Contact LIMIT 5\"\n})\n\n# Get object schema\nschema = tool.run({\n \"operation\": \"describe\",\n \"object_name\": \"Account\"\n})\n\n# Create new contact\nnew_contact = tool.run({\n \"operation\": \"create\",\n \"object_name\": \"Contact\",\n \"record_data\": {\"LastName\": \"Smith\", \"Email\": \"smith@example.com\"}\n})\n\n# Update a contact\nupdated_contact = tool.run({\n \"operation\": \"update\",\n \"object_name\": \"Contact\",\n \"record_id\": \"003XXXXXXXXXXXXXXX\",\n \"record_data\": {\"Email\": \"new.email@example.com\"}\n})\n\n# Delete a contact\ndelete_result = tool.run({\n \"operation\": \"delete\",\n \"object_name\": \"Contact\",\n \"record_id\": \"003XXXXXXXXXXXXXXX\"\n})\n\n# List available objects\nobjects = tool.run({\n \"operation\": \"list_objects\"\n})\n```\n\n## Supported Operations\n\n- `query`: Execute SOQL queries\n- `describe`: Get object schema information\n- `list_objects`: List available Salesforce objects\n- `create`: Create new records\n- `update`: Update existing records\n- `delete`: Delete records\n\n## Development\n\nTo contribute to this project:\n\n1. Clone the repository\n2. Install dependencies with Poetry:\n```bash\npoetry install\n```\n\n3. Run tests:\n```bash\nmake test\n```\n\n4. Run linting:\n```bash\nmake lint\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "An integration package connecting Salesforce and LangChain",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/colesmcintosh/langchain-salesforce",
"Release Notes": "https://github.com/colesmcintosh/langchain-salesforce/releases",
"Repository": "https://github.com/colesmcintosh/langchain-salesforce",
"Source Code": "https://github.com/colesmcintosh/langchain-salesforce"
},
"split_keywords": [
"langchain",
" salesforce",
" crm",
" ai",
" llm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "19ab7c873cce0118a6174b6f1ea1efb534bf367515bfb1cab4fb41691c527101",
"md5": "3c434ef1865511901c878ca04a9b6df9",
"sha256": "5ead61d10914adf5006eb3bc507a23c046e6d3f0b2dd81395b27c667f4ba4cb2"
},
"downloads": -1,
"filename": "langchain_salesforce-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c434ef1865511901c878ca04a9b6df9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 5744,
"upload_time": "2025-02-14T05:31:16",
"upload_time_iso_8601": "2025-02-14T05:31:16.131570Z",
"url": "https://files.pythonhosted.org/packages/19/ab/7c873cce0118a6174b6f1ea1efb534bf367515bfb1cab4fb41691c527101/langchain_salesforce-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "813139db0ac8e998ceced0d8ef4887a529946dded75e4dd48e5ade11c0191d8b",
"md5": "b0ec7cc0f46c7a2182aa6477b0fc8093",
"sha256": "77229814582117607b3f59c7927d0f2faf87bea999536eab1bac8dffe95cbfd3"
},
"downloads": -1,
"filename": "langchain_salesforce-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "b0ec7cc0f46c7a2182aa6477b0fc8093",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5134,
"upload_time": "2025-02-14T05:31:18",
"upload_time_iso_8601": "2025-02-14T05:31:18.088879Z",
"url": "https://files.pythonhosted.org/packages/81/31/39db0ac8e998ceced0d8ef4887a529946dded75e4dd48e5ade11c0191d8b/langchain_salesforce-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-14 05:31:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "colesmcintosh",
"github_project": "langchain-salesforce",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "langchain-salesforce"
}