Get Started
Getting Started

How HubNest Works

Understand the end-to-end execution pipeline from triggering an event in your backend application to carrier delivery.

1

1. The Execution Pipeline

Every notification goes through five main stages: Client Trigger → Rule + Workflow Evaluation → Kafka Queue → Provider Routing → Delivery & Commit.

architecture/pipeline.txt
text
1[Your Backend App]
2 POST /api/v1/events
3
4[HubNest API Gateway] ←── API Key Auth (Bearer hn_live_...)
5 1. Rule Engine evaluates all active Rules
6 2. Workflow Engine evaluates all active Workflows
7
8[Kafka Event Queue]
9 Background worker picks up job
10
11[Provider Router] ←── Health score + priority + failover
12
13[Channel Adapters] ──► AWS SES / Twilio / Meta WhatsApp / FCM / APNs
14
15
16[Delivery Commit + Log] ──► Wallet debit + Webhook callback
2

2. Rules & Workflow Engine

When an event arrives, two evaluation engines run simultaneously:

Rules vs Workflows
Use Rules for simple if-then logic (e.g. "if user signs up → send welcome email"). Use Workflows for multi-step sequences with branching, delays, and multi-channel dispatch (e.g. "email → wait 1 day → if not opened → send SMS").
  • Rule Engine: Evaluates all active Rules against the event payload. A Rule has a condition (e.g. amount > 5000) and an action (channel + template). If condition matches, the notification is dispatched immediately.
  • Workflow Engine: Evaluates all active Workflows. Those whose TRIGGER node eventName matches the incoming event are executed as a DAG run with nodes: TRIGGER → CONDITION → SEND_ACTION → WAIT → UPDATE_FIELD → END.
  • Both can fire on the same event simultaneously — Rule dispatch and multiple Workflow runs are independent.
  • Event response includes ruleMatched (boolean), ruleNotificationStatus ("sent"/"error"), and workflowsTriggeredCount (number).
3

3. Failover & Provider Routing

HubNest dynamically scores every connected provider based on live delivery success rates and response latency. If your primary AWS SES fails or rate-limits, traffic automatically redirects to your secondary SendGrid provider in under 150ms. Priority is set per provider (1 = highest priority).

4

4. Wallet Reserve-Commit Flow

To prevent over-sending and budget overruns, HubNest uses a 3-step wallet transaction model for every notification:

  • Reserve: Before dispatching, the provider cost (e.g. ₹0.20 per SMS, ₹0.01 per email) is reserved from wallet balance.
  • Commit: On carrier delivery success, the reserved amount is permanently debited from the wallet.
  • Release: If delivery fails on all retry attempts, the reserved amount is returned to wallet balance.
Was this guide helpful?