Giter VIP home page Giter VIP logo

tonytromp / ifft-webhooks Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 16 KB

ifft-webhooks is a simple webserver to execute pre-defined shell commands over the web via a reverse-tcp connection (using NGROK). This eliminates the need for port-forwarding or opening up your firewall. Packages are pre-made for HifiberryOS and you can easily extend your own.

JavaScript 76.22% Shell 14.45% Dockerfile 9.34%
ifft docker alexa ngrok hifiberry home-assistant home

ifft-webhooks's Introduction

ifft-webhooks

ifft-webhooks is a simple webserver and ngrok package to execute pre-defined commands over the web. This simple yet powerfull system, lets you control any device (laptop, server) remotely using Alexa or other home automation systems.

Using NGROK as reverse system for connections, you don't have to configure any port forwarding rules in your firewall. On start-up a random URL is generated which you can use to configure your IFFT webhooks.

docker-[systems]

These are dockerized containers which have been pre-configured to expose webhooks for a certain software platform.

example config (from docker-hifiberry)


version: '2.2'
services:
  ifft-webhooks:
    image: edgecrush3r/ifft-hifiberry
    network_mode: bridge
    environment:
      - "IFFT_PORT=3690"
      - "IFFT_VAR_SERVER_ADDRESS=10.0.1.9"
      - "IFFT_SHARED_SECRET=@x102mLY)_!"
      # IFFT_CMD_<YOUR_TRIGGER_NAME>="<YOUR_CMD_HERE>"
      - "IFFT_CMD_PLAY=curl -v -X POST -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/play"
      - "IFFT_CMD_STOP=curl -v -X POST -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/stop"
      - "IFFT_CMD_NEXT=curl -v -X POST -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/next"
      - "IFFT_CMD_PREVIOUS=curl -v -X POST -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/previous"
      - "IFFT_CMD_PAUSE=curl -v -X POST -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/pause"
      - "IFFT_CMD_STATUS=curl -v -X GET -H 'Content-Type: application/json' http://[SERVER_ADDRESS]:81/api/player/status"
      - "IFFT_CMD_VOLUME_DOWN=curl -v -X POST -H 'Content-Type: application/json' -d '{\"percent\":\"-5\"}' http://[SERVER_ADDRESS]:81/api/volume"
      - "IFFT_CMD_VOLUME_UP=curl -v -X POST -H 'Content-Type: application/json' -d '{\"percent\":\"+5\"}' http://[SERVER_ADDRESS]:81/api/volume"
    dns:
      - 8.8.8.8

Using it

  1. Build the docker container of choice (cd and run the build script
cd docker-hifiberry
./build_docker.sh
  1. Edit the docker-compose file and change custom variables like 'IFFT_VAR_SERVER_ADDRESS' and 'IFFT_SHARED_SECRET'
  2. Run the docker-container
  docker-compose up -d
  1. check the logs for the generated webhooks
  docker logs docker-hifiberry_ifft-webhooks_1

This will show something like:

IFFT Webhooks running on port: 3690
IFFT_SHARED_SECRET: @x102mLY)_!

Predifine your own webhook commands in bash/shell using environment variables
	export IFFT_CMD_<YOUR_TRIGGER_NAME>="<YOUR_CMD_HERE>"

Available Webhooks:"
	https://c4be7765d692.ngrok.io/ifft/PREVIOUS?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/STOP?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/STATUS?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/PAUSE?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/VOLUME_DOWN?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/VOLUME_UP?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/NEXT?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/PLAY?shared_secret=@x102mLY)_!
	https://c4be7765d692.ngrok.io/ifft/WEBHOOK_TEST?shared_secret=@x102mLY)_!
  1. Go to IFFT.com and add the Available Webhooks to your favorite triggers (Alexa, Google etc)

** Note that the URL will be changed everytime the docker container is (re)-launched.

ifft-webhooks's People

Contributors

tonytromp 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.