Docs/Send a Notification

cURL

Last updatedยท1 min read

Send push notifications directly from your terminal using cURL. No installation required.

Basic example

curl -X POST https://thenotification.app/api/sendNotification \
  -H "app_key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "New Message",
    "body": "Check out this notification",
    "link": "https://example.com/page",
    "image": "https://picsum.photos/400/200"
  }'

Parameters

Field Type Required Description
title string Yes Notification title
body string Yes Notification message
link string No URL to open when tapped
image string No Image URL to display

Success response

{
  "success": true,
  "message": "Notification sent to 1 device(s)",
  "devices_sent": 1,
  "failed_count": 0
}

Using an environment variable

Store your API key in an environment variable to avoid pasting it each time:

export NOTIFICATION_API_KEY=your_api_key_here

curl -X POST https://thenotification.app/api/sendNotification \
  -H "app_key: $NOTIFICATION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "Alert", "body": "Something happened"}'

One-liner

For quick alerts from scripts, strip it down to the minimum:

curl -s -X POST https://thenotification.app/api/sendNotification \
  -H "app_key: $NOTIFICATION_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"title\": \"$1\", \"body\": \"$2\"}"

Save this as notify.sh, make it executable, and call it like:

./notify.sh "Build failed" "main branch โ€” check CI"