Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 36 ยท Integration and Data

Integration Patterns and APIs for ERP and CRM

Learn how ERP and CRM systems exchange data: point-to-point vs hub, REST APIs, webhooks, batch files, idempotency, retries and error queues, with runnable Python simulations.

No ERP or CRM lives alone. Orders arrive from a web shop, customers are created in a CRM and need an account in the ERP, shipping labels come from a carrier, payments come from a bank, and employee data flows from HR. Integration is how these systems stay in step. Bad integration is a leading source of go-live problems: lost orders, duplicate invoices and numbers that disagree between systems.

This lesson covers the main patterns, how APIs and events work, and the reliability techniques every integration needs. The products are not available here, so we simulate systems in Python and show real-world request shapes as read-only text.

Why integration is hard

Systems differ in data models (a "customer" in CRM is an account plus contacts; in ERP it is a sold-to, ship-to and bill-to), timing (instant vs nightly), ownership and technology. Networks fail, systems go down for maintenance, messages arrive twice or out of order. A good design plans for those failures instead of hoping they never happen.

Integration styles

Topologies

Point-to-point Each pair of systems has its own link.
Hub and spoke One middleware connects everyone.
Event bus Systems publish and subscribe to events.

N systems need up to N(N-1)/2 point-to-point links.

1 / 2
  • Point-to-point: simplest for two systems; becomes a tangle at 8 or 10 systems. Ten systems could need 45 individual links.
  • Hub and spoke / integration platform (iPaaS, ESB): middleware translates formats, routes messages, monitors flows. One place to manage and secure.
  • Event-driven: a system announces "OrderCreated" and any interested system reacts. Loosely coupled, scales well, harder to trace.
  • Batch: a nightly CSV or EDI file exchange; robust and cheap, but data is stale for hours.
  • Synchronous API call: the caller waits for an answer, for example a credit check before accepting an order. Needs the other system to be up.
  • Asynchronous messaging: the sender drops a message in a queue and continues. The receiver processes it when ready.
Python How many links? Point-to-point vs hub

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

APIs: how systems talk

Most modern ERP and CRM products expose REST or similar web APIs: you send an HTTP request with JSON and get JSON back. Common elements are resources (/customers, /orders), verbs (GET read, POST create, PATCH update, DELETE remove), authentication (OAuth 2.0 tokens, API keys), pagination for long lists, rate limits and versioning. Some products also offer older SOAP/XML services, OData, GraphQL or bulk APIs for large volumes.

A read-only sketch of a request (illustrative, not a real product endpoint):

HTTP
POST /api/v1/sales-orders HTTP/1.1
Authorization: Bearer <token>
Content-Type: application/json
Idempotency-Key: web-order-100245

{
  "customerId": "C-4711",
  "currency": "EUR",
  "lines": [ { "sku": "WID-001", "quantity": 12 } ]
}

The answer usually carries a status code: 201 Created on success, 400 for invalid data, 401/403 for permission problems, 409 for a conflict, 429 for rate limiting, and 5xx for server trouble.

Webhooks reverse the direction: the system calls your URL when something changes ("customer updated"), so you do not poll constantly.

Reliability: idempotency, retries, queues

Networks are unreliable, so a sender often cannot tell whether a request succeeded. Retrying is necessary, but a retried "create order" may create a duplicate. The cure is idempotency: processing the same message twice has the same effect as processing it once. A common technique is an idempotency key (or business key such as the web order number) that the receiver stores.

Python Duplicate orders without idempotency (simulation)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The first call saves the order but the response is lost, so the sender retries. Without the idempotency key the receiver creates two orders; with it, the retry is recognized.

Other reliability techniques:

  • Retries with backoff: wait a little longer after each failure (1 s, 2 s, 4 s...), with a maximum number of attempts, to avoid hammering a struggling system.
  • Queues: buffer messages so a short outage of the receiver loses nothing.
  • Dead-letter queue (error queue): messages that keep failing go to a holding area for a person to inspect, fix and replay. Nothing disappears silently.
  • Ordering and versioning: include a timestamp or version number so an older update never overwrites a newer one.
  • Monitoring and alerts: count messages, errors and delays, and alert when the queue grows.
Python Queue with retries and a dead-letter queue

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice the difference: a temporary error is worth retrying; a permanent data error is not, and goes to people for correction.

Mapping between data models

Integration also translates. The CRM sends an account with a nested list of contacts; the ERP expects one business partner with separate address and contact rows. Write the mapping as an explicit transformation, test it with real samples, and keep a cross-reference table of IDs (CRM account ID to ERP customer number) as discussed in master data management.

Python Transform a CRM account to an ERP partner

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Security and governance

Use least privilege for integration accounts (a dedicated technical user with only the rights it needs), protect credentials in a secret store, encrypt traffic (TLS), log every message with a correlation ID, and document each interface: owner, direction, trigger, volume, mapping, error handling and contact person. Test interfaces with error cases, not just the happy path (see testing, cutover and go-live).

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Why does a hub or middleware reduce complexity compared with point-to-point links?

    With n systems the hub needs about n connections, while point-to-point can need n(n-1)/2.
  2. 2. What does idempotency mean for an integration?

    Idempotent receivers can safely accept retries without creating duplicates.
  3. 3. What is a dead-letter queue for?

    Failed messages are parked rather than lost, and can be corrected and replayed.
  4. 4. Which is a better trigger for a CRM to learn about a changed order in the ERP without polling?

    Webhooks and events push the change when it happens, avoiding constant polling.
  5. 5. Which error deserves a retry?

    Temporary errors may succeed later; data errors will keep failing until someone fixes the data.

Summary

  • Integration connects ERP, CRM and other systems; plan topology, timing and ownership.
  • Hubs and event buses scale better than many point-to-point links.
  • REST APIs, webhooks and batch files are the common technical tools.
  • Build in idempotency, retries with backoff, queues, dead-letter handling and monitoring.
  • Map data models explicitly, secure the interfaces and document each one.

Next: Data Quality Monitoring