NotifyApp API

Complete REST API for sending push notifications, managing subscribers, and analytics.

Base URL
https://your-domain.com/notification/api/

Features

  • Push Notifications (Android, iOS, Web)
  • Email Notifications
  • Subscriber Management
  • Real-time Analytics
  • API Key Authentication
  • Rate Limiting
  • Usage Tracking
  • Multiple Pricing Plans

Authentication

All API requests require authentication using API keys. Include your API key in the request headers.

Header:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Security Note: Keep your API keys secure and never expose them in client-side code.

Send Notification

POST /send-notification.php

Send notifications to devices, email subscribers, or broadcast to all users.

Request Body:
{
  "title": "Your Notification Title",
  "message": "Your notification message",
  "type": "push|email|web",
  "target_type": "single|bulk|broadcast",
  "recipients": ["token1", "token2"] // Required for single/bulk
}
Optional Parameters:
{
  "payload": {
    "action": "open_url",
    "url": "https://example.com",
    "custom_data": "any_value"
  },
  "scheduled_at": "2024-12-31 23:59:59",
  "priority": "high|normal|low"
}
Response:
{
  "success": true,
  "message": "Notification sent successfully",
  "data": {
    "notification_id": 123,
    "recipients_count": 2,
    "estimated_delivery": "2024-01-15 10:30:00"
  }
}

Manage Subscribers

POST /manage-subscriptions.php

Add, update, or remove device tokens and email subscribers.

Add Device Token:
{
  "action": "add_device",
  "token": "device_token_here",
  "device_type": "android|ios|web",
  "device_info": {
    "model": "iPhone 12",
    "os_version": "15.0",
    "app_version": "1.0.0"
  }
}
Add Email Subscriber:
{
  "action": "add_email",
  "email": "user@example.com"
}
Remove Subscriber:
{
  "action": "remove",
  "token": "device_token_here"
}

GET /manage-subscriptions.php

Get list of subscribers for your account.

Query Parameters:
  • type - Filter by device type (android, ios, web, email)
  • status - Filter by status (active, inactive)
  • limit - Number of results (default: 50, max: 1000)
  • offset - Pagination offset

Analytics

GET /analytics.php

Get detailed analytics about your notifications and usage.

Query Parameters:
  • period - Time period (today, week, month, year)
  • start_date - Start date (YYYY-MM-DD)
  • end_date - End date (YYYY-MM-DD)
  • type - Notification type filter
Response:
{
  "success": true,
  "data": {
    "summary": {
      "total_sent": 1500,
      "total_delivered": 1420,
      "total_failed": 80,
      "delivery_rate": 94.67
    },
    "by_type": {
      "push": 1200,
      "email": 250,
      "web": 50
    },
    "daily_stats": [
      {
        "date": "2024-01-15",
        "sent": 150,
        "delivered": 142,
        "failed": 8
      }
    ]
  }
}

Error Handling

HTTP Status Codes

Code Meaning Description
200 OK Request successful
400 Bad Request Invalid request format or missing parameters
401 Unauthorized Invalid or missing API key
403 Forbidden API key doesn't have required permissions
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error occurred

Error Response Format

{
  "success": false,
  "error": {
    "code": "INVALID_TOKEN",
    "message": "The provided device token is invalid",
    "details": "Token format must be 152-164 characters"
  }
}

Code Examples

PHP Example

 'Hello World',
    'message' => 'This is a test notification',
    'type' => 'push',
    'target_type' => 'broadcast'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
if ($result['success']) {
    echo "Notification sent!";
}
?>

JavaScript Example

const sendNotification = async () => {
  try {
    const response = await fetch('/notification/api/send-notification.php', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        title: 'Hello World',
        message: 'This is a test notification',
        type: 'push',
        target_type: 'broadcast'
      })
    });
    
    const result = await response.json();
    if (result.success) {
      console.log('Notification sent!');
    }
  } catch (error) {
    console.error('Error:', error);
  }
};

Python Example

import requests
import json

url = 'https://your-domain.com/notification/api/send-notification.php'
headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
}
data = {
    'title': 'Hello World',
    'message': 'This is a test notification',
    'type': 'push',
    'target_type': 'broadcast'
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

if result['success']:
    print('Notification sent!')

cURL Example

curl -X POST \
  https://your-domain.com/notification/api/send-notification.php \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Hello World",
    "message": "This is a test notification",
    "type": "push",
    "target_type": "broadcast"
  }'

Pricing & Limits

Free

Gratis/bulan

  • 1,000 notifications/bulan
  • Push, Email, Web
  • API Access
  • Analytics
Starter

Rp 135K/bulan

  • 10,000 notifications/bulan
  • All notification types
  • API Access
  • Basic Analytics
Professional

Rp 435K/bulan

  • 100,000 notifications/bulan
  • All features
  • Advanced Analytics
  • Priority Support
Enterprise

Rp 1.5 Juta/bulan

  • Unlimited notifications
  • All features
  • Custom integrations
  • Dedicated support
Rate Limits
  • Free: 100 requests/hour
  • Starter: 1,000 requests/hour
  • Professional: 10,000 requests/hour
  • Enterprise: Unlimited