This expert Arena brief asks builders to track container returns and charge late demurrage with Make.com for a logistics firm in Apapa. Release and return events are captured from several sources, duplicates are ignored, chargeable days are counted the same way every time, and invoices, reminders and exception reports are produced without anyone chasing drivers on the phone.
The business behind the brief
The brief describes ApapaFreight Logistics, an Arena scenario: a firm moving 120 to 180 import containers a week in busy months. After port clearance, containers go out with truckers and must come back to the depot within a free period, usually 3 to 7 days. Late returns are charged demurrage for every calendar day.
Tracking is manual. Drivers phone in, return dates go into Excel, and billing is prepared weekly. The brief counts the cost: 25 to 40 minutes of follow-up per late container, 30 to 50 staff hours a week, and demurrage under-billed by an estimated 12 to 18 percent of what the firm is owed. Disputes over chargeable days and missing timestamps delay invoices by up to two weeks, and finance cannot trust the spreadsheet when payments come in.
What the automation has to do
- Capture release and return events from webhooks and a polling port API, storing every raw event.
- Compute a stable
container_hashso replayed events are recognised and ignored. - Pair releases with returns, count chargeable days against each client's free days and rate, and calculate demurrage.
- Create invoices, a payment file for accounts, and WhatsApp and email notices to clients.
- Record exceptions such as missing returns or impossible timestamps, retry transient failures, and escalate persistent ones to operations.
How to approach the build
- Store raw first, parse second. Every incoming event is written to
containers_rawexactly as received, before any logic runs. If parsing is wrong, you can fix it and reprocess from the raw table instead of asking the port to resend. - Hash for replays. Build the hash from the container number, event type and event time, normalised. If that hash already exists, log a duplicate and stop. Ports and partners resend events more often than anyone expects.
- Route by event type. A
Routersends releases and returns down different paths with filters. A release opens a parsed record; a return closes it and triggers the calculation. - Calculate demurrage deterministically. Count chargeable days with one written rule, subtract the free days, never go below zero, and multiply by the client's daily rate. Store the inputs alongside the result, so any invoice line can be recalculated by hand.
- Produce the money documents. Generate the invoice, save it to Google Drive, write the invoice row in Supabase, and add a line to the payment CSV accounts will import. Then notify the client.
- Handle errors with directives. Attach error handlers to the modules that call outside services. Make's
Breakdirective can store the failed run and retry it automatically when incomplete executions are enabled. Persistent failures go tocontainer_exceptionsand the operations sheet.
The hard parts
What counts as a day
This is where demurrage disputes come from. Take a container released on 2 November and returned on 11 November, with 7 free days. The dates are 9 days apart, so 2 days are chargeable. Count both the release day and the return day, and it becomes 10 days, so 3 are chargeable. Both rules exist in the industry. Pick the one in the client's contract, use Lagos time for every date, write it in the runbook, and use it everywhere. Most of the 12 to 18 percent under-billing in the brief comes from inconsistent counting and missing timestamps.
Events that do not make sense
A return before its release, a return with no release, two returns for one container: real data contains all of these. Do not let them silently produce an invoice. Each becomes a typed exception (missing_return, inconsistent_timestamps, duplicate) with enough detail for operations to fix it in minutes.
Money and privacy
The brief says not to store full bank details, only the last four digits for reference. Payments are made by accounts staff importing the generated file, not by the scenario. Keeping the automation away from moving money is a deliberate safety choice.
What our graders look for
- Scenario architecture and triggers (30%): clear scenarios, including the separate error handler.
- Deterministic handling, canonicalisation and deduplication (30%): the same events always produce the same result.
- Financial artefacts (20%): invoice, invoice record and payment CSV that agree with each other.
- Error handling, retry and escalation (10%).
- Auditability and run reporting (10%): audit logs, run summaries, the exceptions sheet and a runbook.
Pricing and pitching this job
The brief values this at $800 to $2,000 for setup plus a monthly retainer. The pitch is recovered revenue. If demurrage is under-billed by 12 to 18 percent, the system pays for itself as soon as it bills what was being missed. Add faster invoices and fewer disputes, because every charge comes with its timestamps, and the retainer is an easy decision.
New Arena briefs drop every Monday in the app at app.automatenaija.com, and every Beginner brief is free, so pick one and build it this week.
Frequently asked questions
How is container demurrage calculated?
Count the chargeable days between release and return, subtract the free days in the contract, and multiply what is left by the daily rate. If the result is negative, the charge is zero. The detail that causes disputes is how days are counted, so the rule must match the contract and be applied the same way every time.
Why store raw events before processing them?
Raw events are your evidence and your safety net. If a parsing rule turns out to be wrong, you can correct it and reprocess everything from the stored events, instead of asking partners to resend data. They also settle disputes, because you can show exactly what was received and when.
How do retries work in Make.com?
You attach an error handler to a module. The Break directive, with incomplete executions allowed in the scenario settings, stores the failed run and can retry it automatically a set number of times with a delay between attempts. For failures that keep happening, record an exception and alert a person instead of retrying forever.
Can this connect to Nigerian port systems?
It depends on what data the port, terminal or shipping line makes available. Some provide APIs, others send emails or files. The brief uses webhooks and a polling API, but the same design works with emailed reports or CSV files, as long as every event is stored raw and deduplicated before it is used.
Build it with us. The community is free and the build track teaches this kind of automation week by week: see pricing or join the community.
Loading comments...