{"id":13499250,"url":"https://github.com/ElementsProject/ifpaytt","last_synced_at":"2025-03-29T04:30:55.196Z","repository":{"id":57271520,"uuid":"124724198","full_name":"ElementsProject/ifpaytt","owner":"ElementsProject","description":"If Pay Then That :zap: Trigger IFTTT actions with Bitcoin Lightning payments","archived":false,"fork":false,"pushed_at":"2021-09-20T13:04:36.000Z","size":50,"stargazers_count":56,"open_issues_count":1,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-24T15:57:36.504Z","etag":null,"topics":["bitcoin","ifttt","ifttt-maker","lightning","lightning-charge","micropayments","nanopayments"],"latest_commit_sha":null,"homepage":"https://blockstream.com/2018/03/27/ifpaytt-brings-lightning-micropayments-to-ifttt.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ElementsProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-11T04:50:17.000Z","updated_at":"2024-07-28T20:03:17.000Z","dependencies_parsed_at":"2022-09-09T02:22:21.832Z","dependency_job_id":null,"html_url":"https://github.com/ElementsProject/ifpaytt","commit_stats":null,"previous_names":["shesek/ifpaytt"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementsProject%2Fifpaytt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementsProject%2Fifpaytt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementsProject%2Fifpaytt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ElementsProject%2Fifpaytt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ElementsProject","download_url":"https://codeload.github.com/ElementsProject/ifpaytt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122251,"owners_count":20726822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","ifttt","ifttt-maker","lightning","lightning-charge","micropayments","nanopayments"],"created_at":"2024-07-31T22:00:31.427Z","updated_at":"2025-03-29T04:30:54.944Z","avatar_url":"https://github.com/ElementsProject.png","language":"JavaScript","readme":"# If Pay Then That\n\n[![npm release](https://img.shields.io/npm/v/ifpaytt.svg)](https://www.npmjs.com/package/ifpaytt)\n[![MIT license](https://img.shields.io/github/license/ElementsProject/ifpaytt.svg)](https://github.com/ElementsProject/ifpaytt/blob/master/LICENSE)\n[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n[![IRC](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://webchat.freenode.net/?channels=lightning-charge)\n\nUse Bitcoin Lightning payments as the _trigger_ for IFTTT (If This Then That) _actions_.\n\nPowered by :zap: [Lightning Charge](https://github.com/ElementsProject/lightning-charge) and [paypercall](https://github.com/ElementsProject/paypercall).\n\n## Install\n\n```bash\n$ npm install -g ifpaytt\n```\n\n## Setup\n\nSetup [Lightning Charge](https://github.com/ElementsProject/lightning-charge), then:\n\n1. Get your IFTTT maker key from [IFTTT's Webhook settings page](https://ifttt.com/services/maker_webhooks/settings)\n   (shown as `https://maker.ifttt.com/use/[MAKER-KEY-HERE]`).\n\n2. Open the [new applet page](https://ifttt.com/create), click \"this\", enter \"Webhooks\", click \"Receive a web request\",\n   enter a descriptive event name prefixed by `ifpaytt_` containing only numbers, lowercase letters and `_`\n   (e.g. `ifpaytt_lightup_room404` or `ifpaytt_vend_machine137_item56`),\n   and click \"Create Trigger\".\n\n3. Configure your \"then\" action and finish creating the IFTTT applet.\n\n4. Start the `ifpaytt` server:\n\n   ```bash\n   $ ifpaytt --charge-token [mySecretToken] --ifttt-key [myMakerKey] --currency BTC \\\n             --price-lightup_room404 0.00001 --price-vend_machine137_item56 0.000063\n\n   Running on http://localhost:6000\n   ```\n\nThat's it! The server is now ready to accept payments and trigger IFTTT actions.\n\n## Paying to trigger actions\n\nUsers can access the IFTTT action through a three-part process:\n\n1. Send an empty `POST` request to `/{event-name}` to get the BOLT11 payment request and the `X-Token` header:\n\n    ```bash\n    $ curl -i -X POST http://localhost:6000/lightup_room404\n\n    HTTP/1.1 402 Payment Required\n    X-Token: lmbdmJeoSQ0ZCB5egtnph.af1eupleFBVuhN2vrbRuDLTlsnnUPYRzDWdL5HtWykY\n    Content-Type: application/vnd.lightning.bolt11\n\n    lnbcrt8925560p1pdfh7n2pp54g5avyupe70l988h30u0hy8agpj2z7qsveu7ejhys97j98rgez0...\n    ```\n\n2. Make the payment:\n\n    ```bash\n    $ lightning-cli pay lnbcrt8925560p1pdfh7n2pp54g5avyupe70l988h30u0hy8agpj2z7qsveu7ejhys97j98rgez0...\n    ```\n\n3. Send the request again, this time with the `X-Token` header echoed back and optionally\n   with `value1`, `value2` and `value3` in the request body (passed along to IFTTT):\n\n    ```bash\n    $ curl -i -X POST http://localhost:6000/lightup_room404 \\\n      -H 'X-Token: lmbdmJeoSQ0ZCB5egtnph.af1eupleFBVuhN2vrbRuDLTlsnnUPYRzDWdL5HtWykY' \\\n      -d value1='brightness=80,color=red'\n\n    HTTP/1.1 200 OK\n    Content-Type: text/plain\n\n    Congratulations! You've fired the ifpaytt_lightup_room404 event\n    ```\n\n    (if `value[1-3]` are not set, they'll [automatically be populated](https://github.com/ElementsProject/ifpaytt/blob/master/src/app.js#L40-L42)\n    with some useful information about the payment.)\n\n## CLI options\n\n```bash\n$ ifpaytt --help\n\n  Trigger IFTTT actions with Bitcoin Lightning payments\n\n  Usage\n    $ ifpaytt [options]\n\n  Options\n    -c, --charge-url \u003curl\u003e      lightning charge server url [default: http://localhost:9112]\n    -t, --charge-token \u003ctoken\u003e  lightning charge access token [required]\n    -k, --ifttt-key \u003ckey\u003e       IFTTT maker key (available in https://ifttt.com/services/maker_webhooks/settings) [required]\n    -r, --ifttt-prefix \u003cprefix\u003e prefix for IFTTT event names [default: ifpaytt_]\n\n    -x, --currency \u003cname\u003e       the currency prices are quoted in [default: BTC]\n    --price-{event} \u003cprice\u003e     price to send events of type {event}\n\n    -d, --db-path \u003cpath\u003e        path to store payperclick sqlite database [default: ifpaytt.db]\n    --invoice-expiry \u003csec\u003e      how long should invoices be payable for [default: 1 hour]\n    --access-expiry \u003csec\u003e       how long should paid active tokens remain valid for [default: 1 hour]\n    --token-secret \u003csecret\u003e     secret used for HMAC tokens [default: generated based on {charge-token}]\n\n    -p, --port \u003cport\u003e           http server port [default: 6000]\n    -i, --host \u003chost\u003e           http server listen address [default: 127.0.0.1]\n    -e, --node-env \u003cenv\u003e        nodejs environment mode [default: production]\n    -h, --help                  output usage information\n    -v, --version               output version number\n\n  Example\n    $ ifpaytt -t chargeAccessToken -k iftttMakerKey -x BTC \\\n              --price-lightup_room404 0.00001 --price-vend_machine137_item56 0.00023\n```\n\n## License\nMIT\n","funding_links":[],"categories":["Applications"],"sub_categories":["Misc"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElementsProject%2Fifpaytt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FElementsProject%2Fifpaytt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FElementsProject%2Fifpaytt/lists"}