Skip to content

Bark Notifications

Overview

Bark is an iOS App which allows you to push custom notifications to your iPhone. Download the server for a self-hosted solution.

Valid syntax is as follows:

  • bark://{host}/{device_key}
  • bark://{host}:{port}/{device_key}

The secure versions:

  • barks://{host}/{device_key}
  • barks://{host}:{port}/{device_key}

You can also notify more than one device at a time:

  • bark://{host}:{port}/{device_key1}/{device_key2}/{device_keyN}/

Bark supports receiving content as either plain text or Markdown.

Apprise will automatically send one of the following payload fields, depending on the message format in use:

  • Plain text (default): content is sent using the body field.
  • Markdown: content is sent using the markdown field.

To explicitly control this behaviour, set the Apprise message format. For example:

  • ?format=text forces plain text handling.
  • ?format=markdown enables Markdown handling.

Note that the format handling is done by Apprise and affects how the notification is assembled and delivered to Bark.

Bark can end-to-end encrypt your notifications with AES-GCM so that neither the Bark server nor Apple’s push service ever sees the plaintext title or body.

  1. Open the Bark app on your iPhone.
  2. Find Encrypted Push on the home screen and tap into its settings.
  3. Choose the AES-GCM algorithm and enter a key that is exactly 16, 24, or 32 characters long (these map to AES-128, AES-192, and AES-256).
  4. Add that same key to your Apprise URL with ?key=.
Terminal window
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?key=1234567890123456"

Every notification is encrypted with a fresh, randomly generated IV, so sending the same message twice never produces the same ciphertext.

See Bark’s own encryption documentation for more background on how encrypted push works.

Give a notification an id and you can update or remove it later. This suits status messages, such as a build that fails and later passes.

  1. Send a notification with ?id=build-42.
  2. Send another one with the same id to replace it. The new notification takes the place of the old one instead of adding a second one.
  3. Send one with ?id=build-42&delete=yes to remove it from Notification Center and from the Bark app’s history.

This requires Bark v1.5.2 and bark-server v2.2.5 or newer.

When key= is set, the id and the delete flag are sent unencrypted next to the encrypted message, because the Bark server needs them to find the notification on your device. Avoid putting anything private in the id.

