Valiopt
← Back to Blog

How to Integrate Intercom with PostgreSQL: Patterns, Use Cases, and Architecture

A PostgreSQL Intercom integration can make support dramatically more useful: agents can see subscription, order, or account context without opening five tabs; operations teams can analyze conversations alongside product data; and workflows can act on business rules that do not live in Intercom.

A reliable integration needs clear field ownership, dependable identity resolution, and safeguards that prevent duplicate or late events from triggering the same refund, message, or escalation twice. This guide covers the main ways to connect Intercom to PostgreSQL and how to choose a safe architecture.

Why connect Intercom and PostgreSQL?

Intercom knows about contacts, conversations, teammates, tags, and support activity. PostgreSQL often holds the context required to resolve the request: account status, plan, orders, entitlements, risk flags, and the outcome of earlier workflow runs. Joining the two enables several useful patterns:

  • Enrich conversations: show plan, lifetime value, shipment state, or last payment next to the customer asking for help.
  • Write support events to your warehouse: retain a clean event history for analytics, QA, and operational reporting.
  • Segment and prioritize: route a failed renewal differently from a general question, or prioritize customers whose orders are already outside their promised delivery window.
  • Trigger proactive messages: notify affected customers when a PostgreSQL query identifies a delay or account state change.
  • Measure outcomes: connect first response, resolution, reopen, CSAT, refund, retention, and repeat-contact data.

First decide which direction the data should flow

“Connect Intercom to PostgreSQL” can describe three different systems. Treat them separately, even if you eventually implement all three.

Intercom → PostgreSQL

Ingest contacts, conversations, ratings, assignments, and event history for reporting or downstream workflows.

PostgreSQL → Intercom

Sync selected customer attributes, create audiences, prioritize work, or provide trusted context to agents and automations.

Bidirectional workflow

Read current business state, apply policy, execute an action, and write the result back to both systems.

Avoid uncontrolled bidirectional field sync. Assign an owner to every field. For example, your application may own plan_tier, while Intercom owns last_support_contact_at. If both systems can overwrite a field, a stale sync can silently undo a correct update.

Five implementation patterns

1. Direct Intercom API

A custom Intercom API integration queries the Intercom REST API, transforms the response, and upserts rows into PostgreSQL—or reads PostgreSQL and calls Intercom to update a contact. This is a good fit for backfills, scheduled reconciliation, and request-time lookups. The conversation list endpoint uses cursor pagination, supports up to 150 results per page, and accepts an explicit Intercom-Version header. Pinning the version keeps payload changes from surprising your importer. See Intercom's conversation API reference.

Direct API work gives you precise control, but it also makes you responsible for checkpoints, pagination, partial failures, and rate limits. Intercom currently documents default limits for private apps of 10,000 calls per minute per app and 25,000 per workspace, distributed across 10-second windows. Use the returned rate-limit headers to control throughput and back off on HTTP 429. See Intercom's rate-limiting documentation.

2. Webhooks

Webhooks are the usual choice when Intercom events need to reach PostgreSQL quickly. Subscribe only to the topics you need—such as a new customer conversation, reply, assignment, close, rating, or contact update—and keep the receiver small. Intercom's current webhook topic reference lists the available conversation and contact topics and their permission requirements.

Validate the X-Hub-Signature against the raw request body, insert the notification into an inbox table using its webhookid as a unique key, enqueue processing, and return a successful response immediately. Intercom does not guarantee event order and may resend a notification when it does not receive a timely success response. Its delivery guidance recommends responding before long-running work; it also explains how sustained errors can pause or suspend a subscription. See the webhook delivery documentation.

3. ETL or reverse ETL

ETL tools are well suited to recurring Intercom-to-database replication. Reverse ETL tools do the opposite: they select approved fields or audience membership from PostgreSQL and sync them into Intercom. This is often the fastest route to analytics or segmentation, especially when a delay of a few minutes is acceptable.

