Node.js / TypeScript Quickstart
Complete end-to-end guide to send multi-channel notifications from a Node.js or TypeScript application — from API key generation to template creation, event triggering, and delivery verification.
1. Sign Up & Get API Key
Register at https://app.hubnest.io. Then go to Developer → API Keys → Generate New Key. Set name, scopes: ["send"], environment: "PROD". Copy the rawKey (hn_live_...) immediately — it is shown only once.
2. Create a Subscriber
Subscribers represent your users. Create one to map your user's email and phone to a subscriberId. Go to Developer → Subscribers → Add Subscriber, or use the API. Each subscriber can opt into email, sms, whatsapp, and push independently via channelPrefs.
3. Create a Notification Template
Templates define the content of your notifications with {{variable}} placeholders. Create a template for each notification type. Variables are auto-extracted from placeholders if variablesSchema is omitted.
4. Connect a Channel Provider
Go to Developer → Channels → Add Provider and connect at least one delivery provider. For instant testing, use the pre-configured Demo Email provider (no setup needed). For production, connect AWS SES, SendGrid, Twilio, MSG91, WhatsApp, FCM, or APNs — see individual channel docs for exact credential formats.
5. Install Dependencies
Initialize your Node.js project and install an HTTP client:
6. Trigger Event — Rules + Workflows Fire Automatically
POST to /api/v1/events from your Node.js app. HubNest evaluates all active Rules and Workflows for this event and dispatches notifications automatically:
7. Direct Send & Bulk Send
For direct single sends (bypasses Rules/Workflows) or bulk campaigns use the dedicated APIs:
8. Verify Delivery in Logs
Go to Developer → Logs at https://app.hubnest.io to see every notification dispatched, its delivery status (sent/failed), latency, provider used, and wallet cost. Set up a Webhook at Developer → Webhooks to receive real-time DELIVERED/FAILED callbacks at your own endpoint.
Next steps
Configure AWS SES IAM keys, verified domains, and sending rate limits.
Connect SendGrid API Keys and verified sender identities.
Connect Twilio Account SID, Auth Token, and phone numbers.
Connect Meta WhatsApp Cloud API access tokens and phone number IDs.