Retrieve documents periodically in bulk via batch hooks: period, maxBatchSize and ZIP archive.
By default the PSB sends a webhook notification immediately for every received document. At high volumes it can be more efficient to process documents periodically in bulk. With a batch hook the PSB collects all events during a configurable period and packages them into a ZIP archive.
A batch hook listens on a topic (for example InvoiceReceived) and collects all events that come in during a given period. After the period ends, the PSB creates a ZIP file containing all the documents associated with those events. The PSB then publishes a new topic ({Topic}Batched) so you can download the archive.
The flow is as follows:
{Topic}Batched event is published (for example InvoiceReceivedBatched)Register a hook via the API with a batch://zip action:
{
"action": "batch://zip?period=00:15:00&maxBatchSize=100",
"topics": ["InvoiceReceived"]
}
period00:15:00 (15 minutes)hh:mm:ss. After this period the batch is closed and the ZIP archive is created.maxBatchSize100Tip: choose the
periodandmaxBatchSizebased on your document volume. At low volumes you can set a longer period (for example one hour). At high volumes a shorter period with a highermaxBatchSizeis more practical.
After closing a batch the PSB publishes a new event on the topic {Topic}Batched. The naming follows a fixed pattern:
InvoiceReceivedInvoiceReceivedBatchedOrderReceivedOrderReceivedBatchedSet up a regular webhook on the batched topic to retrieve the ZIP archive:
{
"action": "https://jouw-endpoint.nl/batches",
"topics": ["InvoiceReceivedBatched"],
"secret": "jouw-geheime-sleutel"
}
The ZIP file contains all documents collected in the batch, each as a separate XML file. The file names are based on the documentId. The archive can be downloaded via the URL provided in the batched event.
You can combine batch hooks with regular webhooks. For example, use a regular webhook for immediate processing of urgent documents and a batch hook for periodic bulk import into your ERP system. Make sure you do not process documents twice if you have both hooks on the same topic.
Note: batch hooks use the same retry logic as regular webhooks. If the batched event is not delivered successfully, the PSB retries for up to 5 days.
After the collection period ends, the PSB publishes an event on {Topic}Batched, for example InvoiceReceivedBatched when the source topic is InvoiceReceived. Register a regular webhook on that batched topic to receive the download URL and retrieve the ZIP file.
period (default 15 minutes) sets how long events are collected before the batch is closed; maxBatchSize (default 100) closes the batch earlier if that limit is reached first. Tune both to your volume: longer periods when you have few documents, shorter periods or higher limits at peak traffic.
Yes, but watch for duplicate processing: if both use the same source topic, the same document may arrive twice. Only use both if you handle that explicitly, for example immediate delivery for urgent cases and batch for bulk import.
See the full API specification at psb.econnect.eu for all configuration options.
View the API documentation