Evaluate the connector below its logo. Confirm which Intercom objects and deletion events it supports, whether it performs incremental syncs, how it handles schema changes, what it uses as a merge key, and whether failed rows can be replayed without rerunning the whole batch.

4. Integration platform

Low-code automation platforms can connect a webhook or scheduled query to an Intercom action with little engineering. They work well for low-volume, reversible workflows. They become less attractive when the flow needs transactions, complex identity matching, high throughput, durable replay, or detailed audit evidence.

5. Custom workflow service

Use a custom service when the integration will perform consequential actions. Instead of giving an AI agent unrestricted database access, give it a narrow operation such as evaluate_refund_eligibility orreschedule_delivery. The service reads approved data, applies deterministic policy, records an idempotency key and audit trail, executes the action, and returns a structured result to Intercom.

Decision matrix

MethodBest forTypical latencyControlEffortMain caution
Direct Intercom APIBackfills, scheduled syncs, and request-time lookupsSeconds to hoursHighMediumPagination, versioning, and rate-limit handling
WebhooksNear-real-time Intercom eventsSecondsHighMediumDuplicates, unordered delivery, and replay
ETL / reverse ETLWarehouse syncs and audience activationMinutes to hoursMediumLow–mediumConnector coverage and sync semantics
Integration platformStraightforward, low-volume workflowsSeconds to minutesLow–mediumLowBranching, observability, and cost at scale
Custom workflow serviceOperational actions with policy checksReal timeHighestHighYou own reliability and maintenance

A reference architecture that supports both analytics and action

IntercomWebhooks + REST API
Ingestion endpointVerify, persist, acknowledge
Queue + workersNormalize, enrich, retry
PostgreSQLRaw inbox + normalized state
Policy serviceAuthorization + business rules
Metrics and alertsLag, failures, reconciliation
Controlled actions back to Intercom and operational systemsIdempotency key → policy check → action → audit record

Keep both a raw, append-only inbox and normalized tables. The raw payload lets you reprocess events after fixing a transformer; normalized tables make current-state reads fast and predictable. A scheduled reconciliation job should also use the REST API to repair gaps because a webhook stream provides notifications without guaranteeing a complete historical copy.

Field mapping and identity resolution

Identity resolution deserves its own design. Prefer an immutable internal customer ID stored as Intercom's external_id. Keep Intercom's contact ID as a separate foreign key. Email is useful for bootstrapping, but it changes, can be shared, and can appear on more than one contact. Never merge two customer records automatically on email alone when the consequence is an account-level action.

Intercom sourcePostgreSQL targetRule
Intercom contact.idintercom_contact_idStable Intercom foreign key; unique
Intercom contact.external_idcustomer_idPreferred join to your application user
Intercom contact.emailemail_normalizedFallback only; lowercase and trim
Intercom conversation.idintercom_conversation_idUnique conversation key
Webhook idintercom_event_idUnique idempotency key
Webhook created_atoccurred_atPreserve the source event time
data.itemraw_payloadJSONB audit and reprocessing copy

Store source timestamps and ingestion timestamps separately. Preserve unknown fields in JSONB, but promote fields used for joins, filters, and policy decisions into typed columns with constraints. Record the mapping version so a backfill can reproduce the same transformation.

Handling updates, retries, and duplicate events

Design for at-least-once, unordered delivery. Intercom's webhook envelope includes a notification id, created_at, anddelivery_attempts. Put a unique constraint on the notification ID and ignore duplicates at the database boundary. For mutable objects, update current state only when the incoming source timestamp is newer.

-- Raw inbox: the unique key makes webhook ingestion idempotent
INSERT INTO intercom_event_inbox
  (intercom_event_id, topic, occurred_at, raw_payload)
VALUES
  ($1, $2, to_timestamp($3), $4::jsonb)
ON CONFLICT (intercom_event_id) DO NOTHING;

-- Current state: protect newer data from late events
INSERT INTO intercom_conversations
  (intercom_conversation_id, state, source_updated_at)
