Relay Bluesky to Ntfy

Bluesky Ntfy
Login

Bluesky Ntfy

Bluesky Ntfy is a .NET application that monitors a specified Bluesky handle for new posts and sends notifications using the Ntfy service. It can also automatically like new posts if configured to do so.

Features

Configuration

The application is configured using appsettings.json files and environment variables. The following configuration options are available:

appsettings.json

{
  "Bluesky": {
    "Username": "your_bluesky_username",
    "AppPassword": "your_bluesky_app_password",
    "TargetHandle": "target_bluesky_handle",
    "PollIntervalSeconds": 60,
    "AlwaysLike": true
  },
  "Ntfy": {
    "BaseUrl": "https://ntfy.sh",
    "Topic": "your_ntfy_topic",
    "User": "your_ntfy_user",
    "Password": "your_ntfy_password",
    "AccessToken": "your_ntfy_access_token"
  }
}

Environment Variables

Usage

  1. Clone the repository.
  2. Configure the application by editing the appsettings.json file or setting environment variables.
  3. Run the application:
dotnet run

Running once via cron

Build/publish once:

dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -o ./publish

Then call the binary with --once from cron:

*/5 * * * * cd /path/to/publish && ./bluesky-ntfy --once --Instance=shire >> "$HOME/.local/state/bluesky-ntfy/cron-shire.log" 2>&1
*/5 * * * * cd /path/to/publish && ./bluesky-ntfy --once --Instance=other >> "$HOME/.local/state/bluesky-ntfy/cron-other.log" 2>&1

Multiple configurations can run side by side. By default every configuration gets its own state file based on TargetHandle, Ntfy.BaseUrl and Ntfy.Topic; use --Instance for a readable name. Concurrent runs of the same configuration are prevented by a lock file, so an overlapping cron run is skipped safely.

The last seen post and the Bluesky session (access/refresh tokens) are stored in $XDG_STATE_HOME/bluesky-ntfy/<instance>.json (default ~/.local/state/bluesky-ntfy/<instance>.json) with mode 0600. The refresh token is reused and renewed automatically; the app password is only used when no valid session exists. Restrict appsettings*.json to your user as well (chmod 600 appsettings*.json).

License

This project is licensed under the MIT License.