Python Quickstart
Complete end-to-end guide to send multi-channel notifications from a Python application (Django, Flask, FastAPI, or plain script) — from API key generation to template creation, event triggering, and delivery verification.
1. Sign Up & Get API Key
Register at https://app.hubnest.io. Go to Developer → API Keys → Generate New Key. Copy the rawKey (hn_live_...) immediately — it is shown only once. Store it in your environment variables.
2. Create a Subscriber
Subscribers represent your app users. Create one to map email/phone to a subscriberId for targeted delivery.
3. Create a Notification Template
Create templates with {{variable}} placeholders. Variables are auto-extracted from the body if variablesSchema is omitted.
4. Connect a Channel Provider
Go to Developer → Channels → Add Provider at https://app.hubnest.io. Use Demo Email for instant testing, or connect AWS SES, SendGrid, Twilio, MSG91, WhatsApp, FCM, or APNs for production. See channel-specific docs for credential formats.
5. Install requests Library
Install the HTTP library:
6. Trigger Event — Rules + Workflows Fire Automatically
POST to /api/v1/events — HubNest evaluates all active Rules and Workflows and dispatches matching notifications:
7. Direct Send & Bulk Send
Direct send bypasses Rules/Workflows. Bulk campaign fans out to a list via Kafka queue:
8. Verify Delivery in Logs
Run your script with python send_notification.py, then go to Developer → Logs at https://app.hubnest.io to see delivery status, latency, provider used, and wallet cost for each notification dispatched.
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.