Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save djeikyb/4f0741fa6b1753bf9d5327d478b0a5c4 to your computer and use it in GitHub Desktop.
Save djeikyb/4f0741fa6b1753bf9d5327d478b0a5c4 to your computer and use it in GitHub Desktop.

Bark Server self-host

Out of the goodness of their heart, github user Finb gave us three things:

  • the bark ios app
  • the bark apn server
  • their private key that authenticates to the Apple Push Notification (APN) service

The bark server provides an api to push notifications to ios devices it knows about. It can be as simple as a docker container. Build it yourself or pull it from docker hub.

You definitely want a data volume. It does not need to be accessible from the public internet. But, you will need to register devices yourself.

docker run -dt --name bark -p 8080:8080 -v `pwd`/bark-data:/data finab/bark-server

I used route53 and caddy to reverse proxy like:

https://bark.example.com {
        reverse_proxy localhost:3008
}

Register a device

Install the bark app. If your bark server is public, the app can register itself. Otherwise, copy the device token from the settings panel, and make the registration call yourself:

curl -X "POST" "https://bark.example.com/register" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "device_token": "COPY_FROM_THE_BARK_APP"
}'

You will get a response back like:

{
    "code": 200,
    "data": {
        "device_key": "YOU_NEED_THIS",
        "device_token": "redacted",
        "key": "redacted"
    },
    "message": "success",
    "timestamp": 1725659426
}

Send a test message:

curl -X "POST" "https://bark.example.com/push" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "body": "Test Bark Server",
  "title": "Test Title",
  "device_key": "PASTE_THE_DEVICE_KEY_HERE"
}'

Integrate with Uptime Kuma

Each notification you set up is for a single device key. The group name is required but can be anything.

The bark endpoint is structured like:

https://bark.example.com/DEVICE_KEY_GOES_HERE

This is a lot simpler to explain than it was to find out. If anything is unclear, you can study uptime kuma's bark notifcation provider and the bark server's rest api. It was also helpful to tail the logs of both uptime kuma and bark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment