Publishing Messages
Publishing messages can be done via HTTP PUT/POST. Topics are created on the fly by subscribing or publishing to them. Because there is no sign-up, the topic is essentially a password, so pick something that's not easily guessable.
Basic Usage
Send a simple message using a POST request:
curl
curl -d "Backup successful 😀" https://app.notifyhero.com/mytopic
JavaScript
fetch('https://app.notifyhero.com/mytopic', {
method: 'POST',
body: 'Backup successful 😀'
})
Python
import requests
requests.post("https://app.notifyhero.com/mytopic",
data="Backup successful 😀".encode(encoding='utf-8'))
Go
http.Post("https://app.notifyhero.com/mytopic", "text/plain",
strings.NewReader("Backup successful 😀"))
PHP
file_get_contents('https://app.notifyhero.com/mytopic', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => 'Content-Type: text/plain',
'content' => 'Backup successful 😀'
]
]));
PowerShell
$Request = @{
Method = "POST"
URI = "https://app.notifyhero.com/mytopic"
Body = "Backup successful"
}
Invoke-RestMethod @Request
Message Title
You can set a notification title using the Title header:
curl -H "Title: My Alert" -d "Something happened" https://app.notifyhero.com/mytopic
Or using the X-Title header or the t query parameter.
Message Priority
You can set notification priority using the Priority header (or X-Priority, prio, p):
| Priority | Description |
|----------|-------------|
| max or 5 | Really long vibration, shows even with DND |
| high or 4 | Long vibration |
| default or 3 | Default, short vibration |
| low or 2 | No vibration |
| min or 1 | No vibration, doesn't show as popup |
curl -H "Priority: high" -d "Urgent message!" https://app.notifyhero.com/mytopic
Tags & Emojis
You can tag messages using the Tags header (or X-Tags, tag, ta). Tags that match emoji short codes are converted to emojis:
curl -H "Tags: warning,skull" -d "Alert!" https://app.notifyhero.com/mytopic
This will show as ⚠️💀 Alert!
See the emojis page for a full list of supported emoji short codes.
Scheduled Delivery
You can delay message delivery using the Delay header (or X-Delay, at, in):
# Delay for 30 minutes
curl -H "Delay: 30m" -d "Reminder" https://app.notifyhero.com/mytopic
# Deliver at specific time
curl -H "Delay: tomorrow, 10am" -d "Morning reminder" https://app.notifyhero.com/mytopic
Supported formats:
- Duration:
30m,3h,2 days - Timestamp:
1639194738 - Natural language:
tomorrow, 10am,in 3 hours
Click Actions
Make notifications clickable with the Click header:
curl -H "Click: https://example.com" -d "Click me!" https://app.notifyhero.com/mytopic
Action Buttons
Add up to 3 action buttons to notifications using the Actions header:
curl \
-H "Actions: view, Open portal, https://example.com; http, Close door, https://api.example.com/close" \
-d "Doorbell rang" \
https://app.notifyhero.com/mytopic
Action types:
view- Opens a URL or apphttp- Sends HTTP requestbroadcast- Sends Android broadcast
Attachments
Attach File from URL
Attach an image or file from a URL:
curl -H "Attach: https://example.com/image.jpg" -d "Check this out" https://app.notifyhero.com/mytopic
Upload File Directly
Upload a file as the message body:
curl -T myfile.jpg -H "Filename: myfile.jpg" https://app.notifyhero.com/mytopic
Icons
Set a custom notification icon:
curl -H "Icon: https://example.com/icon.png" -d "Custom icon!" https://app.notifyhero.com/mytopic
JSON Publishing
You can also publish using JSON:
curl -d '{
"topic": "mytopic",
"title": "Alert",
"message": "Something happened",
"priority": 4,
"tags": ["warning"]
}' https://app.notifyhero.com/
Authentication
If a topic requires authentication:
curl -u user:password -d "Message" https://app.notifyhero.com/mytopic
Or using Bearer token:
curl -H "Authorization: Bearer tk_xxxxxxx" -d "Message" https://app.notifyhero.com/mytopic
Rate Limiting
The server implements rate limiting. Default limits (can be configured by server admin):
- Messages: 60 per visitor per hour
- Attachments: 100MB total per visitor per hour
Complete Example
Here's an example using multiple features:
curl \
-H "Title: Unauthorized access detected" \
-H "Priority: urgent" \
-H "Tags: warning,skull" \
-H "Click: https://security.example.com" \
-H "Actions: http, Lock system, https://api.example.com/lock, clear=true" \
-d "Remote access to laptop detected. Act right away." \
https://app.notifyhero.com/security_alerts
This creates an urgent notification with:
- Custom title
- High priority (long vibration, shows with DND)
- Warning and skull emojis
- Click action to open security dashboard
- Action button to lock the system