Notification Service
The MSDN Notification Service provides a robust and scalable mechanism for sending real-time notifications to users across various platforms. This service is designed to be highly available and can be integrated into your applications to keep users informed about important events, updates, and alerts.
Overview
This service allows applications to:
- Send push notifications to mobile devices (iOS, Android).
- Send email notifications.
- Send SMS notifications.
- Manage user notification preferences.
- Track notification delivery status.
API Endpoints
The Notification Service exposes RESTful APIs for interacting with its functionalities.
Sending Notifications
POST /notifications
Sends a notification to one or more recipients.
Request Body (JSON)
{
"recipientIds": ["user123", "user456"],
"channels": ["email", "push"],
"subject": "Important Update Available",
"message": "A new version of the application is ready for download.",
"metadata": {
"deepLink": "myapp://updates/latest",
"priority": "high"
}
}
Request Body Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
recipientIds |
Array of Strings | A list of unique user identifiers for the recipients. | Yes |
channels |
Array of Strings | Specifies the channels to send the notification through (e.g., "email", "push", "sms"). |
Yes |
subject |
String | The subject or title of the notification. | No |
message |
String | The main content of the notification. | Yes |
metadata |
Object | Optional additional data to be included with the notification. Can be used for deep linking, priority, or other custom information. | No |
Response (JSON)
{
"notificationId": "notif_abc123xyz",
"status": "sent",
"sentAt": "2023-10-27T10:00:00Z"
}
Managing Preferences
GET /users/{userId}/preferences
Retrieves the notification preferences for a specific user.
PUT /users/{userId}/preferences
Updates the notification preferences for a specific user.
recipientIds correspond to valid users in the system. Invalid identifiers will be ignored or may result in an error, depending on the configuration.
Supported Channels
- Email: Leverages our integrated email gateway for reliable delivery.
- Push Notifications: Integrates with APNS (Apple Push Notification Service) and FCM (Firebase Cloud Messaging) for iOS and Android devices respectively.
- SMS: Utilizes a third-party SMS provider for text message delivery.
Configuration
Users can manage their notification preferences through their profile settings or by using the dedicated preference management API endpoints. This includes opting in/out of specific notification types or channels.
Error Handling
The service returns standard HTTP status codes. Common errors include:
400 Bad Request: Invalid request payload or parameters.401 Unauthorized: Authentication failed.404 Not Found: User or resource not found.500 Internal Server Error: An unexpected error occurred on the server.503 Service Unavailable: The notification service is temporarily overloaded or down.
Detailed error messages are provided in the response body for debugging purposes.