Back to Blog
AI Builds

How to Connect Claude to Salesforce: 4 Ways That Actually Work

SG

Shivam Goel

Strategy & Growth Associate

9 min read - Jul 31, 2026

The short version

  • There are four real ways to connect Claude and Salesforce: the Anthropic Messages API from Apex or Flow, Claude inside Agentforce via Amazon Bedrock, an MCP server for Claude Desktop and Claude Code, and Claude Code for development work.
  • The API pattern uses Salesforce Named Credentials with the x-api-key and anthropic-version headers, async Queueable Apex, and results written back to the record - no secrets ever live in code.
  • The Salesforce-Anthropic partnership makes Claude available inside Agentforce through Amazon Bedrock, keeping data within the Salesforce trust boundary for regulated industries.
  • MCP lets Claude Desktop query and update an org in plain English, with permissions enforced by a dedicated integration user.
  • Cloudsheer runs this stack in production: the Marc chatbot, the CRM Advisor, and the Salesforce Formula Generator on cloudsheer.com are all Claude-powered.

Why Wire Claude Into Salesforce at All

The pitch is simple: your team already lives in Salesforce, and Claude is very good at the work that piles up there - summarizing a messy case thread, drafting a reply from full context, pulling structured fields out of an email, answering a plain-English question about pipeline. Connect the two properly and that work happens on the record, automatically, with an audit trail. Copy-pasting CRM data into a chat window stops being anyone's job.

We say this with production receipts rather than vendor slides: three Claude-powered tools run live on this site - Marc the chatbot, the CRM Advisor, and the Salesforce Formula Generator. The patterns below are the ones we deploy for clients, ranked from most common to most specialized.

API
Anthropic Messages API from Apex or Flow
Bedrock
Claude inside Agentforce, in the trust boundary
MCP
Claude Desktop talking to your org
Code
Claude Code building on the platform
The four connection patterns at a glance.

Pattern 1: The Anthropic API From Apex or Flow

This is the workhorse. A record change or a button fires a Flow, Apex assembles record context into a prompt, and a Queueable class posts it to the Anthropic Messages API through a Named Credential. Claude's response is parsed and written back to dedicated fields - a summary, a draft reply, extracted data - with the model and token count logged for audit.

The details that separate a production build from a demo: the API key lives in an External Credential (never in code), the anthropic-version header rides along on every call, prompts are stored in Custom Metadata so admins can tune them without a deployment, and model choice is deliberate - claude-haiku-4-5 for high-volume routine work, claude-sonnet-5 where the reasoning is hard. Three Apex constraints shape the architecture: no streaming, a 120-second callout ceiling, and no callouts after uncommitted DML. All three are solved by running async with max_tokens sized to the job.

A first use case - case summarization on arrival with a drafted reply for agent review - typically ships in two to four weeks including sandbox testing and a parallel run against human output.

Pattern 2: Claude Inside Agentforce via Amazon Bedrock

Salesforce and Anthropic have a partnership that makes Claude models available inside Agentforce through Amazon Bedrock. The significance is where the processing happens: within the Salesforce trust boundary, which is precisely what compliance teams in financial services and healthcare have been waiting for before letting agentic AI near regulated data.

Practically, this means your Agentforce agents can reason with Claude while licensing runs through Salesforce and your data never takes a detour. The build work is the same discipline as any Agentforce deployment - topics, actions, guardrails, and evaluation - with model configuration on top. If you already run Agentforce, this is the lowest-friction way to get Claude's reasoning into your workflows.

Pattern 3: MCP - Talk to Your Org From Claude Desktop

The Model Context Protocol is the newest pattern and the one that makes people sit up in demos. An MCP server exposes tools - run a SOQL query, update a record - and Claude Desktop or Claude Code connects to it. Your RevOps lead asks 'which enterprise accounts have open cases older than a week?' in plain English, and Claude runs the query and explains the answer.

The governance question everyone asks has a clean answer: Claude acts through a dedicated integration user, so field-level security, sharing rules, and object permissions apply exactly as they would to a human with that profile. Claude sees what you grant and nothing else. We scope MCP deployments read-mostly to start - query freely, write only where a human confirms.

Pattern 4: Claude Code for Salesforce Development

The fourth pattern is not about connecting Claude to your org's data - it is about connecting Claude to your development workflow. Claude Code, armed with a skill library, ships production-quality Apex, Flows, and Lightning Web Components with the governor limits and bulkification patterns already baked in.

We publish 141 free, open Salesforce skills for exactly this: integration playbooks we authored for tools like Stripe, HubSpot, and DocuSign, plus the official Salesforce platform skills mirrored under Apache 2.0. Install any of them with a single npx command and your coding agent builds with a known-good approach instead of improvising. They work with Claude Code, Cursor, Codex, and Agentforce Vibes.

Which Pattern Should You Start With?

If you want AI working inside your service or sales process this quarter, start with Pattern 1 - the API from Apex. It is the fastest path to measurable value and everything it builds (clean prompts, AI fields, audit logging) carries forward. If you are already on Agentforce in a regulated industry, Pattern 2 is your route. If your analysts ask more questions than your dashboards answer, Pattern 3 pays back immediately. And Pattern 4 costs nothing to try today.

The full build detail - architecture, the exact Named Credential setup, field mapping, security, monitoring, and the pitfalls we design out - is in our free technical guide, linked below. And if you would rather have it built than read about it: this is literally what we do, at a fixed price, by the team that runs Claude in production on the site you are reading.

Frequently Asked Questions

What is the easiest way to connect Claude to Salesforce?

For most teams, the Anthropic Messages API called from Flow or Apex through a Named Credential. It needs no middleware, the API key stays in Salesforce’s credential store, and a first use case like case summarization typically ships in two to four weeks including testing.

Does Salesforce officially support Claude?

Yes - Salesforce and Anthropic have a partnership that brings Claude models into Agentforce through Amazon Bedrock, with processing kept inside the Salesforce trust boundary. It is aimed at regulated industries like financial services and healthcare, and licensing runs through Salesforce.

What Salesforce objects can Claude work with?

Any of them. The API pattern assembles a prompt from whatever record context you choose - Cases, Leads, Opportunities, or custom objects - and writes results back to fields you designate. Through MCP, Claude can query any object the integration user’s permissions expose.

Is it safe to send CRM data to Claude?

Under Anthropic’s commercial API terms, inputs and outputs are not used for model training by default. For sensitive fields you can add a redaction step before anything leaves Salesforce, and the Bedrock pattern keeps processing inside the Salesforce trust boundary entirely.

What are the Apex limitations when calling the Claude API?

Three worth designing around: Apex cannot consume streaming responses, so you request complete messages; synchronous callouts cap at 120 seconds, so long generations run in Queueable Apex; and you cannot call out after uncommitted DML in the same transaction, so the Claude call happens first or async.

Can Claude write Salesforce code?

Very well - that is the fourth pattern. Claude Code with a skill library ships production-quality Apex, Flows, and LWC. Cloudsheer publishes 141 free Salesforce skills for exactly this, covering integration playbooks and the official Salesforce platform skills.

Want to see how this applies to your business?

Book a free 30-minute call. We will walk through your specific use case and show you what's possible.

Book Free Discovery Call
Ask me anything