Send Notification to Device Via API | Notify Aim

Send Notification to Device Via API – Notify Aim

Base URL


            https://api.notifyaim.com/api/v1/
                    

All endpoints require HTTPS.


Endpoints


1. Send Notifications in bulk via topic

Sends a notification to a specific device, topic, or segment.

Endpoint


            POST /notification/send
                    

Request Body


            {
                "vapid_private": "Your_Vapid_Private_Key", // Your Vapid Private Key
                "title": "Hello from Notify Aim",
                "body": "This is a test notification",
                "icon": "https://example.com/icon.png",
                "topic" : "offers", // Optional topic to target
                "url": "https://example.com",
                "webhook" : "https://example.com/webhook", // Optional webhook for delivery status
            }
                    

Response


            {
                "status": "queued",
                'message': 'Notification job queued',
                "job_id": "5678", // Unique job ID for tracking
            }
                    

Get Notification Status

Retrieve the status of a previously sent notification using its job ID.

Endpoint


            GET /notification/{jobId}/progress
                    

Response


            {
                "id": "5678", // Job ID
                "status": "delivered|failed|pending",
                "sent": 150,
                "failed": 5,
                "total" : 165,
                "remaining": 10,
                "progress": 90, // Percentage completed
            }
                    

2. Send Notificaition to a specific use or device

Sends a notification to a specific device using its subscription details.

Endpoint


            POST /notifications/send-to-user
                    

Request Body


            {
                "vapid_private": "Your_Vapid_Private_Key", // Your Vapid Private Key
                "userid" : "abcd1234", // User ID to target
                "endpoint": "https://fcm.googleapis.com/fcm/send/...", // User's subscription endpoint
                "title": "Hello from Notify Aim",
                "body": "This is a test notification",
                "icon": "https://example.com/icon.png",
                "url": "https://example.com",
                "webhook" : "https://example.com/webhook", // Optional webhook for delivery status
            }
                    

Response


            {
                "status": "sent",   // "sent" or "failed"
                "message": "Notification sent successfully"
            }
                    

Error Handling

All errors follow the structure:


            {
                "status": "error",
                "message": "Description of the error"
            }
                    

Common HTTP Status Codes

  • 200 – Success
  • 400 – Bad request
  • 401 – Invalid API key
  • 403 – Origin mismatch
  • 404 – Not found
  • 422 – No subscribers
  • 429 – Daily notification limit reached
  • 500 – Server error

Rate Limits

  • Free Plan – 1000 requests/day
  • Pro Plan – 50,000 requests/day
  • Enterprise – Custom limits