How to Connect Business Apps: APIs, Webhooks, iPaaS, Files

Your CRM, invoicing tool, and inbox each hold a piece of the same customer, and right now you're the integration layer, copying data between tabs. Before you pick a tool, you need to pick a pattern, because the wrong one means either a fragile setup that silently drops data or an over-engineered one you can't maintain.
This guide covers the four options you'll actually choose between: direct API calls, webhooks, middleware (iPaaS), and file-based transfers. For each, you'll get when it fits, how it fails, and what to build around it.
The short answer: match the pattern to the timing requirement
Pick by how fresh the data needs to be and who initiates the transfer. Need data the moment something happens? Use webhooks. Need to fetch or change something on demand? Call an API. Connecting many apps without writing code? Use middleware. Moving bulk data on a schedule where hours of delay are fine? Use files.
| Approach | Who initiates | Freshness | Best for | Typical failure |
|---|---|---|---|---|
| API call | You (pull/push on demand) | As fresh as your last call | Lookups, writes, actions | Rate limits (429), auth expiry |
| Webhook | The source system | Near real-time | Event reactions (payment, new lead) | Dropped or duplicated deliveries |
| Middleware / iPaaS | The platform | Depends on triggers used | Many apps, low-code teams | Mapping drift, per-task costs |
| File transfer (SFTP/CSV) | A schedule | Hours to a day | Bulk exports, legacy systems | Stale data, malformed files |
Most real workflows combine two or three of these. The rest of this post explains how to decide, and how to make each one fail safely.
APIs: the foundation everything else sits on
An API is how one system lets another read or change its data on request. You call it when you need something. That's the mental model that separates it from a webhook: with an API, you ask; with a webhook, they tell you.
Direct API integration makes sense when:
- You need to look something up mid-workflow (fetch the customer record before drafting a reply).
- You're writing data on a trigger you control (create an invoice when a deal moves to "won").
- You want exact control over retries, validation, and error handling.
The cost is that you own the plumbing: authentication, pagination, and rate limits. Rate limits are the one that bites first. When you exceed them, well-behaved APIs return HTTP 429 Too Many Requests, and per MDN the server may include a Retry-After header telling you how long to wait (MDN: 429 Too Many Requests). GitHub's REST API docs say the same: exceeding a limit returns a 403 or 429, and if a retry-after header is present you should wait that many seconds before retrying (GitHub Docs). The 429 status itself is defined in RFC 6585.
Here's a minimal client that respects that header instead of hammering the server:
import time
import requests
def call_api(method, url, max_retries=5, **kwargs):
for attempt in range(max_retries):
resp = requests.request(method, url, timeout=15, **kwargs)
if resp.status_code == 429:
# Honor the server's instruction if it gives one,
# otherwise back off exponentially.
retry_after = resp.headers.get("Retry-After")
wait = int(retry_after) if retry_after and retry_after.isdigit() \
else 2 ** attempt
time.sleep(wait)
continue
resp.raise_for_status()
return resp.json()
raise RuntimeError(f"Gave up after {max_retries} attempts: {url}")
Two details worth copying. First, Retry-After can be a number of seconds or an HTTP date; the sketch above handles only the numeric form and falls back to exponential backoff otherwise, so extend it if your vendor sends dates. Second, cap your retries and fail loudly. An infinite retry loop against a rate-limited API turns a small problem into an outage.
Webhooks: let the source system tell you
A webhook isn't a separate technology from an API. It's an HTTP request, usually carrying JSON, that one system's API layer sends to an endpoint on another system (wpwebhooks.org). The difference is direction: instead of you asking "anything new?" on a loop, the source POSTs to your URL when something happens. Hookdeck puts the complementarity well: you call an API when you need something, a webhook calls you when something happens, and most integrations use both (Hookdeck).
Use webhooks when:
- A reaction should happen within seconds (payment succeeded, form submitted, ticket created).
- Polling would mostly return "nothing changed."
- The source system supports them and you can expose a public HTTPS endpoint.
What a safe webhook receiver needs
Webhook delivery is not guaranteed to be exactly-once or in order. Build for that from day one:
- Verify the signature. Anyone who finds your URL can POST to it. Stripe, for example, signs every webhook event and puts the signature in the
Stripe-Signatureheader; receivers should verify it with the official libraries (Stripe docs). - Acknowledge fast, process later. Return a 2xx quickly, then do the real work from a queue.
- Deduplicate. Providers retry, so you'll see the same event twice. Store event IDs and skip repeats.
- Expect retries to end. Every provider eventually gives up.
Retry windows vary a lot by provider and are product-specific. Zapier's White Label connection-webhooks docs say retryable delivery failures are retried a few times with increasing backoff over roughly 25 minutes, after which the event is dropped and not redelivered (Zapier docs). That describes that specific product, not all of Zapier. A third-party review summarizes Stripe's live-mode behavior as retries with exponential backoff for up to three days, versus three attempts over a few hours in test mode (Svix review). Check each vendor's current docs for the exact policy before you rely on it.
A receiver skeleton in Python (Flask), showing the shape rather than a drop-in:
from flask import Flask, request, abort
import json
app = Flask(__name__)
seen_event_ids = set() # use a database or Redis in production
@app.post("/webhooks/payments")
def payments_webhook():
payload = request.get_data()
signature = request.headers.get("X-Signature", "")
if not verify_signature(payload, signature): # provider's library
abort(400)
event = json.loads(payload)
if event["id"] in seen_event_ids: # dedupe retries
return "", 200
seen_event_ids.add(event["id"])
enqueue_for_processing(event) # do real work async
return "", 200
Webhooks plus polling: the reconciliation pattern
Webhooks get dropped. Your server is down during a deploy, the provider's retries run out, a firewall rule changes. Many mature integrations treat webhooks as the real-time channel and add a polling job as a reconciliation fallback for missed events (InstaWebhook). Polling is also the fallback when you can't receive inbound requests at all, or when the source offers no webhooks (Hookdeck).
In practice that means: webhooks handle the live path, and a nightly job asks the API "what changed since my last successful sync?" and fills any gaps. It costs one scheduled script and saves you from the "why is this one customer missing" support ticket.
Middleware and iPaaS: when you don't want to own the plumbing
IBM defines middleware as software that simplifies connectivity between applications, components, and data sources, and lists iPaaS (integration platform as a service) as a cloud-based form of integration middleware (IBM). An iPaaS sits between your apps, lets them share data and trigger actions, and typically offers prebuilt connectors and low-code tools (Celigo).
Under the hood, an iPaaS is mostly the same three things above: it receives webhooks, makes API calls, and manages retries and credentials for you. You're paying to not write that glue.
It fits when:
- You're connecting several SaaS tools and there's a prebuilt connector for each.
- The people maintaining the workflow aren't developers.
- Speed to a working version matters more than fine-grained control.
Be realistic about the trade-offs. Vendor claims of large savings in integration time or cost should be treated with caution until independent measurements confirm them. And every connection is a field mapping that someone has to maintain: when a vendor renames a field or changes a schema, the mapping breaks quietly. Also check limits on the platform itself. For example, Zapier's help center documents that Webhooks by Zapier return a 429 above a per-user request threshold within a five-minute window, with a lower limit on legacy routes (Zapier rate limits). Zapier's own pages disagree on the exact number, so check the current figure before sizing a high-volume workflow around it. Whatever platform you use (Make, n8n, Power Automate, or another), read its documentation and test its failure behavior yourself rather than assuming.
A useful rule: start in an iPaaS to validate that the workflow is worth automating, and move the high-volume or business-critical paths to code once the shape is stable.
File-based transfers: unglamorous, still everywhere
Not every system has an API. Accounting packages, older ERPs, banks, and suppliers often exchange CSV or XML files over SFTP. File transfer fits integrations built around files, scheduled transfers, and bulk exports, especially where systems already produce and consume data as files (SFTP To Go).
The defining limit is freshness. SFTP transfers are batch-only: data moves on a schedule, so it's only as current as the last completed transfer (Integrate.io). The practical test: if the process is predictable, batch-oriented, and can tolerate a delay of hours or a day, a scheduled file transfer may be enough; if you need near-real-time, like e-commerce orders flowing to a warehouse, that points to an API (Opal Creek).
A common hybrid is to load bulk or historical data through files, then keep ongoing changes in sync through the API (Apideck). That's a good fit for an initial migration: dump 5 years of invoices as a CSV, then switch to event-driven updates.
If you take the file route, add these checks:
# Validate before you import: row count, header, and no empty file
EXPECTED_HEADER="invoice_id,customer_id,amount,currency,date"
FILE="invoices_latest.csv"
[ -s "$FILE" ] || { echo "empty file"; exit 1; }
head -n 1 "$FILE" | grep -qx "$EXPECTED_HEADER" || { echo "header changed"; exit 1; }
echo "rows: $(($(wc -l < "$FILE") - 1))"
Most file-integration failures aren't transfer failures; they're a header that changed, an empty file that "succeeded," or a date format that flipped. Validate before importing, and alert on anything unexpected rather than silently loading it.
How to choose: a decision flow you can actually use
Walk through these questions in order:
- Does the source system offer webhooks, and does a delay of seconds matter? If yes, use webhooks for the live path.
- Do you need to look up or change data on demand? Use the API directly.
- Is the system file-only, or is the data bulk and delay-tolerant? Use scheduled file transfer.
- Are you wiring several SaaS tools and no one on the team writes code? Start with an iPaaS.
- Is the workflow business-critical? Add a reconciliation poll regardless of which path you chose.
A worked example, with round illustrative numbers: a 5-person agency wants new Stripe payments to create invoices in their accounting tool and notify the project manager. The live path is a Stripe webhook (signed, deduplicated, queued). A nightly API job lists the day's payments and creates anything missing. If the accounting tool only accepts CSV imports, the last hop becomes a scheduled file drop. Three patterns, one workflow, each used where it's strongest.
Failure behavior is the real selection criterion
Features are easy to compare; failures are what cost you money. For every integration, answer before launch:
- What happens when the destination is down for an hour?
- What happens when the same event arrives twice?
- What happens when it never arrives?
- Who gets alerted, and how?
If your answer to the last one is "nobody," you don't have an integration yet, you have a hope.
Where this fits in practice
I'm a senior engineer who builds AI automations that ship, and the patterns above are the building blocks. The unglamorous parts, signature checks, deduplication, retry limits, a reconciliation job, and an alert when something is stuck, are what make an automation safe to leave running unattended.
Work with BizFlowAI
If you'd rather have this built for you, that's what we do: production AI automation for solo founders and small teams — agents, integrations, and document pipelines that actually ship.
Request a free discovery call — 30 minutes, we map the highest-ROI automation in your workflow. No pitch deck, just engineering.
More guides like this on the BizFlowAI blog.
Frequently asked questions
What is the difference between an API and a webhook?
With an API, your system asks another system for data or sends it a command on demand. With a webhook, the source system sends an HTTP request to your URL automatically when an event happens, such as a payment succeeding. A webhook is not a separate technology, since it is an API-layer HTTP call, usually carrying JSON, but the direction is reversed. Most integrations use both: webhooks for real-time events and API calls for lookups and writes.
When should I use webhooks instead of polling an API?
Use webhooks when something should happen within seconds of an event and polling would mostly return no changes. They require the source system to support them and you to expose a public HTTPS endpoint. Use polling when you cannot receive inbound requests or the source offers no webhooks. Many mature setups combine both, using webhooks for the live path and a scheduled poll to catch missed events.
How do I handle API rate limits and HTTP 429 errors?
When you exceed a rate limit, well-behaved APIs return HTTP 429 Too Many Requests, and the response may include a Retry-After header telling you how many seconds to wait. Your client should honor that header and fall back to exponential backoff when it is missing. Always cap the number of retries and fail loudly, because an infinite retry loop against a rate-limited API can turn a small problem into an outage.
How do I build a reliable webhook receiver?
Verify the signature on every request so only the real provider can trigger your endpoint, and return a 2xx response quickly while doing the actual work from a queue. Deduplicate by storing event IDs, because providers retry and you will receive the same event more than once. Expect retries to end eventually, since every provider gives up after some window. Add a scheduled reconciliation job that asks the API what changed since the last successful sync.
When should I use an iPaaS like Zapier or Make instead of writing API code?
Use an iPaaS when you are connecting several SaaS tools that already have prebuilt connectors, when the people maintaining the workflow are not developers, and when speed to a working version matters most. Under the hood, an iPaaS receives webhooks, makes API calls, and manages retries and credentials for you, so you pay to avoid writing that glue code. Watch for mapping drift and per-task costs as workflows grow. Write direct API code instead when you need exact control over retries, validation, and error handling.