AI & Integrations

CRM Integrations

Sync leads and events with your CRM. When a lead replies, bounces, or books a meeting, Cleanmails can automatically create or update records in your CRM.

Native Integrations

CRMConnection MethodCapabilities
HubSpotOAuth2Create/update contacts, create deals, associate deals to contacts, sync lead status

HubSpot Integration

The HubSpot integration syncs automatically on these events:

  • Lead replied — Creates or updates the contact in HubSpot, sets status to "OPEN"
  • Meeting booked — Creates a deal in the default pipeline + associates to contact
  • Lead bounced — Updates contact status to "UNQUALIFIED"

Contact fields synced: email, first name, last name, company, job title, lead status.

OAuth2 CRMs (URL Generation)

The following CRMs have OAuth2 authorization URL generation built in. Full token exchange is being expanded:

CRMStatus
SalesforceOAuth URL ready — requires SALESFORCE_CLIENT_ID env var
PipedriveOAuth URL ready — requires PIPEDRIVE_CLIENT_ID env var

Via Automation Platforms

For CRMs without native integration, connect through webhooks and automation platforms:

CRMConnect Via
SalesforceZapier, Make, n8n
PipedriveZapier, Make, n8n
GoHighLevelWebhooks, Zapier
Zoho CRMZapier, Make
CloseZapier, n8n
FreshsalesZapier, Make

Use Cleanmails webhooks (9 event types with HMAC-signed payloads) as triggers in your automation platform to push data to any CRM.

Connecting HubSpot

  1. Go to Settings → Integrations
  2. Click Connect on HubSpot
  3. Complete the OAuth2 authorization flow
  4. Grant permissions: crm.objects.contacts.write, crm.objects.deals.write
  5. You'll be redirected back to the settings page
Token security

All OAuth tokens and API keys are encrypted with AES-256-GCM using your ENCRYPTION_KEY before storage. They are never exposed in API responses.

Connection Types

The integration system supports three connection methods:

TypeProvidersHow It Works
OAuth2HubSpot, Salesforce, PipedriveUser authorizes via redirect → tokens stored encrypted
WebhookSlack, Discord, Telegram, Notion, Google SheetsPaste webhook URL → events POST to that URL
API KeyAny provider without OAuthEnter API key → stored encrypted

API

MethodEndpointDescription
GET/api/v1/workspaces/:wid/integrationsList all integrations
POST/api/v1/workspaces/:wid/integrations/:provider/connectConnect (returns OAuth URL or saves key)
DELETE/api/v1/workspaces/:wid/integrations/:providerDisconnect
GET/api/v1/workspaces/:wid/integrations/:provider/callbackOAuth callback handler