Variable Required Description
device_key Yes The device key you wish to notify
sound No Optionally set a sound file to be played with notification sent. Supported sounds are identified here
click No Provide a hyperlink that should be associated with the notification
level No Specify the message level. Can be either active, timeSensitive, or passive.
volume No Specify a volume between 0 and 10 (inclusive).
badge No Provide a numerical value of 0 (zero) or greater to associate a badge with the bark icon on the iOS device.
category No Associate a category with your notification
group No Associate a group with your notification
icon No Set a custom icon URL for the notification. If not specified, Apprise may use its default notify image (unless disabled).
image No Set to no if you do not want the Apprise alert level being placed as the icon associated with the message.
call No Boolean-like input. Accepts yes/no, true/false, 1/0, +/-. When enabled, payload includes 1.
subtitle No A line of text shown between the title and the body.
copy No The text copied when you copy the notification on your device, instead of the body. Handy for one-time codes.
action No What happens when you tap the notification. alert opens the app with a popup to copy or share the message. none only opens the app. A click URL takes priority over this.
archive No Set to yes to save the notification in the Bark app’s history, or no to skip it. If not set, the app’s own setting decides (it saves by default).
ttl No How many seconds a saved notification is kept. Once it expires, Bark removes it from the app’s history and from Notification Center. Only applies to notifications saved in the history.
id No A unique ID for the notification. Sending another notification with the same id replaces the earlier one. Requires Bark v1.5.2 and bark-server v2.2.5 or newer. See Replacing and Deleting Notifications above.
delete No Set to yes to delete the notification matching id instead of showing a new one. Requires id. The default is no.
key No A 16-, 24-, or 32-character AES-GCM encryption key matching the one configured in the Bark app’s Encrypted Push settings. Requires the cryptography Python package. See Encryption above.
Variable Description
overflow Controls messages that exceed a service’s documented limit. The default is upstream.
👉 upstream: Send one message without splitting or truncating it for that limit.
👉 truncate: Keep the portion that fits and discard the rest.
👉 split: Prefer a readable break, fall back to a hard boundary, and send every part in order.
Splitting undeclared or structured content is best effort. Use upstream when the body must remain one intact document.
format This parameter can be set to either text, html, or markdown. Some services support the ability to post content by several different means. The default of this varies (it can be one of the 3 mentioned at any time depending on which service you choose). You can optionally force this setting to stray from the defaults if you wish. If the service doesn’t support different types of transmission formats, then this field is ignored.
verify External requests made to secure locations (such as through the use of https) will have certificates associated with them. By default, Apprise will verify that these certificates are valid; if they are not then no notification will be sent to the source. In some occasions, a user might not have a certificate authority to verify the key against or they trust the source; in this case you will want to set this flag to no. By default it is set to yes.
redirect By default, Apprise will follow HTTP redirects (3xx responses) issued by the remote server, matching the behaviour of the underlying requests library. If you want to prevent custom headers and credentials from being forwarded to destinations that differ from the original URL, set this to no. By default it is set to yes.
cto This stands for Socket Connect Timeout. This is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the connect()) call on the socket. The default value is 4.0 seconds.
rto This stands for Socket Read Timeout. This is the number of seconds the client will wait for the server to send a response. The default value is 4.0 seconds.
emojis Enable Emoji support (such as providing :+1: would translate to 👍). By default this is set to no.
Note: Depending on server side settings, the administrator has the power to disable emoji support at a global level; but default this is not the case.
tz Identify the IANA Time Zone Database you wish to operate as. By default this is detected based on the configuration the server hosting Apprise is running on. You can set this to things like America/Toronto, or any other properly formated Timezone describing your area.
retry The number of additional delivery attempts to make after the first failure before giving up. Accepts an integer in the range 0 to 10. The default is 0 (no retries – a single attempt is made). When combined with wait, Apprise pauses the specified number of seconds between each attempt.
wait The number of seconds to pause between retry attempts. Accepts a decimal value in the range 0.0 to 20.0; integer values are promoted to float automatically. The default is 0.5. This value is only meaningful when retry is greater than zero – a service with retry=0 makes exactly one attempt regardless of the wait value.
optional When set to yes, a delivery failure for this service is silently absorbed. The overall notify() call still evaluates as true even if this endpoint was unreachable, provided that every required (non-optional) service in the same batch succeeded. Setting this flag does not skip delivery or bypass retry logic – all configured retry attempts are still made before the failure is absorbed. By default this is set to no, meaning every failure is propagated to the caller.

Send a Bark notification to all devices associated with a project:

Terminal window
# Assume:
# - our {hostname} is localhost
# - our {port} is 8080
# - our {device_key} is j300012fl9y0b5AW9g9Nsejb8P
apprise -vv -t "Test Message Title" -b "Test Message Body" \
bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P

Send a Markdown formatted Bark notification:

Terminal window
# Markdown content is sent using Bark's `markdown` field
apprise -vv -t "Build Status" -b "# Success\n\nDeployment completed." \
bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?format=markdown

Force plain text behaviour (even if your Apprise configuration defaults to another format):

Terminal window
apprise -vv -t "Plain Text" -b "**This will not be bold**" \
bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?format=text

Send an end-to-end encrypted Bark notification (see Encryption above):

Terminal window
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?key=1234567890123456"

Send a notification with a subtitle, and copy only the code when you copy it on your device:

Terminal window
apprise -vv -t "Sign In" -b "Your login code is 123456" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?subtitle=MyApp&copy=123456"

Save a notification in the app’s history and have Bark remove it after an hour:

Terminal window
apprise -vv -t "Reminder" -b "The door is still open" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?archive=yes&ttl=3600"

Show a build status, replace it when the build finishes, then remove it (see Replacing and Deleting Notifications above):

Terminal window
# Show the status
apprise -vv -t "Build" -b "Running" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?id=build-42"
# Replace it
apprise -vv -t "Build" -b "Passed" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?id=build-42"
# Remove it
apprise -vv -b "delete" \
"bark://localhost:8080/j300012fl9y0b5AW9g9Nsejb8P?id=build-42&delete=yes"
Questions or Feedback?

Documentation

Notice a typo or an error?

Technical Issues

Having trouble with the code? Open an issue on GitHub:

Made with love from Canada