Parameter list
Short parameter | Long parameter | Type | Description |
---|---|---|---|
-c | --config | FILE | Profile path, lowest priority |
-k | --key | TEXT | Bark's API Key |
-d | --token | TEXT | Bark's Device Token |
-M | --mode | ENUM | Push Mode |
-t | --title | TEXT | Push Title |
-b | --body | TEXT | Push Body |
-cl | --call | BOOLEAN | Whether to continue ringing, default is off |
-l | --level | ENUM | Push Level |
-v | --volume | INTEGER | Push Volume, Range 0-10 |
-bd | --badge | INTEGER | Push notification badge count |
-ac | --autoCopy | BOOLEAN | Whether to automatically copy and push content |
-cp | --copy | TEXT | Specify the content to be copied, or if not specified, the entire push content |
-s | --sound | ENUM | Push ringtones |
-i | --icon | TEXT | Push icon URL, download the same icon URL only once |
-g | --group | TEXT | Push grouping, Notification Center will display pushes by group |
-a | --isArchive | BOOLEAN | Whether to save the push, saved by default |
-u | --url | TEXT | Clicking on the push notification jumps to the URL |
-P | --proxies | TEXT... | Proxy server |
--update-config | FLAG | Update configuration file | |
--init-config | TEXT | Initialize configuration file | |
-h | FLAG | Display rich text help | |
--help | FLAG | Display 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.
🔗 Example: Bark's official /push
interface
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.
🔒 Key source
- The
Key
ofBark
is generated by theBark
server, do not disclose it, including developers and the community. - The
Device Token
ofBark
is generated by theApple
server, do not disclose.
‼️ Privacy Protection ‼️
- Never share your
Key
andToken
in public places such asDiscussions
,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
andToken
in theBark
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 inJSON
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.
🔗 Example: F2
official encrypted push command
f2 bark -t "Test Title" -b "Test Body" -M cipher
🔗 Example: Bark
official sending script
#!/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 tocipher
mode. - In the
Push Encryption
settings on theBark
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 randomiv
. InBark
,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 theGCM
mode of the currentBark 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
: DefaulttimeSensitive
: timeliness notificationpassive
: Passive notificationcritical
: emergency notification
⚠️ Important tips ⚠️
- Notifications set to
critical
level will be forced to vibrate iniOS 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
.
--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.
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 theF2 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。