01 / 07 Integration guide

What to settle before connecting two systems with an API

Most integrations work on the first day. They break later: when the other system is slow, sends the same message twice or changes a field without warning. The decisions that prevent that are made before any code is written, and they fit on one page.

Written by Iavor Kolev, software architect and product builder

128

checks on Webwify's contact function, which reports success only after the mail provider accepts the message

4

ways an integration fails: slow, down, duplicated or changed

5

questions to answer before connecting two systems

02 / 07 Principle

An integration is a contract, not a connection

The first successful request proves very little. An integration is finished when you know what it does on its worst day.

Iavor Kolev

Connecting two systems usually starts with the happy path: call the endpoint, get the data, show it. That part is rarely the problem. The problems come later, when the other side is slow, returns an error, sends the same webhook twice or renames a field without warning, and nobody decided in advance what should happen.

Writing the contract down first turns those surprises into ordinary cases. Which system owns each piece of data, who calls whom, how both sides prove who they are and what the limits are: once that is settled, the code is the easy part, and the integration can be tested before it ever touches the real service.

03 / 07 Contract

Settle four things before writing any code

Each one is a decision someone will make anyway. Making it on purpose is cheaper than discovering it in production.

01 / Ownership

Which system holds the truth

For every shared field, name the one system whose value wins: stock in the warehouse, prices in the store, the customer's address in the CRM. Two owners of one field means two answers.

02 / Direction

Who calls whom

You can ask the other system on a schedule (polling), it can notify you when something changes (webhooks), or both. Webhooks are faster; polling is the safety net for the ones that never arrive.

03 / Identity

How each side proves who it is

API keys, OAuth tokens or signed webhooks. Decide where the credentials live and who can rotate them. AutoSocial stores provider tokens sealed, never as plain text.

04 / Limits

What the other side allows

Rate limits, quotas, payload sizes and timeouts are part of the contract. Read them before designing the sync, not after the first blocked request.

04 / 07 Failure

Design for the four ways an integration fails

Every integration meets all four eventually. The question is whether the answer was written down or improvised.

  • Slow

    The other side takes ten seconds instead of one

    Set a timeout on every call, and move slow work into a background job so a customer is never left waiting on a third-party service.

  • Down

    The other side is unavailable

    Queue the work and retry with growing pauses instead of giving up or hammering the service. AutoSocial's publishing jobs are claimed, attempted, retried and recorded, with PostgreSQL tests for retries and concurrent changes.

  • Duplicated

    The same request arrives twice

    Webhooks are delivered at least once, and retries resend requests. Give each operation an idempotency key so the second copy changes nothing: one payment, one order, one email.

  • Changed

    The other side changes without notice

    A renamed field or a new format should stop the sync loudly, not save half-empty records. Early extraction work on Scraper showed that partial data is worse than no data.

If nobody can say what happens when the other system is down for an hour, the integration is not finished.

05 / 07 Operate

What keeps it trustworthy after launch

An integration runs unattended. These habits are what make it safe to leave alone.

Honest success

Report success only when it is true

Webwify's contact function says a message was sent only after the mail provider accepts it. A green tick that means "we tried" hides every failure.

Fail closed

Refuse when configuration is missing

If a key or an address is missing, the same function refuses to run instead of pretending. A loud failure at deploy time beats silent data loss.

Clean logs

Keep secrets and personal data out

Logs are read by more people and kept longer than the data itself. Webwify's contact function keeps form contents out of its logs.

Test with a fake

Run the whole flow without the real service

AutoSocial runs every screen against a deterministic fixture backend, so the integrations' behaviour is tested without touching the live networks.

07 / 07 Next step

Answer these five questions before connecting two systems

If any answer is "we will see", settle it first. Each one is cheaper to decide on paper than to fix after customers depend on the data.

Five questions

  1. For every shared field, which system owns the correct value?
  2. Does the other system notify you, do you ask it on a schedule, or both, and what are its limits?
  3. If the same request or webhook arrives twice, does anything happen twice?
  4. When the other side is slow or down, what waits, what retries and who is told?
  5. Where are the credentials stored, and can the logs ever show them or customer data?