DEV Community

Cover image for How to connect two business applications (API, webhook, scheduled file or shared database)
Fabien Kost
Fabien Kost

Posted on Originally published at closiqode.com

How to connect two business applications (API, webhook, scheduled file or shared database)

Adapted from an article originally published in French on closiqode.com.

Integrating two applications means making them talk so that data entered in one flows into the other automatically, with no retyping. It rests on four techniques: the API, the webhook, the file exchanged on a schedule, and the intermediate database. The right choice depends on what each application can do, how often data needs to move and how reliable the link must be.

The need almost always starts with retyping. A quote is accepted in the sales tool, then someone copies the order into invoicing. Contacts arrive through a form, then someone re-enters them in the CRM. Each application does its job well; the problem sits between them.

What an integration actually is

An integration is an exchange contract between two programs. It defines which data moves, in which format, when and in which direction. Both applications keep running on their own; the integration only carries information from one to the other.

France Num, the French public service dedicated to digital tools for small businesses, makes this point about ERPs: if you keep an accounting package that suits you, make sure both tools can communicate through APIs, connectors and web services.

Before any technique, three questions define an integration:

  • What? The exact list of fields: customer, amount, reference, date, status.
  • When? Immediately, every hour or once a day.
  • Who is the source of truth? For each field, the application that wins when the two disagree.

The third question is the one most often forgotten. Without a source of truth, two applications synchronized in both directions end up overwriting each other.

Four ways to connect two applications

Four cream paper connectors on a dark studio table, a key, a small bell, a folded envelope and a shared paper tray, linked by thin threads, one thread glowing orange amber: four ways to pass information between two systems

Each technique fits a different situation. One company often combines several, depending on the software involved.

The API: ask or send on demand. An API is an entry point the vendor provides so that other programs can read or write data, following rules published in documentation. Your integration sends a request ("create this invoice", "give me today's orders") and the application answers. It is the cleanest method when it exists, because the vendor commits to how it works.

The webhook: get notified when something happens. With an API alone, your integration has to keep asking whether anything changed. A webhook reverses the direction: the source application calls a URL you provide as soon as an event happens, such as a payment received or a form submitted. The information arrives within seconds, with no wasted polling.

A webhook receiver should at least verify the sender, tolerate retries and avoid doing heavy work inline. As an example, in Flask (header names and signature formats vary from one vendor to another, so follow their documentation):

import hashlib
import hmac

from flask import Flask, abort, request

app = Flask(__name__)
SECRET = b"shared-secret-from-the-vendor"

@app.post("/webhooks/payment")
def payment_webhook():
    received = request.headers.get("X-Signature", "")
    expected = hmac.new(SECRET, request.get_data(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(received, expected):
        abort(401)
    event = request.get_json()
    if already_processed(event["id"]):  # the sender may deliver twice
        return "", 200
    enqueue(event)  # process asynchronously, log every step
    return "", 202
Enter fullscreen mode Exit fullscreen mode

The scheduled file: an export dropped at a fixed time. The source application produces a file, often a CSV, on a schedule. A program picks it up, checks its content and imports it into the other application. It is slower, but it works with a lot of older software and is easy to audit: the file itself records what was sent.

The intermediate database: a shared synchronization space. When several applications must share the same information, you can place a dedicated database between them. Each one writes its data there and reads the others', with clear rules about the source of truth. It takes more work up front, but it avoids multiplying point-to-point links.

Technique Timing When to use it Weak spot
API On demand The application publishes a documented API Rate limits, version changes
Webhook On the event You must react fast to a payment, order or form A lost message must be replayable
Scheduled file Fixed time Older software, large volumes, non-urgent need Time lag, file format that changes
Intermediate database Continuous or scheduled Three or more applications share the same data Heavier design, priority rules to define

The application has no API: now what?

An application without an API is not necessarily impossible to connect. First check that it really has none, then pick the most reliable option left.

  • Ask the vendor. The API is sometimes reserved for a higher subscription tier, or documented on a separate developer site.
  • Use exports and imports. If the export can be scheduled, the scheduled file becomes a solid integration.
  • Use automatic emails. An application that sends a notification for every order is already transmitting data. A program can parse those messages, as long as their format is stable.
  • Read the database, carefully. For software installed on your own servers, reading its database directly is sometimes possible: read only, with the vendor's agreement, because an update can change the schema without warning.
  • Simulate a user, as a last resort. A robot can fill in the screens in place of a person. It is the most fragile option: the slightest screen change stops it.

Ready-made connector or custom integration?

A ready-made connector is enough when both applications are common and the exchange follows a simple rule. It comes from the vendor itself or from an automation platform such as Make, Zapier or n8n, and it is quick to set up for exchanges like "when a contact is created here, create it there".

A custom integration is a small program written for your case. It is justified when data must be transformed between the two applications, checks applied, exceptions handled, a business application with no connector reached, or when no exchange may ever be lost.

What breaks an integration, and how to monitor it

A cream paper thread stretched between two dark blocks, frayed at one point where a small orange amber light marks the break: an integration failing at a precise spot

An integration almost never breaks on launch day. It breaks months later, when one of the two applications changes:

  • A new API version. The vendor changes or removes a function, often with notice that someone has to watch.
  • Rate limits. Most APIs cap requests per minute or per day. A spike in activity can get exchanges rejected.
  • A changed format. A renamed field or an extra export column, and the import fails or puts data in the wrong place.
  • Expired access. A changed password or an expired authorization cuts the link.
  • Silent errors. The most expensive case: the exchange fails, nobody is told, and the gap is discovered by the customer.

The CNIL, in its technical recommendation on data sharing through APIs published on 7 July 2023, asks that API documentation state its limits, in particular the maximum volume and frequency of requests. It also recommends a twin version of the API fed with fictitious data, to test without risk.

On the monitoring side, a reliable integration logs every exchange, alerts a named person on any error, retries failed sends automatically and regularly compares both applications to spot gaps. Without these guardrails, the integration moves the risk of error instead of removing it.

Questions to ask the vendor first

  • Does the application have an API, and which subscription tier includes it?
  • Is the documentation public and up to date?
  • What are the rate limits, and what happens when they are exceeded?
  • Are there webhooks for the events you care about?
  • Is there a test environment, separate from your real data?
  • How are version changes announced, and with how much notice?
  • Where is the data hosted, and how is API access secured?

Vague answers are not necessarily a deal breaker. They tell you to plan for more monitoring, or for a fallback such as the scheduled file.

FAQ

Do you need the vendor's agreement to integrate their software?
If the vendor publishes an API, its use is governed by its terms: permitted uses, limits, possible cost. Without an API, French intellectual property law (article L122-6-1) allows, under strict conditions, obtaining the information needed for interoperability. That legal ground is checked case by case with counsel.

Is data protected during the exchange?
It must be: encrypted exchanges, access limited to the data needed, access logs. The CNIL observes that APIs generally offer a higher level of security than sending files by email or through sharing platforms.

The problem sits between the applications

Pick the most reliable link, not the most impressive one, and make sure someone hears about it the day it fails.


I am Fabien Kost, an independent developer in France (ClosiQode). I build integrations and business process automations that start from how the team actually works, with logs and alerts from day one. More on how I approach process automation (in French).

Sources (in French): CNIL, technical recommendation on data sharing through APIs and full text, PDF; France Num, setting up an ERP; Légifrance, article L122-6-1 of the Intellectual Property Code.

Top comments (0)