Skip to content

Parameter list

Short parameterLong parameterTypeDescription
-c--configFILEProfile path, lowest priority
-k--keyTEXTBark's API Key
-d--tokenTEXTBark's Device Token
-M--modeENUMPush Mode
-t--titleTEXTPush Title
-b--bodyTEXTPush Body
-cl--callBOOLEANWhether to continue ringing, default is off
-l--levelENUMPush Level
-v--volumeINTEGERPush Volume, Range 0-10
-bd--badgeINTEGERPush notification badge count
-ac--autoCopyBOOLEANWhether to automatically copy and push content
-cp--copyTEXTSpecify the content to be copied, or if not specified, the entire push content
-s--soundENUMPush ringtones
-i--iconTEXTPush icon URL, download the same icon URL only once
-g--groupTEXTPush grouping, Notification Center will display pushes by group
-a--isArchiveBOOLEANWhether to save the push, saved by default
-u--urlTEXTClicking on the push notification jumps to the URL
-P--proxiesTEXT...Proxy server
--update-configFLAGUpdate configuration file
--init-configTEXTInitialize configuration file
-hFLAGDisplay rich text help
--helpFLAGDisplay the help message and exit

Detailed description

--config

Specify the path to the configuration file, with the lowest priority. The default path for the main configuration file is f2/conf/app.yaml, which supports absolute paths and relative paths.

--key

The key of Bark is a 22-character string. It can be viewed on the homepage of the Bark app.

Bark Key

🔗 Example: Bark's official /push interface
shell
curl -X "POST" "https://api.day.app/push" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "body": "Test Bark Server",
  "title": "Test Title",
  "device_key": "your_key"
}'

--token

The Token of Bark is a 64-bit string. It can be viewed on the homepage of the Bark app.

Bark Token

🔒 Key source

  • The Key of Bark is generated by the Bark server, do not disclose it, including developers and the community.
  • The Device Token of Bark is generated by the Apple server, do not disclose.

‼️ Privacy Protection ‼️

  • Never share your Key and Token in public places such as Discussions, Issues, Discord, etc., and be careful to delete sensitive information.
  • Anyone who gets your Key can send push notifications to your device.
  • When a leak occurs, please immediately regenerate the Key and Token in the Bark app.
  • More privacy protection information, please refer to the Privacy Security of Bark.

--mode

Specify the push method:

  • get: Send notification using GET request (default).
  • post: Send notification using POST request.

ℹ️ Precautions

  • If you manually splice parameters, you need to pay attention to the issue of URL encoding; F2 will automatically handle the encoding.
  • When using post mode, parameters are sent in JSON format, no manual encoding is required.
  • FAQ: URL encoding
  • cipher: push encryption mode Experimental

Push encryption is a method to protect push content, which encrypts and decrypts the push content with a custom key to prevent the push content from being accessed or leaked by the Bark and Apple servers.

The details are all completed automatically by F2, just provide the plain text content normally.

Bark Ciphertext

Bark Ciphertext Setting

🔗 Example: F2 official encrypted push command
shell
f2 bark -t "Test Title" -b "Test Body" -M cipher
🔗 Example: Bark official sending script
sh
#!/usr/bin/env bash

set -e

# bark key
deviceKey='F5u42Bd3HyW8KxkUqo2gRA'
# push payload
json='{"body": "test", "sound": "birdsong"}'

# Must be 16 bit long
key='1234567890123456'
# IV can be randomly generated, but if it is random, it needs to be passed in the iv parameter.
iv='1234567890123456'

# openssl requires Hex encoding of manual keys and IVs, not ASCII encoding.
key=$(printf $key | xxd -ps -c 200)
iv=$(printf $iv | xxd -ps -c 200)

ciphertext=$(echo -n $json | openssl enc -aes-128-cbc -K $key -iv $iv | base64)

# The console will print "+aPt5cwN9GbTLLSFri60l3h1X00u/9j1FENfWiTxhNHVLGU+XoJ15JJG5W/d/yf0"
echo $ciphertext

# URL encoding the ciphertext, there may be special characters.
curl --data-urlencode "ciphertext=$ciphertext" --data-urlencode "iv=1234567890123456" https://api.day.app/$deviceKey

IMPORTANT ❗❗❗

  • After enabling push encryption, the default get request mode will no longer be applicable and needs to be switched to cipher mode.
  • In the Push Encryption settings on the Bark homepage, a custom key must be configured as required. The length of the key is determined by the selected encryption algorithm.
  • To enhance safety and reduce collision probability, F2 automatically uses random iv. In Bark, iv can be filled in arbitrarily.
  • Although the push encryption feature is still in the experimental stage, it is recommended to use the AES-256-CBC encryption mode first. Because the GCM mode of the current Bark v1.4.3(5) version is not fully supported yet and will need to be enabled in a future version. Allows use of GCM Mode#262.
  • For more information, see Bark's Push Encryption.

--title

Push title. It is recommended not to exceed 8 characters.

--body

Pushed content. It is recommended not to exceed 30 characters.

--call

Whether to continue ringing, default off.

--level

Push notification priority:

  • active: Default
  • timeSensitive: timeliness notification
  • passive: Passive notification
  • critical: emergency notification

⚠️ Important tips ⚠️

  • Notifications set to critical level will be forced to vibrate in iOS 15 and above, even if the device is in silent mode.

--volume

Push volume, range 0-10.

--badge

The number of push badges will be displayed on the icon of the Bark app.

--autoCopy

Whether to automatically copy push content.

Due to tightened permissions, versions after iOS 14.5 cannot automatically copy the push content to the clipboard when receiving a push.

You can pull down to push or swipe the push point left on the lock screen to view it to automatically copy it, or click the pop-up push and copy button.

--copy

Specify the content to be copied; if not specified, the entire push content will be copied. Generally used in scenarios where it is necessary to copy push content.

--sound

Push notification ringtone, optional values:

  • birdsong
  • alarm
  • chord
  • dog
  • guitar
  • piano
  • ring
  • robot
  • siren
  • trumpet
  • vibrate
  • none
  • ……

For more ringtones, check out the settings of the Bark app. It also supports custom ringtones.

--icon

Push icon URL, download the same icon URL only once. The default icon for F2.

F2 Icon

--group

Push groups, the notification center will display push notifications according to groups. Suitable for different push scenarios, such as different application and server conditions. It is recommended not to exceed 8 characters.

--isArchive

Whether to save the push, default save. If closed, the push will not be saved in the Bark app.

--url

The URL that jumps when you click push supports URL Scheme and Universal Link. Suitable for some scenarios that require callback or jump.

🔗 Example: Use the URL Scheme to jump to the official website of the F2 document.
shell
f2 bark -t "Jump Test" -b "Open F2 Docs" --url "https://f2.wiki/"

🌏 Update route - Official version

  • Press F2 to push live broadcast notifications to users, click the notification to remotely download the live broadcast.
  • Press F2 to push work update notifications to users, click the push to download updates. By the F2 URL Scheme command to achieve remote control.

--proxies

Configure the proxy server, supporting up to two parameters, corresponding to the http:// and https:// protocols.

Example: --proxies http://x.x.x.x https://x.x.x.x

IMPORTANT ❗❗❗

If the proxy does not support egress HTTPS, use: --proxies http://x.x.x.x http://x.x.x.x.

--update-config

Update configuration files via CLI parameters. For details, see: Configuring Cookies

--init-config

Initialize the high-frequency configuration file. See: Initialize Config File

Released under the Apache-2.0 license.