This is a simple plugin that allows you to send custom notifications to your computer instead of the default ugly ones that you are used to. From Windows, Mac and Linux.
I made this so I could get notifications from small scripts or automations I made, and I thought it would be nice to share it with you guys. I hope you enjoy it. If you have any questions, feel free to ask me. I will try to answer as soon as possible. If you have any suggestions, feel free to make a pull request. I will try to review it as soon as possible.
- Typescript (v4.3.5 or higher)
- Node.js (v14.17.0 or higher)
- NPM (v6.14.13 or higher)
- electron-forch (v6.0.0-beta.57 or higher)
- SASS (v1.32.13 or higher)
- Get api key from geoapify and add it to
config.json
in the static folder - download the latest release
- Run
npm install
to install dependencies - Start the server with
npm start
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
Here is an example of how to do this in python:
import requests
requests.post("http://localhost:3000/m=Hallo%20this%20is%20a%20test&h=Test&t=box")
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
Here is an example of how to do this in javascript:
fetch("http://localhost:3000/m=Hallo%20this%20is%20a%20test&h=Test&t=box")
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
URL url = new URL("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box");
request.Method = "POST";
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
#include <iostream>
#include <string>
#include <curl/curl.h>
int main() {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
<?php
$url = "http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
use reqwest::blocking::Client;
fn main() {
let client = Client::new();
let res = client.post("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box").send().unwrap();
println!("{:?}", res);
}
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
package main
import (
"fmt"
"net/http"
)
func main() {
resp, err := http.Post("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box")
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println(resp)
}
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
require 'net/http'
url = URI.parse("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box")
req = Net::HTTP::Post.new(url.to_s)
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
puts res.body
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
import Foundation
let url = URL(string: "http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box")!
let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data, error == nil else {
print(error?.localizedDescription ?? "No data")
return
}
let responseJSON = try? JSONSerialization.jsonObject(with: data, options: [])
if let responseJSON = responseJSON as? [String: Any] {
print(responseJSON)
}
}
task.resume()
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL
fun main(args: Array<String>) {
val url = URL("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box")
val con = url.openConnection() as HttpURLConnection
con.requestMethod = "POST"
val responseCode = con.responseCode
println("POST Response Code :: $responseCode")
if (responseCode == HttpURLConnection.HTTP_OK) { // success
val `in` = BufferedReader(InputStreamReader(con.inputStream))
var inputLine: String?
val response = StringBuffer()
while (`in`.readLine().also { inputLine = it } != null) {
response.append(inputLine)
}
`in`.close()
// print result
println(response.toString())
} else {
println("POST request not worked")
}
}
To call the api, you need to send a post request to the server with the following parameters:
- &m=MESSAGE
- &h=TITLE (optional)
- &t=TYPE
import 'dart:io';
void main() async {
var httpClient = new HttpClient();
var request = await httpClient.getUrl(Uri.parse("http://localhost:3000/m=Yallo%20this%20is%20a%20test&h=Test&t=box"));
var response = await request.close();
if (response.statusCode == HttpStatus.OK) {
var json = await response.transform(UTF8.decoder).join();
print(json);
} else {
print("Error getting IP address:\nHttp status ${response.statusCode}");
}
httpClient.close();
}
To setup the notification service for Home Assistant, you need to add the following to your configuration.yaml file:
rest_command:
notify_box:
url: "http://HOST_IP:3000/m={{mes}}&h={{tit}}&t=box"
notify_img:
url: "http://HOST_IP:3000/m={{mes}}&h={{tit}}&i={{img}}&t=img"
notify_map:
url: "http://HOST_IP:3000/m={{mes}}&h={{tit}}&la={{lat}}&lo={{lon}}&t=map"
service: rest_command.notify_box
data:
mes: MESSAGE
tit: TITLE
There are a few other types of notifications you can send: (default is box)
- &t=box
- &t=img
- &t=map
This is the default notification type. It is a simple box with a title and a message.
This notification type is a box with a title and a message, but it also has an image. To use this type, you need to add the following parameter: You can also use a gif as an image.
- &i=IMAGE_URL
This notification type is a box with a title and a message, but it also has a map. To use this type, you need to add the following parameter:
- &la=LATITUDE (Use a dot for decimals)
- &lo=LONGITUDE (Use a dot for decimals)
fetch("http://localhost:3000/m=Hallo%20this%20is%20a%20test&h=Test&t=box")
fetch("http://localhost:3000/m=Hallo%20this%20is%20a%20test&h=Test&t=img&i=https://media.tenor.com/VFFJ8Ei3C2IAAAAd/rickroll-rick.gif")
fetch("http://localhost:3000/m=Hallo%20this%20is%20a%20test&h=Test&t=map&la=52.370216&lo=4.895168")
- Added support for Home Assistant
- Add more notification types
- Add a customization options
- Add more languages
- Add more examples
- Add more documentation
- Add a web interface to send notifications from a browser (maybe)
- Add a web interface to customize the notifications (maybe)
- Dron3flyv3r
- And you, for using this project! :)
If you like this project, you can donate to me via PayPal or Ko-Fi.