[GH-ISSUE #295] Feature Request: Easier way to retrieve user device_key for integrations #260

Closed
opened 2026-03-03 11:42:00 +03:00 by kerem · 3 comments
Owner

Originally created by @JRebertt on GitHub (Mar 24, 2025).
Original GitHub issue: https://github.com/Finb/Bark/issues/295

Hi there! 👋
I'm working on integrating Bark into my own backend system to send push notifications to users.

I was wondering: is there currently an easy way to programmatically retrieve the user's device_key (the one used to receive notifications), similar to a “plug-and-play” integration?

Ideally, I’d like to let the user connect Bark to their account without needing much interaction inside the mobile app — for example, using a webhook or a callback after tapping a notification.

Does anything like this exist or is planned? Or would you recommend any best practices for this kind of user onboarding flow?

Thanks in advance for your awesome work on Bark! 🚀

Originally created by @JRebertt on GitHub (Mar 24, 2025). Original GitHub issue: https://github.com/Finb/Bark/issues/295 Hi there! 👋 I'm working on integrating Bark into my own backend system to send push notifications to users. I was wondering: is there currently an easy way to programmatically retrieve the user's device_key (the one used to receive notifications), similar to a “plug-and-play” integration? Ideally, I’d like to let the user connect Bark to their account without needing much interaction inside the mobile app — for example, using a webhook or a callback after tapping a notification. Does anything like this exist or is planned? Or would you recommend any best practices for this kind of user onboarding flow? Thanks in advance for your awesome work on Bark! 🚀
kerem closed this issue 2026-03-03 11:42:00 +03:00
Author
Owner

@Finb commented on GitHub (Mar 25, 2025):

Hi there,

You can add your service to the user’s app using a URL Scheme.
Two routes need to be implemented:

/register?deviceToken=&key=

deviceToken: APNs-generated push notification token (may change periodically).
key: Server-generated unique identifier for the user's device.
When the deviceToken is changed, the app will send the key back to ensure the server correctly updates the deviceToken associated with the key.

For implementation details, refer to: https://github.com/Finb/bark-server/blob/master/route_register.go  
/ping  
This simply indicates that the server is running properly and should return `{"code":200}`.  

(You can also simply forward the requests to the Bark-Server.)

URL Scheme:

bark://addServer?address=https%3A%2F%2Fapi.day.app

or

bark://addServer?address=https%3A%2F%2Fyour_host/subpath

Once the user clicks the link and successfully adds the server, your server will receive a register request.

<!-- gh-comment-id:2749803432 --> @Finb commented on GitHub (Mar 25, 2025): Hi there, You can add your service to the user’s app using a URL Scheme. Two routes need to be implemented: ``` /register?deviceToken=&key= deviceToken: APNs-generated push notification token (may change periodically). key: Server-generated unique identifier for the user's device. When the deviceToken is changed, the app will send the key back to ensure the server correctly updates the deviceToken associated with the key. For implementation details, refer to: https://github.com/Finb/bark-server/blob/master/route_register.go ``` ``` /ping This simply indicates that the server is running properly and should return `{"code":200}`. ``` (You can also simply forward the requests to the Bark-Server.) URL Scheme: ``` bark://addServer?address=https%3A%2F%2Fapi.day.app ``` or ``` bark://addServer?address=https%3A%2F%2Fyour_host/subpath ``` Once the user clicks the link and successfully adds the server, your server will receive a register request.
Author
Owner

@JRebertt commented on GitHub (Mar 25, 2025):

Hey! @Finb 👋

I'm running the Bark server on my VPS using Docker, and I'm trying to better understand how the /register route works.

After the user clicks bark://addServer?address=..., how can I associate the device_key with a user in my system? I’d like to store this key in my database to send notifications to that user later.

Is there any way for my backend to receive this information (like the device_key) automatically when the registration is done?

If there's a recommended approach, could you show an example of how to handle this in Node.js?

Thanks! 🔥

<!-- gh-comment-id:2751691644 --> @JRebertt commented on GitHub (Mar 25, 2025): Hey! @Finb 👋 I'm running the Bark server on my VPS using Docker, and I'm trying to better understand how the `/register` route works. After the user clicks `bark://addServer?address=...`, how can I associate the `device_key` with a user in my system? I’d like to store this key in my database to send notifications to that user later. Is there any way for my backend to receive this information (like the `device_key`) automatically when the registration is done? If there's a recommended approach, could you show an example of how to handle this in Node.js? Thanks! 🔥
Author
Owner

@Finb commented on GitHub (Mar 26, 2025):

An untested but potentially feasible solution:

/:user_id/register?deviceToken=...
/:user_id/ping

Then, provide users with the URL Scheme:

bark://addServer?address=https://your_host/user_id
<!-- gh-comment-id:2752939156 --> @Finb commented on GitHub (Mar 26, 2025): An untested but potentially feasible solution: ``` /:user_id/register?deviceToken=... /:user_id/ping ``` Then, provide users with the URL Scheme: ``` bark://addServer?address=https://your_host/user_id ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Bark#260
No description provided.