I needed a replacement for my Telegram bot and just built it myself.
For years I used a Telegram bot to notify me of various events. Newly downloaded videos from my youtube save list, alerts from monitoring tools, and many more. I used it mostly because it was really easy to integrate. It's just a simple HTTP
GET request. Yes, a
GET. You don't even have to Google “PHP curl post request”. Just do something like and you are good to go:
But I always had some concerns because Telegram is a random third party service and although none of my messages contain critical data or personal information, there is no need to send them around the world just to get some push notifications.
I asked my followers on Mastodon if anyone knew of a tool that was similarly easy to use but self-hosted. There were a number of responses and the clear winner was nfty.sh. It is a service with a simple API, an iOS app to receive notifications and the possibility to self-host your own instance. But, maybe you already know what I'm going to say, it didn't spark any joy and I decided to just build it myself. (Also ntfy uses Material UI for its web interface and i just can not stand it)
Of course, I have to admit that Apple releasing support for Web Push Notifications in iOS 16.4 was another reason for implementing it. I always like to try new things and it would be nice if I didn't have to install an app just to get to get push notifications. With Web Push, a simple web app added to your home screen is all you need to receive notifications.
I tried to let Midjourney imagine a cat that knits a sock from paper strips and the result is kind of far away from the prompt but it looks cute, so I kept it. The name was just just the first thing that came to my mind thinking about the project.
The feature scope is quite limited. You can send logs via an simple API and see them in a web interface. It does not have search or even pagination, but you can register for push notifications and receive them!
The API is almost as easy as the Telegram one, I just added an additional
topic field to be able to filter the logs in the future:
$api_token = '…';
file_get_contents("https://logsock.example.com/api/?_token=$api_token&topic=youtoube-dl&message=Your Video has been downloaded");
Of course, you also can send a
POST request with JSON payload and include the token as
Authorization header. Everything is possible!
- Copy the example
docker-compose.yml, create a
VAPIDkey pair and start everything up
- Create a new user and API key
- Add the application to your Homescreen and register for push notifications
- Send something using the simple API!
Present and Future
I have been using logsock for weeks now and it just works! Currently I don't have big plans to add a lot of features, maybe the aforementioned search and pagination would be two candidates that are on the short list.