tttfi

1.0.0 • Public • Published

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 Python (you can find that in samples folder).

#!/usr/bin/env python2 
import json
 
# Read body from stdin 
name = raw_input()
 
# IFTTT supports up to 3 values (value1, value2, value3) 
print json.dumps({ "value1": "Hello, %s!" % name })

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 \
           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

License

(The MIT License)

Package Sidebar

Install

npm i tttfi

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kamikat