Connecting an AI Chatbot to HubSpot, Salesforce & Zoho (Tool-Calling Guide)
How to connect an AI chatbot to HubSpot, Salesforce, and Zoho with LLM function calling - the API mapping, the 5 fields to write, and the gotchas per CRM.
Connecting an AI Chatbot to HubSpot, Salesforce & Zoho
The short version: an AI chatbot writes to a CRM through function calling. You define a set of tools - create_contact, update_contact, log_activity, book_meeting, qualify_lead - and each tool maps to a single REST API call on HubSpot, Salesforce, or Zoho. The LLM decides which tool to invoke and with what arguments; your code validates those arguments and executes the API request. This guide is the implementer’s map from function schema to each CRM’s API, plus the one gotcha that bites teams on each platform.
If you are still choosing between the three, start with our HubSpot vs Salesforce vs Zoho comparison. This post assumes you have picked one (or need to support all three) and now have to make the wiring work.
How does an AI chatbot write to a CRM?
Every modern LLM supports tool calling (function calling): you give the model a list of functions with JSON-schema parameters, and instead of replying in prose it returns a structured request to call one. That structured request is the bridge to your CRM.
A minimal tool schema for capturing a lead looks like this:
{
"name": "create_contact",
"description": "Create or update a CRM contact from the conversation.",
"parameters": {
"type": "object",
"properties": {
"email": { "type": "string", "format": "email" },
"phone": { "type": "string", "description": "E.164, e.g. +9715XXXXXXXX" },
"first_name": { "type": "string" },
"company": { "type": "string" },
"notes": { "type": "string" }
},
"required": ["email"]
}
}
The loop is always the same. The model emits a create_contact call with arguments, your handler validates and deduplicates before touching the API, then makes the REST request and returns the result to the model so the conversation continues. Critically, the integration runs both directions: read the CRM at the start of a chat to greet a known contact by name and skip questions you already have answers to, then write conversation outcomes back at the end. The function-calling patterns post goes deeper on tool design; here we focus on the API mapping.
The five fields to write on every record
Before the per-CRM details, agree on the payload. Write these five fields on every chatbot-originated record, regardless of platform:
- email - lowercased, trimmed, and validated. This is your dedupe key, so normalize it before every write.
- phone - in E.164 format (
+971...), never free-text. - source -
chatbot, orchatbot:<bot-id>if you run several. - first_conversation_url - a deep link back to the transcript.
- all utm_* parameters - captured from the page the chat started on, so marketing attribution survives.
These five make every lead traceable, deduplicable, and attributable. Skip them and you get orphan records nobody can act on.
How do you integrate HubSpot?
HubSpot is the easiest of the three to integrate, and it gives you three distinct APIs to choose between:
- Forms API - for simple, low-volume captures. It handles dedupe and fires workflows for you, so a “just get the email into HubSpot” flow needs almost no code.
- CRM API (
/crm/v3/objects/contacts) - for everything richer: reading a contact to personalize, updating properties, associating deals, and creating custom objects. This is where most of your tool calls land. - Conversations API - for storing the chat transcript against the contact.
The one non-negotiable: use OAuth, not the legacy hapikey. HubSpot deprecated API keys in 2022, and new integrations must use OAuth access tokens (or a private-app token for single-account internal tools). A create_contact tool maps to a single upsert:
POST /crm/v3/objects/contacts
Authorization: Bearer <oauth_token>
{ "properties": { "email": "...", "phone": "...", "hs_lead_status": "NEW" } }
Map log_activity to the engagements/notes endpoint and book_meeting to the meetings API. HubSpot’s property model is forgiving, which is exactly why the discipline of the five standard fields matters - it is easy to sprawl.
How do you integrate Salesforce?
Salesforce has the most powerful API of the three and the easiest to misuse. The trap is governor limits: Salesforce meters API consumption, and the naive approach - one call to insert a Lead, a second call to log the Activity - doubles your usage per conversation and will throttle you at volume.
The fix is the Composite API, which inserts the Lead and its related Activity in a single round trip:
POST /services/data/v60.0/composite
{
"compositeRequest": [
{ "method": "POST", "url": ".../sobjects/Lead", "referenceId": "newLead",
"body": { "Email": "...", "Phone": "...", "LeadSource": "Chatbot" } },
{ "method": "POST", "url": ".../sobjects/Task", "referenceId": "logActivity",
"body": { "WhoId": "@{newLead.id}", "Subject": "Chatbot conversation" } }
]
}
Two more Salesforce-specific choices: use Platform Events via the Pub/Sub API when you need real-time reactions (route a hot lead to a rep the instant the chat closes), and use Bulk API 2.0 for any batch over 200 records rather than looping single inserts. Authenticate with the OAuth 2.0 web-server or JWT-bearer flow depending on whether a human is present.
How do you integrate Zoho?
Zoho CRM is a strong mid-market fit and integrates through its REST API v2+ with OAuth. The mental model is modules: you work against Leads, Contacts, and Deals as first-class resources rather than a single generic object.
A create_contact tool maps to an upsert into the relevant module:
POST /crm/v6/Leads/upsert
Authorization: Zoho-oauthtoken <token>
{ "data": [ { "Email": "...", "Phone": "...", "Lead_Source": "Chatbot" } ] }
Zoho’s real strength for chatbot automation is its webhooks and workflow rules: rather than orchestrate every follow-up in your own code, you let a Zoho workflow rule fire when a chatbot lead lands - assign an owner, send a notification, kick off a sequence. Watch the OAuth token scoping (Zoho scopes are granular per module and operation) and the data-center domain, which differs by region.
CRM integration cheat sheet
| CRM | Auth | Key APIs | The one gotcha |
|---|---|---|---|
| HubSpot | OAuth (or private-app token) | Forms API, CRM API (/crm/v3/objects/contacts), Conversations API | Never use the legacy hapikey - deprecated 2022 |
| Salesforce | OAuth 2.0 (web-server / JWT) | Composite API, Pub/Sub (Platform Events), Bulk API 2.0 | Governor limits - use Composite to insert Lead + Activity in one call |
| Zoho | OAuth (Zoho-oauthtoken) | REST API v2+, module endpoints (Leads/Contacts/Deals), webhooks | Module-scoped tokens + region-specific data-center domain |
How do you automate what happens after the write?
Writing the record is step one; the value is in the outcome-triggered automation. The pattern is the same across all three: the chatbot writes a qualified lead, and a native CRM workflow reacts. A hot lead should create an opportunity or deal, assign a rep, and fire a Slack or Teams notification - built as a Salesforce Flow, a HubSpot Workflow, or a Zoho Workflow Rule.
Keep this logic in the CRM, not in the chatbot. The model qualifies and writes; the CRM owns routing and notification. That separation keeps your prompt simple and lets sales ops tune the follow-up without touching agent code.
Should you use MCP?
Increasingly, yes. The Model Context Protocol is emerging as the clean integration layer here: a CRM MCP server exposes create_contact, update_contact, and log_activity as standard tools, so you wire each CRM once instead of hand-coding its API into every agent you build. Your chatbot, an internal ops agent, and a data-enrichment job all consume the same server.
This got materially more practical with the 2026-07-28 MCP spec: the stateless core means a CRM MCP server is just an HTTP service you can run behind an ordinary load balancer, and the OAuth/OIDC alignment lets your identity team govern which agent can touch which CRM. If you go this route, our skills and plugins development practice builds exactly these connectors.
Guardrails you cannot skip
Function calling gives the model a hand on your production CRM, so the guardrails are not optional:
- Validate and dedupe before every write. Normalize the email, check for an existing record, and update rather than create a duplicate.
- Never let the model invent field values. Enums, owner IDs, and stage names come from your code or the CRM, not from the LLM’s imagination. Constrain them in the schema and reject anything off-list.
- Confirm before booking meetings or any irreversible action. Show the proposed time and get an explicit yes.
- Handle PII carefully. For UAE and GCC deployments this is a compliance requirement, not a nicety: under the UAE Personal Data Protection Law (PDPL) you must control who accesses personal data and where it lives. Keep CRM data residency in mind when the chatbot, the LLM provider, and the CRM sit in different regions, and log every write for audit.
The bottom line
Connecting an AI chatbot to HubSpot, Salesforce, or Zoho is a function-calling problem: define your tools, map each to one REST call, write the same five fields every time, and let native CRM workflows handle what happens next. HubSpot rewards you for using OAuth and the right API for the job; Salesforce rewards you for respecting governor limits with the Composite API; Zoho rewards you for leaning on module scoping and workflow rules. And if you are building more than one integration, a CRM MCP server is the layer that keeps the wiring sane.
NomadX is an AI agents consultancy in Dubai that connects chatbots and agents to CRM stacks for UAE and GCC enterprises - with validation, dedupe, and PDPL-safe data handling built in. If you want your chatbot writing clean, attributable leads into HubSpot, Salesforce, or Zoho - book a free 30-minute consultation.
Frequently Asked Questions
How do you connect an AI chatbot to HubSpot, Salesforce, or Zoho?
You expose each CRM operation as an LLM function-calling tool - create_contact, update_contact, log_activity, book_meeting, qualify_lead - and map each tool to a REST API call on the CRM. The model decides which tool to call and with what arguments; your code validates the arguments and executes the API request. The integration is bi-directional: read the CRM to personalize the conversation, write outcomes back when the chat ends.
Should you use the Forms API or the CRM API for HubSpot?
Use the HubSpot Forms API for simple, low-volume lead captures - it handles dedupe and workflow triggers for you. Use the CRM API (/crm/v3/objects/contacts) for everything richer: reading records to personalize, updating properties, associating deals, and logging activities. Use the Conversations API to store transcripts. Authenticate with OAuth, never the legacy hapikey, which HubSpot deprecated in 2022.
What is the biggest gotcha integrating a chatbot with Salesforce?
Governor limits. Salesforce meters API usage, and doing two separate calls to insert a Lead and then log an Activity doubles your consumption. Use the Composite API to insert the Lead and its Activity in one round trip. For real-time reactions use Platform Events (Pub/Sub API), and for batches over 200 records use Bulk API 2.0 rather than looping single inserts.
Which fields should a chatbot always write to the CRM?
Write five fields on every chatbot-originated record: email (lowercased, trimmed, validated - your dedupe key), phone in E.164 format, source (chatbot or chatbot:<bot-id>), first_conversation_url, and all utm_* parameters. These five make every chatbot lead traceable, deduplicable, and attributable back to the campaign that produced it.
Does MCP help connect a chatbot to a CRM?
Yes. A CRM MCP server exposes create_contact, update_contact, and log_activity as Model Context Protocol tools, so you wire the CRM once instead of hand-coding each API into every agent. This is increasingly the clean integration layer, and the stateless 2026-07-28 MCP spec makes these servers cheap to run behind standard load balancers.
Complementary NomadX Services
Related Articles
Get Started for Free
Schedule a free consultation with our AI agents team. 30-minute call, actionable results in days.
Talk to an Expert