Send Push Notifications from Your Backend (REST API)

Your backend calls the REST API to send notifications and calls to the app.

🖥️ Backend

Your backend calls the REST API to send notifications and calls to the app.

  1. Send a notification

    Your backend calls POST /notifications with the header Authorization: Key <API_KEY>. Same format as OneSignal's API.

    curl
    curl -X POST "https://tingpush.com/notifications" \
      -H "Authorization: Key <API_KEY>" \
      -H "Content-Type: application/json" \
      -d '{
        "app_id": "YOUR_APP_ID",
        "include_aliases": { "external_id": ["user-123"] },
        "headings": { "en": "Order delivered" },
        "contents": { "en": "Order #42 was delivered" },
        "data": { "screen": "order", "id": "42" }
      }'
  2. Send a call

    Add the call field. The app receives an accepted event with call_id and data to connect the real call (WebRTC/SIP/Agora…). When the caller cancels or another device answers, send "action": "ended" with the id so the other devices stop ringing.

    JSON
    // Incoming call — id must be a UUID; your backend generates and stores it
    {
      "app_id": "YOUR_APP_ID",
      "include_aliases": { "external_id": ["user-123"] },
      "call": {
        "action": "incoming",
        "id": "6f1c2a3e-8a7b-4c5d-9e0f-1a2b3c4d5e6f",
        "caller_name": "John Smith",
        "handle": "0901234567",
        "is_video": false,
        "timeout": 45
      },
      "data": { "room": "abc" }
    }
    
    // End the call (caller cancelled / answered elsewhere / timed out)
    {
      "app_id": "YOUR_APP_ID",
      "include_aliases": { "external_id": ["user-123"] },
      "headings": { "en": "Missed call" },
      "contents": { "en": "John Smith called you" },
      "call": { "action": "ended", "id": "6f1c2a3e-8a7b-4c5d-9e0f-1a2b3c4d5e6f" }
    }
  3. Examples by language

    C#
    using var http = new HttpClient { BaseAddress = new Uri("https://tingpush.com") };
    http.DefaultRequestHeaders.Add("Authorization", "Key <API_KEY>");
    
    var callId = Guid.NewGuid();
    await http.PostAsJsonAsync("/notifications", new
    {
        app_id = "YOUR_APP_ID",
        include_aliases = new { external_id = new[] { "user-123" } },
        call = new { action = "incoming", id = callId, caller_name = "John Smith", is_video = false },
        data = new { room = "abc" }
    });
    Node.js
    const callId = crypto.randomUUID();
    await fetch('https://tingpush.com/notifications', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', Authorization: 'Key <API_KEY>' },
      body: JSON.stringify({
        app_id: 'YOUR_APP_ID',
        include_aliases: { external_id: ['user-123'] },
        call: { action: 'incoming', id: callId, caller_name: 'John Smith', is_video: false },
        data: { room: 'abc' },
      }),
    });

    See every supported field in the API reference.

βœ… After integrating, check

  1. Run the app on a real device with logging on: you should see [PushConsole] Device registered ….
  2. The project's Devices tab: the device appears; iOS devices show the VoIP badge if you use calls.
  3. The Send tab: send a test to that device.
  4. Choose πŸ“ž Call and test with the app open, closed and with the screen locked.

Ready to integrate?

Create an account to get your App ID and API Key and download the SDKs. Dashboard samples are pre-filled with your project details.