VALUES ($1, $2, to_timestamp($3))
ON CONFLICT (intercom_conversation_id) DO UPDATE
SET state = EXCLUDED.state,
    source_updated_at = EXCLUDED.source_updated_at
WHERE intercom_conversations.source_updated_at
      < EXCLUDED.source_updated_at;

PostgreSQL documents that ON CONFLICT DO UPDATE provides an atomic insert-or-update outcome, which is useful for these idempotent consumers. See the official PostgreSQL INSERT reference.

Retry transient network errors and HTTP 429/5xx responses with bounded exponential backoff and jitter. Do not retry invalid payloads forever: move them to a dead-letter state with the error, attempt count, and next operator action. For outbound actions, create an internal operation ID before calling another system and reuse it on every attempt.

Security and personally identifiable information

  • Grant the Intercom app only the scopes required by subscribed topics and API calls.
  • Keep API tokens and the webhook client secret exclusively in a secrets manager.
  • Validate the webhook signature against the unmodified raw body using a constant-time comparison.
  • Use TLS in transit and encryption at rest; restrict database access to the integration's schema and operations.
  • Copy full conversation bodies into analytics tables only when the use case requires them.
  • Redact secrets, payment details, and unnecessary PII from logs and dead-letter records.
  • Define deletion and retention workflows across raw events, normalized tables, backups, and downstream warehouses.
  • Make the workflow service the authority for authorization and policy checks.

Monitoring and failure recovery

Monitor the integration as a data product and as an operational service. Useful signals include webhook acknowledgement latency, signature failures, queue depth, oldest-event age, processing error rate, API 429s, dead-letter count, last successful reconciliation, and the percentage of contacts that resolve to exactly one internal customer.

Every failure should have a recovery path. Operators need to be able to replay one event, replay a time range with the same transformation version, and run a targeted API reconciliation for one contact or conversation. Alerts should focus on user impact and growing lag; an isolated retry can remain visible in operational metrics.

PostgreSQL versus Redshift

An Intercom Redshift integration and an Intercom PostgreSQL integration solve related but different problems. PostgreSQL is usually the better operational store for low-latency lookups, idempotency records, workflow state, and transactional updates. Redshift is a managed data warehouse intended for large analytical workloads and BI.

If support automation must decide whether to change an order while the customer waits, read from a controlled PostgreSQL service or operational API. If analysts need to compare millions of support events with product, revenue, and retention data, load curated data into Redshift. Many teams use both: PostgreSQL for execution and Redshift for analysis.

Redshift DDL requires different assumptions from PostgreSQL. Amazon documents Redshift uniqueness, primary-key, and foreign-key constraints as informational, leaving the loading process responsible for preserving uniqueness. See AWS's Redshift table constraint documentation.

Implementation checklist

  • Write down each use case, required latency, and acceptable failure behavior.
  • Assign a source of truth and write direction to every synced field.
  • Choose a stable identity key; keep email as a cautious fallback.
  • Pin the Intercom API version and inventory required permission scopes.
  • Create a raw event inbox with a unique webhook ID and retention policy.
  • Acknowledge webhooks before running enrichment or outbound actions.
  • Make consumers idempotent and protect current state from late events.
  • Implement bounded retries, dead-letter handling, replay, and reconciliation.
  • Minimize PII and test deletion across every downstream copy.
  • Load-test event spikes and alert on lag as well as outright errors.
  • Require explicit policy checks, authorization, and audit logs for actions.
  • Test the happy path and a failure halfway through a multi-system workflow.

Turn the integration into a safer support workflow

The right integration gives agents and automations the smallest useful set of trusted actions, applies your business rules consistently, and leaves enough evidence to understand what happened when something fails.

Need a custom Intercom workflow?

Valiopt configures and maintains the orchestration between your support platform, customer database, commerce stack, and internal policies. Your team gets broader resolution coverage with narrowly scoped, controlled automation.