Notifications API Guide
Learn how to create and manage notifications using the Wacht Rust SDK.Prerequisites
Before using any API methods, you must initialize the SDK:Create Notification
Send a notification to a specific user.Basic Notification
Notification with Action Button
Notification with Severity
Notification with Metadata and Expiry
Notification with Custom CTAs
CreateNotificationRequest Fields
Required Fields
user_id(String) - User ID to send notification totitle(String) - Notification titlebody(String) - Notification message content
Optional Fields (via Builder Methods)
action_url(Option<String>) - URL for the action buttonaction_label(Option<String>) - Label for the action buttonctas(Option<Vec<CallToAction>>) - Multiple call-to-action buttonsseverity(Option<String>) - Notification severity levelmetadata(Option<HashMap<String, serde_json::Value>>) - Additional metadataexpires_hours(Option<i64>) - Expiry time in hours
Severity Levels
Notifications support four severity levels viaNotificationSeverity:
CallToAction Structure
For custom CTAs, use theCallToAction struct:
Error Handling
All SDK methods return aResult<T, Error>:
Related
- Installation - SDK setup
- Users Guide - User management
- Webhooks Guide - Webhook event delivery
- API Reference - Backend API - Full API docs
