How do I connect an external CRM?
Last checked 31 Aug 2026
Short answer
Ask Lovable to build a server function that sends or fetches records via your CRM's REST API (HubSpot, Salesforce, Pipedrive, etc.), using an API key stored as a secret.
The general approach
Most CRMs (HubSpot, Salesforce, Pipedrive, Zoho) expose a REST API and issue an API key or OAuth token. The Lovable-side pattern is the same regardless of which CRM:
- Get an API key/token from your CRM's developer or integrations settings.
- Ask Lovable to store it as a secret.
- Ask Lovable to build a server function that calls the CRM's API.
- Trigger that function from the relevant place in your app — usually a form submission.
"When someone submits the contact form, send their name, email and message to HubSpot as a new contact, using my HubSpot API key stored as a secret."
Two directions of sync
- Push: your app sends new leads/contacts into the CRM (most common — contact forms, signups, orders).
- Pull: your app reads CRM data to display back to users (less common, needs more careful rate-limit and caching thought).
Handling duplicates and updates
Ask Lovable to check whether a contact already exists (by email) before creating a new one, and update instead of duplicating — most CRM APIs support an upsert-style call or a search-then-create pattern.
What usually goes wrong
- API key exposed in front-end code — always route through a server function.
- Field mapping mismatches (your form field names don't match the CRM's expected property names), causing silent failures or blank fields in the CRM.
- Rate limits on the CRM's API causing failures during traffic spikes — ask for basic retry/error handling.
- OAuth-based CRMs (Salesforce, some HubSpot scopes) needing token refresh logic, which is more involved than a static API key — flag this to Lovable up front if your CRM uses OAuth.
For CRMs with complex OAuth flows or custom objects, PromptSites.com can build a reliable integration rather than a fragile one-off.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I install Google Tag Manager?Ask Lovable to add your GTM container snippet to the site's shared head and body, then manage individual tags (analytics, ads, pixels) from within Tag Manager itself.
- AnswerHow do I connect an API to Lovable?Describe the API and what you want it to do in Chat; Lovable will typically wire the call through a server function (Edge Function) so any API key stays off the client.
- AnswerHow do I connect Meta Pixel?Ask Lovable to add your Meta Pixel ID as a script in the site's shared head, and fire a PageView (or custom) event on each route change since Lovable apps are single-page apps.
- AnswerHow do I use webhooks?Webhooks let external services notify your Lovable app when something happens; ask Lovable to create a server function URL as the webhook endpoint, and configure that URL in the third-party service.