Reliable IoT Callbacks: Durable Acceptance and Duplicate Handling
Receiving an HTTP request is not the same as safely accepting an observation. A callback receiver needs a clear point at which responsibility transfers from the sender to your application. It also needs to survive a repeated delivery without repeating the operational action.

This guide designs a small ingestion boundary for sensor callbacks. Its identifiers and counts are illustrative. It does not claim a specific platform provides exactly-once delivery, and the design must be adapted to the authentication and fields available in the actual integration.
Acknowledge durable acceptance
Sigfox’s callback integration documentation specifies a response within ten seconds and recommends asynchronous handling. It also describes retries after a timeout or error and explicitly recommends considering deduplication. Treat those statements as integration constraints to verify against the configuration you deploy, rather than permission to perform a long business workflow inside the request.
A useful receiver does a bounded amount of work: authenticate the request using the configured mechanism, enforce size and format limits, preserve an accepted envelope durably, then return the appropriate response. Decoding, aggregation and notification can happen after that boundary. The important question is whether a successful response corresponds to data that will survive the failures your service is designed to tolerate.
Putting an object in a process-local list and returning success is not durable acceptance. If the process exits before a worker reads the list, the sender may believe the observation was accepted while the only copy has disappeared. Choose storage and transaction behavior deliberately; the word “queue” alone does not establish persistence.
Define the observation’s identity
The HTTP specification distinguishes idempotent request semantics from simply repeating a request. A POST-based integration does not gain duplicate-safe business behavior automatically. Your application must define which repeated inputs represent the same observation and which are genuinely new.
| Field | Useful role | Limitation to resolve |
|---|---|---|
| Device identity | Separates observations from different devices | Do not substitute a reusable asset label without preserving device history |
| Application observation number | Distinguishes samples within its defined scope | Counter wrap and restart can reuse values |
| Boot or session identity | Separates counter sequences across restarts | Only use it if the device and interface actually provide it |
| Payload digest | Detects different content under the same claimed identity | Identical measured values can belong to different observations |
For a teaching system, suppose the contract supplies device, boot session and observation number. Their combination can form an observation key within the stated contract. These fields are not promised to exist in every Sigfox payload. If your interface lacks them, define a different documented policy and state what ambiguity remains. The payload workshop shows why a small counter needs explicit rules.
Make duplicate handling atomic
Two workers can receive the same observation at nearly the same time. A separate “does this key exist?” query followed by an insert is vulnerable to a race: both workers can see absence before either inserts. Use a uniqueness constraint and a transactional operation appropriate to your database or queue.
On a duplicate key, compare the identity contract and relevant content. A matching replay can reuse the original acceptance outcome. A conflicting payload under the same claimed identity should become a visible exception, not silently replace the earlier record. Preserve diagnostic details under the service’s access and retention policy.
Suppose a constructed run contains 100 distinct observations and 12 repeated deliveries. The receiver handles 112 requests but stores 100 canonical observations. If seven observations satisfy a business alert rule, the expected outcome is seven distinct alert tasks, with no additional tasks caused by repeated callbacks. The task store needs its own duplicate-safe boundary as well.
Test the ambiguous moments
| Failure point | Required behavior in this design | Evidence to inspect |
|---|---|---|
| Before durable storage | Do not report successful acceptance | No accepted record and an appropriate failure response |
| After commit, before response reaches sender | A replay finds the original observation | One canonical record after both requests |
| Worker exits after creating an alert task | Restart does not create a second task for the same rule event | Stable task identity and recorded processing state |
| Unknown schema version arrives | Preserve an explicitly quarantined record or reject according to policy | Visible reason; no plausible substitute measurement |
There is no universal status code for every application validation failure. Agree how permanent invalid input differs from a temporary inability to store data. If accepted records can enter quarantine, make that acceptance contract explicit: success means the envelope is safely retained, not that its measurement has been approved.
Separate stored events from external effects
A database commit and an external email or work-order call are separate operations. If the process fails between them, a retry can lose or repeat the effect unless the design accounts for that boundary. One option is to record an outgoing task in the same transaction as the state change and let a separate worker deliver it, with a stable task key and retries.
This pattern still requires careful treatment of the receiving service. If that service supports an idempotency key, use its documented contract. If it does not, retain the uncertainty and define reconciliation. Do not label the entire chain “exactly once” merely because the ingestion table has unique keys.
- Count incoming requests separately from distinct observations.
- Track accepted, quarantined, processed and failed records as different outcomes.
- Measure queue age, not only queue length.
- Keep credentials out of ordinary diagnostic messages and exported examples.
Recover without changing history
Replaying a stored envelope should use a known decoder version and preserve the original receipt time. A corrected interpretation can be recorded as a new processing revision rather than rewriting the raw input. The rollout guide explains compatibility across revisions.
When an observation arrives late, successful ingestion should not make it look newly measured. Preserve the distinct clocks described in the timestamp guide. Finally, export enough identity and processing information for the data reconciliation checks to distinguish missing observations from repeated deliveries. That is how a callback endpoint becomes an auditable handoff rather than a request counter.