We’re processing NICE CXone SMS gateway messages by subscribing to the Messaging API webhook endpoint at /api/v2/messaging/webhooks/delivery-status for delivery status reports. The Node.js service receives the payload and parses both SMPP and HTTP formats to extract the MessageIdentifier and CarrierCode. The next step runs an idempotent status update using a database upsert. The query structure is INSERT INTO sms_status (message_id, status, updated_at) VALUES ($1, $2, NOW()) ON CONFLICT (message_id) DO UPDATE SET status = EXCLUDED.status. The RetryQueue handles delivery failures with ExponentialBackoff, and the validation layer checks SenderId formats against regional regulatory constraints. Throughput tracking and latency metrics log everything for SLACompliance. We also expose an SMSSimulator for channel testing. The problem hits when the webhook fires twice for the same report. The upsert conflicts on the unique constraint, and the database throws a 409 error. The platform sends duplicate events with identical MessageIdentifier values inside a 500ms window. We have the DatabaseConnectionPool configured correctly, and the WebhookEndpoint settings are standard. The retry logic kicks in unnecessarily because the initial upsert fails. We don’t want the queue processing duplicates. We need to adjust the transaction isolation level or add a conditional check in the handler. The current implementation misses race conditions in the ingestion pipeline. The API integration route works fine for single events but chokes on bursts.