Skip to main content

Synchronizing subscribers from Iteras via API

Updated this week

If you want to synchronize subscribers from Iteras via the API, there’s a specific strategy that requires minimal effort while still ensuring high-quality, robust synchronization. This approach helps avoid constant manual handling of data discrepancies.

Setting up a webhook for continuous synchronization

The first step is to set up a web server that can receive data over HTTPS via a webhook.

If you’re already familiar with web technology, this is very straightforward. When a change occurs on a subscriber in Iteras, Iteras will send a POST request with a small payload containing information about the change to the URL you've configured.

You register the webhook URL within Iteras under Integrations. A few settings can be configured — for example, specifying which events you want to receive. You can also choose to include the updated data for the changed subscribers. This data is in exactly the same format as if you retrieved subscriber data via the API.

Handling the received data

The next step is to write a bit of code that takes a list of subscriber data and uses it to update your local database.

It’s generally more efficient to handle a full list at once, as processing subscribers one by one often results in performance issues due to waiting times for each individual operation.

Once this function is in place, you can feed the updated subscriber data received from the webhook directly into it — and your synchronization is essentially complete. If your web server goes down briefly or experiences network issues, Iteras will automatically resume synchronization after some time.

The only thing left is to populate your local database with the existing subscribers.

Full synchronization via the API

To do this, write a bit of code that requests all subscribers from the API using pagination. For each page of subscribers, call the function you wrote earlier to process a list of subscribers.

Once that’s ready, run it once to initialize your local database — and you're set up for production use.

If something breaks later, or if you decide to sync additional fields, you can always re-run the full synchronization.

You Need to Respond Quickly

One thing to be aware of: Iteras expects a webhook response within a short timeframe. The exact timeout duration can be configured in the webhook settings in Iteras.

There should be sufficient time to update a local database, but if you need to call a third-party service that is slow or unreliable, there’s a risk that Iteras will time out and resend the webhook.

To avoid this, any further processing based on the data should be queued locally and handled by a separate background job. This ensures a fast response to Iteras.

Example – Sending an Email

If, for instance, you want to send a customized welcome email to new subscribers after storing their data, don’t send the email while handling the webhook.

Instead, flag the subscriber for email delivery, respond immediately to the webhook, and run a separate process to send the email afterward.

This approach also makes it easier to test your code and prevents scenarios where a failed webhook causes the same email to be sent multiple times.

Did this answer your question?