Spaces:
Runtime error
Runtime error
Commit History
-
company based templates
2ea2c73 -
company templates
8c8d149 -
fix: map WATI template params to positional keys (1, 2, ...) instead of named keys
99e77b9 -
email testing
0cbb7b5 -
email changes
523436b
-
feat: refactor email channel to use SMTP with aiosmtplib, update configuration keys
7a3f919
-
feat: replace SMTP with SendGrid API email channel, read api_url from merchant settings
f3e38cf -
push notifications
cfddaee -
WA templates
f949b7a
-
SMS fix
56761f4 -
feat(sms-channel): simplify payload construction and unify message handling
- Remove separate OTP and DLT route logic branches, consolidate into single payload builder - Build message body with fallback chain: explicit body → OTP with expiry → generic notification - Include expiry_minutes in OTP message when available and non-zero - Move sender_id and entity_id assignment to conditional block for non-quick routes only - Simplify route handling by treating "q" (quick/transactional) as default with no DLT requirements - Improves code maintainability and reduces conditional complexity5dfac79 -
feat(notification-ms): add company-level fallback for merchant notification settings
- Add COMPANY_MERCHANT_ID configuration option to Settings for company-wide fallback - Implement two-tier lookup in _get_merchant_settings: merchant-specific first, then company-level - Add company-level fallback resolution by COMPANY_MERCHANT_ID or merchant_type = "company" - Add structured logging when company-level settings are used as fallback - Enables shared notification channel configuration across all merchants when individual settings unavailablea990c69 -
feat(whatsapp-channel): refine template parameter handling for WATI API
- Filter out internal metadata fields (merchant_name, expiry_minutes, merchant_id, source) from template parameters - Update parameter naming to use positional indices ("1", "2", etc.) instead of original key names - Add documentation explaining WATI's positional parameter naming convention - Ensure only relevant template values are sent to WATI API, improving payload clarity and reducing noisee5e9173
-
feat(whatsapp-channel): add tenant_id extraction and URL building for WATI API
- Add JWT payload decoding to extract tenant_id from WATI access tokens - Implement _extract_tenant_id() method to safely parse Bearer tokens without verification - Add _build_base_url() method to inject tenant_id into WATI API endpoint URLs - Update sendTemplateMessage() to use tenant-aware base URL construction - Update getContact() to use tenant-aware base URL construction - Handle edge cases: missing tenant_id, malformed tokens, pre-formatted URLs with tenant segments - WATI API requires tenant_id in URL path format: https://live-mt-server.wati.io/{tenant_id}/api/v1/...270d2f4 -
notification fix
b12ec2c -
notificaiton changes
9aac94f
-
refactor(notification-ms): enhance structured logging across all channels
- Migrate from f-string logging to structured logging with extra context fields - Add event identifiers to all log statements for better observability - Include contextual metadata (merchant_id, template_name, recipient, etc.) in logs - Replace exception string interpolation with exc_info=True for proper stack traces - Update cache service logging to use structured format with operation-specific events - Enhance email channel logging with recipient and template context - Improve push notification logging with provider message IDs and merchant tracking - Update SMS channel logging with provider request IDs and error details - Add WhatsApp channel structured logging with message IDs and status tracking - Update worker and dispatcher service logging for consistency - Add logging configuration options to .env.example (LOG_FORMAT, LOG_DIR, LOG_MAX_BYTES, LOG_BACKUP_COUNT) - Improves log parsing, filtering, and correlation for production monitoring47fd0cd -
feat(notification-ms): add template mapping resolution for multi-channel dispatch
- Strip "Bearer " prefix from WhatsApp access tokens to handle pre-formatted tokens - Add token normalization in both WhatsApp send and validate methods - Refactor _get_merchant_notification_config to use new _get_merchant_settings helper - Fetch both notification_channels and notification_templates in single query - Implement template name resolution per channel using merchant notification_templates mapping - Add WhatsApp template name mapping with fallback to doc template_name - Add SMS template ID resolution from merchant settings with fallback - Add email template ID resolution from merchant settings with fallback - Add logging for WhatsApp and SMS template resolution for debugging - Enables merchants to map generic template names to channel-specific template identifiers6879d73 -
refactor(notification-ms): migrate config to pydantic settings
- Remove os.getenv() calls and replace with pydantic BaseSettings defaults - Eliminate unused os import - Consolidate environment variable handling through pydantic configuration - Simplify config management by leveraging pydantic's built-in environment variable support - Improves type safety and configuration validation across all settingsa462839 -
refactor(notification-ms): improve worker loop reliability and logging
- Update docstring to clarify polling mechanism instead of BRPOP - Add initial startup logging with poll interval and batch size configuration - Add Redis connectivity check with ping verification before processing - Wrap synchronous rpop call with asyncio.to_thread for proper async handling - Add warning log when Redis client is unavailable - Add error logging for Redis ping failures - Add info log after processing batch to track notification throughput - Improve error handling and observability for worker loop operationsd689c74 -
chore(notification-ms): enhance config documentation and organization
- Add docstring to Settings class explaining environment variable loading - Reorganize configuration sections with descriptive comments (Application, MongoDB, Redis, JWT, Worker) - Add JWT configuration variables (SECRET_KEY, ALGORITHM, TOKEN_EXPIRATION_HOURS) - Move MERCHANT_SETTINGS_COLLECTION closer to worker configuration for logical grouping - Improve module-level docstring to clarify environment variable loading behavior - Add comment for global settings instance at module end - Improve code readability through better section organization and documentation298bd96 -
refactor(notification-ms): remove template CRUD and JWT config from notification service
- Remove JWT configuration (SECRET_KEY, ALGORITHM) from config.py as auth is handled by SCM microservice - Simplify template.py to contain only enums (TemplateChannel, TemplateStatus) needed for dispatcher - Remove all template request/response schemas (CreateTemplateRequest, UpdateTemplateRequest, ListTemplatesRequest, TemplateResponse, ListTemplatesResponse) - Remove template document factory function (new_template_doc) - Update template.py docstring to clarify CRUD is managed by SCM microservice, notification-ms only uses enums for template resolution - Template management responsibility now exclusively owned by SCM microservice to avoid duplicatione32375c
-
refactor(notification-ms): migrate templates to company-level and integrate merchant context
- Remove template_router.py and consolidate template endpoints into main notification router - Update template models to remove merchant_id requirement (templates now company-level) - Add merchant_name field to SendNotificationRequest and NotificationDetail for runtime injection - Refactor TemplateService to support company-level template queries without merchant filtering - Update dispatcher to inject merchant_name into template variables at dispatch time - Simplify ListTemplatesRequest by removing merchant_id filter parameter - Update seed_templates.py to create templates without merchant_id association - Revise NOTIFICATION_FLOW_DIAGRAM.md to reflect company-level template architecture - Add JWT configuration (SECRET_KEY, ALGORITHM) to core settings for auth integrationf773f54 -
feat(notification-ms): add template management and Fast2SMS integration
- Replace Twilio SMS provider with Fast2SMS bulkV2 API integration - Add template CRUD endpoints with create, read, update, delete, and list operations - Implement TemplateService for database operations on notification templates - Add Template model with merchant_id, channel, name, body, and metadata fields - Create template seeding script for initial data population - Update dispatcher to support template-based message rendering - Add comprehensive notification flow documentation - Update dependencies in requirements.txt for httpx and template support - Normalize phone numbers by removing +, spaces, and dashes in SMS channel - Support DLT template IDs and additional Fast2SMS configuration options01579cf
-
feat: notification microservice with per-merchant channel credentials
- WhatsApp (WATI), Email (SMTP), SMS (Twilio), Push (FCM) channels - Credentials fetched from scm_merchant_settings per merchant_id - Redis-backed async worker consuming from notifications:queue - MongoDB persistence for all notifications - REST API: POST /send, /send/batch, /list (projection_list), GET /{id}, POST /{id}/retry - Channel status endpoint per-merchant - Correlation ID middleware, structured JSON logging - K8s-ready Dockerfile9b5416f -
initial commit
Verified signature166256c