Giter Club home page Giter Club logo

pushmatrix's Introduction

pushmatrix

Simple selfhosted REST API for sending end to end encrypted push notifications over Matrix protocol, build with matrix-nio.

It allows to send encrypted messages with simple HTTP request, that you can receive in any Matrix client, like Element

curl -X POST 127.0.0.1:8571/message \
   -H 'Content-Type: application/json' \
   -d '{"message":"Low disk space - 1 GB", "title":"system"}'

screenshot screenshot

Usage

Start server

docker run -d \
	--name pushmatrix \
	-p 8571:8571 \
	-e USER_ID="@username:matrix.org" \
	-e PASSWORD="password" \
	-e RECEIPIENTS="@user1:matrix.org @user2:matrix.org @user3:matrix.org" \
	-e ROOM_NAME="pushmatrix" \
	-e APP_TOKEN="QOL4OO73EC1DEXE5A2N4" \
	bonukai/pushmatrix

or with docker compse

# docker-compose.yaml
version: "3.7"
services:
  pushmatrix:
    container_name: pushmatrix
    image: bonukai/pushmatrix
      ports:
        - 8571:8571
      environment:
        USER_ID: "@username:matrix.org"
        PASSWORD: "password"
        RECEIPIENTS: "@user1:matrix.org @user2:matrix.org @user3:matrix.org"
        ROOM_NAME: "pushmatrix"
        APP_TOKEN: "QOL4OO73EC1DEXE5A2N4"
docker-compose up -d

If your homeserver supports registration without email adress and captcha, then you can receive notifications from different users for every title.

docker run -d \
	--name pushmatrix \
	-p 8571:8571 \
	-v ./avatars:/avatars:ro \
	-e USER_ID="@username:matrix.org" \
	-e PASSWORD="password" \
	-e RECEIPIENTS="@user1:matrix.org @user2:matrix.org @user3:matrix.org" \
	-e ROOM_NAME="pushmatrix" \
	-e APP_TOKEN="QOL4OO73EC1DEXE5A2N4" \
	-e NEW_USER_FOR_TITLE="yes" \
	bonukai/pushmatrix

If your server doesn't support registration of new users, but you have access to the command line, you can still use this feature. Calculate the internal user name for the topics you plan to use. In this example for the topic doorbell:

echo -n "doorbell" | base64 
ZG9vcmJlbGw=

The internal username for doorbell will be pushmatrix_ZG9vcmJlbGw=. You can create this user with the same password that you use for the general pushmatrix user. For Synapse the command looks like this:

register_new_matrix_user -u pushmatrix_ZG9vcmJlbGw= -p password -c /data/homeserver.yaml https://matrix.example.org

When you use the topic for the first time, pushmatrix will set a more user-friendly displayname for that user - and also an avatar image if you put an appropriately named image into the avatar/ folder.

Authentication

Access to the API can be limited by providing APP_TOKEN environment variable

API

POST /message

Data constraints

{
  "title": "[title]",
  "messgage": "[message]",
  "token": "[optional app token]"
}

Data example

{
  "title": "System",
  "messgage": "Low disk space",
  "token": "QOL4OO73EC1DEXE5A2N4"
}

Success Response

Code : 200 OK

Content example

Ok

Web interface

There is avalible simple web interface for sending messages screenshot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.