Giter Club home page Giter Club logo

notify's Introduction

Notify

Simple Rust app that will send POST requests to an IFTTT webhook.
This will then can create other events/notifications on a smart phone.
Notifications can be configured/scheduled from a JSON or can be manually triggered via an API request.

To use, open notify.toml and update the webhook key (See IFTTT config below).
Then just run/build the project using cargo cargo run --release (Or use docker/docker-compose).
Note: I will be uploading binaries soon™ to GitHub.

Scheduled Notifications

To create repeating scheduled notifications, update the JSON file data/notifications.json (See below for an example). Scheduled notifications can be disabled via the config in notify.toml.

[
  {
    "title": "Sample Notification 1",
    "content": "Some message",
    "cron": "*/1 * * * *",
    "enabled": false
  },
  {
    "title": "Sample Notification 2",
    "content": "Some message 2 with an image!",
    "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/368px-Google_2015_logo.svg.png",
    "cron": "*/7 10 * * *",
    "enabled": false
  }
]

JSON attributes

  • title = The title of the notification received on the IFTTT mobile app
  • content = The content of the notification received on the IFTTT mobile app
  • image = The url of an image to include in the notification received. This is optional
  • cron = The cron expression for when the notification will run (must be 5 fields long, starting at minutes)
  • enabled = Disable/enable a notification from being sent. requires restart if changed

Web Server (API)

Notify will host a web server that can receive http requests. Web server can be configured (including disabled) within the config notify.toml.

Endpoint Method Description Response
/notification POST Accepts incoming notification JSON and sends API request to IFTTT. 204: No Content (Success)
400: JSON object containing error and timestamp
/health GET Returns health and uptime of the service. 200: JSON object containing uptime

Web JSON

Body of POST request should be like this:

{
    "title":"Title of notification",
    "content":"Content of notification"
}
  • title = The title of the notification received on the IFTTT mobile app
  • content = The content of the notification received on the IFTTT mobile app
  • image = The url of an image to include in the notification received. This is optional

Docker Compose

The service is best ran using a docker-compose file. Use the sample provided:

version: '3.3'

services:
  notify:
    container_name: notify
    image: coombszy/notify:latest
    volumes:
      - ./config:/app/config
      - ./data:/app/data

Volume mounts

  • /app/config = Folder to store the notify.toml for the service
  • /app/data = Folder to store notifications JSON

IFTTT

Currently, you cannot publish an IFTTT applet if it uses the webhook functionality. So i've included instructions on how to make the services yourself:

  1. Create a new applet with the following 'If This' and 'Then That'
  1. The 'If This' should be configured as so
  1. And the 'Then That' should be configured like this
  1. Finally you will need to get your Webhooks key from the Webhooks Service FAQ. Insert this API key into the notify.toml config file for the ifttt_key.

  2. If you chose a different event name in step 2, change notify.toml variable ifttt_event to the value you set.

Legacy

If you are looking for the legacy version, it can been found here. And the update notes can be found here.

Links

Some useful links

notify's People

Contributors

coombszy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.