TL;DR — Executive Summary
Behind the scenes of the messaging infrastructures that ensure Pix confirmation alerts are delivered in under 3 seconds to millions of users in Brazil.
Since its launch by the Central Bank of Brazil (BCB) in 2020, Pix has become the most popular payment method in the country, easily surpassing legacy channels like TED, DOC, bank slips (boletos), and debit cards. With transactional peaks exceeding 120 million transfers in a single day, the Brazilian financial ecosystem demands not only instant settlement in under 2 seconds but also instant and reliable confirmation messaging.
For digital banks, fintechs, and payment wallets, notifying customers about Pix transfers in real time is more than just a matter of good user experience (UX) — it is a critical security layer against account takeovers and transaction fraud. Delivering a confirmation SMS or push alert in under 3 seconds requires a highly scalable, fault-tolerant, and low-latency messaging infrastructure.
---
1. Core Engineering Challenges in Pix Messaging
Processing Pix confirmation alerts at an enterprise scale presents three main engineering hurdles:
- Massive Concurrent Transaction Volume: During transactional peaks, such as national salary payout days (typically the 5th business day of each month), holidays, and shopping events like Black Friday, transactions per second (TPS) can spike up to ten times above average levels.
- Strict Latency Requirements: An alert delivered even 2 minutes late is useless for checkout verification and can cause panic for users who might think their funds vanished. The target duration from BCB liquidation to the handset screen notification is under 3 seconds.
- Guaranteed Idempotent Delivery: The pipeline must ensure that duplicate messages are not sent. Triggering two notifications for a single Pix event causes severe confusion, leading users to believe they were debited twice.
---
2. Asynchronous Messaging Architecture for High Availability
To handle extreme transaction loads under low latencies, digital banks utilize Event-Driven Architecture (EDA) backed by distributed high-throughput message brokers rather than synchronous API requests.
mermaid graph TD BC[Central Bank of Brazil] -->|Pix Settlement| API[API Gateway / Webhook Pix] API -->|Pix Event| Kafka[Apache Kafka / Event Broker] Kafka -->|Async Consumption| Work[Worker Pool / Microservices] Work -->|Validate Idempotency| Cache[(Redis Cache)] Work -->|API REST SMPP| Carrier[Bulk SMS Gateway Tier-1] Carrier -->|SMS A2P < 3s| Phone[User Device]
Architectural Pipeline Components:
- Settlement Webhook: The banking engine settles the transaction and publishes a payload containing the unique Pix transaction ID (
endToEndId), recipient phone number, and transfer value. - Event Broker (Apache Kafka or RabbitMQ): The event is published asynchronously to a messaging topic. Kafka acts as an elastic buffer, absorbing transactional spikes without overwhelming the outbound SMS gateway.
- Idempotency Cache (Redis): Before dispatching a message, the worker microservice queries a Redis cache containing recent
endToEndIdkeys. If the ID was processed within the last 10 minutes, the duplicate is dropped. - SMPP Binds to Tier-1 Carriers: Microservices talk to the CPaaS gateway via active SMPP sessions or persistent HTTP connections using keep-alive, keeping network transport times under 50 milliseconds.
---
3. Technical Integration: Asynchronous Queue Processing in Node.js
To demonstrate how this architecture functions, here is a Node.js Express server using the Bull package (a Redis-backed queue manager) to process outbound transactional SMS alerts asynchronously:
javascript const express = require('express'); const Queue = require('bull'); const axios = require('axios'); const app = express(); app.use(express.json());
const BULK_SMS_API_URL = 'https://api.bulksmsbrazil.com/v1'; const API_TOKEN = 'your_fintech_api_token_here';
// 1. Initialize the Pix notification queue backed by Redis const pixNotificationQueue = new Queue('pix-notifications', { redis: { port: 6379, host: '127.0.0.1' } });
// 2. Webhook receiver that processes settled Pix events app.post('/webhooks/pix-settled', async (req, res) => { const { endToEndId, amount, phone, clientName } = req.body;
if (!endToEndId || !amount || !phone) { return res.status(400).json({ error: 'Incomplete transaction payload.' }); }
console.log(Pix settled in BCB: ${endToEndId} - Amount: R$ ${amount});
// Enqueue the notification task for immediate asynchronous execution await pixNotificationQueue.add({ endToEndId, amount, phone, clientName }, { attempts: 3, // Auto-retry up to 3 times on gateway timeout backoff: 1000, // 1-second delay before retry attempts removeOnComplete: true // Keep Redis memory clean by removing completed jobs });
// Return HTTP 202 (Accepted) immediately to free up the webhook thread return res.sendStatus(202); });
// 3. Queue Processor (Worker pool executing in background threads) pixNotificationQueue.process(async (job) => { const { endToEndId, amount, phone, clientName } = job.data;
// Format the standard banking transaction alert message const messageText = PIX RECEIVED: You received a Pix transfer of R$ ${amount} from ${clientName}.;
try { const response = await axios.post(${BULK_SMS_API_URL}/sms/send, { to: phone, message: messageText, // Provide the transaction ID as the external ID to enforce gateway idempotency externalId: endToEndId }, { headers: { 'Authorization': Bearer ${API_TOKEN}, 'Content-Type': 'application/json' } });
console.log(Pix SMS dispatched to ${phone}. ID: ${response.data.messageId}); return response.data; } catch (error) { console.error(Failed to dispatch Pix SMS to ${phone}:, error.message); throw new Error('Outbound SMS gateway failure.'); // Triggers the queue's retry mechanism } });
app.listen(3000, () => console.log('Pix Messaging Server running on port 3000'));
---
4. Idempotency Enforcements via the Pix endToEndId
Duplicate protection must be enforced at both the banking origin and the CPaaS destination. For every transaction, the Central Bank of Brazil generates a unique 32-character alphanumeric identifier called the endToEndId (e.g., E00038166202606021345123456789AB).
Because the Bulk SMS API accepts an external ID parameter (externalId), our gateway automatically rejects any incoming request with a duplicate ID within a 24-hour window. This acts as a robust double-delivery safety shield, preventing carriers from sending identical text messages to the consumer's phone.
To learn more about our high-throughput routes and low-latency direct SMPP binds, explore our Fintech Verticals page or reach out to our developer integration team on SMS APIs.
Camila Rodrigues
CTO, Bulk SMS
Senior specialist in mobile telecommunications infrastructure, high-performance enterprise messaging, and LGPD compliance for smart communication platforms and APIs in Brazil.