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
- Monitors a specified Bluesky handle for new posts.
- Sends notifications for new posts using Ntfy.
- Optionally likes new posts automatically.
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
DOTNET_ENVIRONMENT: Specifies the environment (e.g., Development, Production).XDG_STATE_HOME: Overrides the base directory for the session state file.
Usage
- Clone the repository.
- Configure the application by editing the
appsettings.jsonfile or setting environment variables. - 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
--once: perform a single poll and exit (0= success, non-zero = failure).--verbose: print the raw feed JSON for debugging.--Instance=name: name of this configuration, used for its state file and lock.--StatePath=/path/to/state.json: override the state file location.- In
--oncemodePollIntervalSecondsis ignored; use the cron schedule instead. - Config is read from the current directory when it contains
appsettings.json, otherwise from the binary's directory.
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.