tttfi

Middleware for IFTTT.

  • 所有者: kamikat/tttfi
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

TTTFI

npm

Middleware for IFTTT.

Usage

TTTFI picks up data from IFTTT webhook, pass data through scripts and send output of script back to IFTTT.

STEP1 Prepare scripts:

Let's write a simple hello world in shell (you can find that in samples folder).

#!/bin/sh

# Read body from stdin
read NAME

# Print response to IFTTT
cat << EOF
{"value1": "Hello, $NAME!"}
EOF

STEP2 Run docker image:

docker run -e API_KEY=<your-ifttt-key> \
           -e SECRET_TOKEN=<secret-token> \
           -v `pwd`/samples:/opt/bin \
           -p 3001:3001 \
           --name tttfi \
           kamikat/tttfi

NOTE: Pick up a random string as your SECRET_TOKEN.

STEP3 Setup trigger:

  1. Create a webhook trigger https://ifttt.com/create/if-maker_webhooks?sid=1
  2. Set Event Name to hello (name of the script)
  3. Choose any action service
  4. Click Add ingredient and select Value1 on any field of the service that supports it

Test your configuration by sending some data using curl

echo 'world', curl -XPOST -d- https://your-domain.com/hello/secret/<secret-token>

STEP4 Setup action:

  1. Create trigger with any service https://ifttt.com/create (Telegram for example)
  2. Choose Webhooks service to create an action
  3. Set the url (for example https://your-domain.com/hello/secret/<secret-token>)
  4. Set Method to POST and Content Type to text/plain (the hello event requires simple text)
  5. Add any ingredient to body

Scripting with Python/Perl/Go...

Scripts written in python or other platform can failed to start because they're not installed in container.

Add required package after start the container:

docker exec tttfi apk --no-cache add <package-name>

Or run tttfi natively (see next section)

Native server

TTTFI can run natively on *nix with ES6 compatible Node.js.

npm install -g tttfi

Run TTTFI:

PATH=<path-to-scripts>:$PATH API_KEY=<your-ifttt-key> SECRET_TOKEN=<secret-token> tttfi

Be careful that it executes ANYTHING in your $PATH with correct secret token.

License

(The MIT License)

主要指標

概覽
名稱與所有者kamikat/tttfi
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證
所有者活动
創建於2017-07-17 15:44:12
推送於2017-07-18 01:23:16
最后一次提交2017-07-18 08:57:38
發布數2
最新版本名稱1.0.0 (發布於 )
第一版名稱1.0.0-py2 (發布於 )
用户参与
星數349
關注者數8
派生數15
提交數15
已啟用問題?
問題數1
打開的問題數0
拉請求數0
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?