Push Notifications
This endpoint group provides methods for sending push notifications to various audiences.
Endpoints
POST /api/rpc (Method: PushSenderRpc.sendBroadcast)
Description: Sends a push notification broadcast to a specified audience. Requires admin/staff role.
Request Body:
{ "method": "PushSenderRpc.sendBroadcast", "params": { "targetType": "all", "targetIds": [], "payload": { "title": "Your Title", "body": "Your Notification Body", "url": "https://example.com" } } }Parameters:
Name Type Required Description targetTypeStringYes The type of audience to target. Can be 'all','users', or'channels'.targetIdsArray<String>No An array of user IDs (if targetTypeis'users') or channel names (iftargetTypeis'channels'). Required for these target types.payloadObjectYes The content of the push notification. payload.titleStringYes The title of the notification. Must not be empty. payload.bodyStringYes The main body text of the notification. Must not be empty. payload.urlStringNo An optional URL to open when the notification is clicked. Response:
{ "success": true, "data": { "message": "Notification broadcast initiated. Broadcast sent to [X] users." } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "PushSenderRpc.sendBroadcast", "params": { "targetType": "users", "targetIds": ["user123", "user456"], "payload": { "title": "Important Update", "body": "Check out the new features!", "url": "https://app.example.com/updates" } } }'