Back to Bark

Tutorial

docs/en-us/tutorial.md

1.1.45.5 KB
Original Source

Sending Push Notifications

  1. Open the APP and copy the test URL.

  2. Modify the content and request this URL.

You can send a GET or POST request. If the request is successful, you will receive the push notification immediately.

URL Format

The URL consists of the push key, parameter title, parameter subtitle, and parameter body. There are three combinations:

/:key/:body 
/:key/:title/:body 
/:key/:title/:subtitle/:body 

Request Methods

GET request parameters are appended to the URL, for example:
sh
curl https://api.day.app/your_key/body?group=groupName&copy=copyText

When manually appending parameters to the URL, please pay attention to URL encoding issues.

POST request parameters are placed in the request body, for example:
sh
curl -X POST https://api.day.app/your_key \
     -d'body=body&group=groupName&copy=copyText'
POST requests support JSON, for example:
sh
curl -X "POST" "https://api.day.app/your_key" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "body": "Test Body",
  "title": "Test Title",
  "badge": 1,
  "sound": "minuet",
  "icon": "https://day.app/assets/images/avatar.jpg",
  "group": "test",
  "url": "https://mritd.com"
}'
JSON request key can be placed in the request body, the URL path must be /push, for example:
sh
curl -X "POST" "https://api.day.app/push" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{
  "body": "Test Body",
  "title": "Test Title",
  "device_key": "your_key"
}'

MCP

VS Code:

js
{
  "servers": {
    "bark": {
      "type": "http",
      "url": "https://api.day.app/mcp/{key}"
    }
  }
}

Claude Code:

sh
claude mcp add bark --transport http https://api.day.app/mcp/{key}

or

js
{
  "mcpServers": {
    "bark": {
      "type": "http",
      "url": "https://api.day.app/mcp/{key}"
    }
  }
}

Note: Replace {key} in the URL with your own key.

Request Parameters

List of supported parameters, specific effects can be previewed in the APP.

ParameterDescription
titlePush title
subtitlePush subtitle
bodyPush content
markdownPush content with basic Markdown. When this is provided, the body field is ignored.
device_keyDevice key
device_keysKey array, used for batch push. Only supported in JSON requests.
levelPush interruption level.
critical: Important alert, will ring even in silent mode
active:Default value, the system will immediately light up the screen to display the notification
timeSensitive:Time-sensitive notification, can display the notification in focus mode.
passive:Only adds the notification to the notification list, will not light up the screen.
volumeImportant alert notification volume, value range: 0-10, default is 5 if not passed
badgePush badge, can be any number
callPass "1" to repeat the notification ringtone
autoCopyPass "1" to automatically copy the push content on iOS14.5 and below, on iOS14.5 and above, you need to long press or pull down the push to copy
copyWhen copying the push, specify the content to copy, if this parameter is not passed, the entire push content will be copied.
soundCan set different ringtones for the push
iconSet a custom icon for the push, the set icon will replace the default Bark icon.
The icon will be automatically cached on the device, the same icon URL will only be downloaded once.
imagePush image URL
groupGroup messages, pushes will be displayed in the notification center by group.
You can also choose to view different groups in the history message list.
ciphertextCiphertext for encrypted push
isArchivePass 1 to save the push, pass other values to not save the push, if not passed, it will be decided by the APP settings whether to save.
urlURL to jump to when the push is clicked, supports URL Scheme and Universal Link
actionWhen set to “alert”, tapping the push notification and opening the app will display an action popup.
idWhen using the same ID value, it will update the corresponding push notification content
Requires Bark v1.5.2, bark-server v2.2.5 or above
deletePass "1" to delete the notification from the system notification center and APP history, must be used with the id parameter
Requires "Background App Refresh" to be enabled in settings, otherwise it will not work.

Bark 支持的应用程序和插件

  • SmsForwarder Monitors SMS, calls, and app notifications on Android devices and forwards them to Bark based on rules.
  • acme.sh Generates free certificates from ZeroSSL, Let’s Encrypt, and other CAs; Bark can be used to receive acme.sh cronjob notifications.
  • Uptime-Kuma A self-hosted monitoring tool that supports Bark as an alert channel.
  • Apprise Sends notifications to almost all platforms and supports Bark.
  • 浏览器扩展 Sends webpage content to your phone.
  • RevenueBell A tool for indie developers that pushes Apple subscription, renewal, and purchase revenue events to your phone via Bark.

Shortcuts

Bark supports sending notifications directly via Shortcuts.