AppMage

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
    targetType String Yes The type of audience to target. Can be 'all', 'users', or 'channels'.
    targetIds Array<String> No An array of user IDs (if targetType is 'users') or channel names (if targetType is 'channels'). Required for these target types.
    payload Object Yes The content of the push notification.
    payload.title String Yes The title of the notification. Must not be empty.
    payload.body String Yes The main body text of the notification. Must not be empty.
    payload.url String No 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"
          }
        }
      }'