通过 Bark 应用向 iOS 设备发送推送通知(https://github.com/Finb/Bark)。适用于用户请求向 iPhone 推送通知或发送 Bark 通知的场景。
Send push notifications to iOS devices via the Bark app. The Bark key is stored in ~/.bark/key.
Key file: ~/.bark/key (plain text, just the key string).
If the file doesn't exist or is empty, ask the user for their Bark key and write it to ~/.bark/key.
https://api.day.app/~/.bark/key), body textSend a simple notification:
text
GET https://api.day.app/{key}/{body}
Send with title:
text
GET https://api.day.app/{key}/{title}/{body}
Send with title and subtitle:
text
GET https://api.day.app/{key}/{title}/{subtitle}/{body}
Use POST + --data-urlencode for plain text, newlines, and special characters:
bash
KEY=$(cat ~/.bark/key)
curl -s -X POST "https://api.day.app/$KEY" \
-d "title=Notification Title" \
--data-urlencode "body=First line
Second line
Third line"
Notes:
-d "title=..." and --data-urlencode "body=..." to separate title and body\n as a string)--data-urlencode auto URL-encodes, no manual handling needed for Chinese or special chars-d "body=multiline content" — newlines won't be preserved in form-dataParamDescriptiontitleNotification title, slightly larger than bodysubtitleSubtitlebodyNotification body, use \n for line breaksurlURL to open when notification is tappedgroupMessage group for grouping notificationsiconPush icon (iOS 15+)soundNotification sound, e.g. alarm, birdsong``level``active (default, lights up screen immediately) / timeSensitive (shows during Focus mode) / passive (adds to list without lighting screen)criticalAlert``true to play sound even in Do Not Disturb (use with caution)
~/.bark/key~/.bark/keyKey stored in ~/.bark/key: yourkey
Title: Meeting Reminder
Body: Team sync at 3pm tomorrow
text
curl -s -X POST "https://api.day.app/yourkey" \
-d "title=Meeting Reminder" \
--data-urlencode "body=Team sync at 3pm tomorrow"
api.day.app; Bark also supports self-hosted serverslevel=critical), the device will play sound even in Do Not Disturbcall=1 parameter is used