{"id":16682544,"url":"https://github.com/awernick/triggo","last_synced_at":"2026-04-14T00:31:45.863Z","repository":{"id":83818411,"uuid":"262645553","full_name":"awernick/triggo","owner":"awernick","description":"Smol service to support IFTTT delayed triggers","archived":false,"fork":false,"pushed_at":"2020-05-19T00:36:35.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-22T03:34:43.678Z","etag":null,"topics":["golang","ifttt","iot","nlp","redis"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awernick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-09T19:38:56.000Z","updated_at":"2024-06-19T11:08:55.478Z","dependencies_parsed_at":null,"dependency_job_id":"e4f4fb1d-ed80-4fcf-adeb-16eb1c0a4357","html_url":"https://github.com/awernick/triggo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awernick/triggo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awernick%2Ftriggo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awernick%2Ftriggo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awernick%2Ftriggo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awernick%2Ftriggo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awernick","download_url":"https://codeload.github.com/awernick/triggo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awernick%2Ftriggo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31776888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T00:11:49.126Z","status":"ssl_error","status_checked_at":"2026-04-14T00:10:29.837Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["golang","ifttt","iot","nlp","redis"],"created_at":"2024-10-12T14:07:52.181Z","updated_at":"2026-04-14T00:31:45.833Z","avatar_url":"https://github.com/awernick.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Triggo - Delayed timer trigger for IFTTT\n\nTriggo allows you to setup delayed actions in IFTTT through Webhook actions.\n\nCurrently, Triggo is primarily used to delay actions incoming from a Google Assistant applet in IFTTT.\n\nMy main goal was to have the ability to execute commands such as:\n\n* Hey Google, turn off the TV in 30 minutes\n* Google, turn on the kitchen light in 5 minutes\n* etc..\n\n## Usage\n\nTriggo has two modes: server mode and worker mode.\n\nBoth modes require a valid running Redis instance to enqueue and dequeue background jobs. To connect Triggo to the Redis instance:\n\n* provide a URL through the `-redis-url` flag \n* set a `REDIS_URL` environment variable\n\n## Server Mode\n\nThe web server mode is used to accept POST requests incoming from IFTTT webhooks.\nWhen a valid request has been received, Triggo will queue a background job to execute after the delay specified in the request body.\n\n#### Routes:\n```\nPOST /create\n\n# Creates and schedules an event ({trigger_type}_{device}) to be executed after the given delay\n\nRequest Body:\n{\n  \"device\": \"Bedroom TV\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\n```\n\n## Worker Mode\n\nThe background worker mode is in charge of firing off a webhook event back to IFTTT after a request's delay has expired.\n\nTo start Triggo in background mode, set the `-worker=true` flag. \n\nYou will also need to provide a valid IFTTT API URL and IFTTT API Key.   \n\nYou have two ways of doing this:\n* Using the `-ifttt-api-key` and `-ifttt-api-url` flags\n* Setting the `IFTTT_API_KEY` and `IFTTT_API_URL` variables in your environment.\n\n#### POSTing to IFTTT\n\nTriggo will POST event payloads to IFTTT using the API URL and API Key provided.  \n\nFor example, given an initial IFTTT request was received (by Triggo in server mode) with the following data:\n\n```\n{\n  \"device\": \"Bedroom TV\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\n```\n\nTriggo (worker mode) will send the following request to IFTTT after the delay (30 mins):\n\n```\nPOST https://{IFTTT_API_URL}/trigger/{trigger_type}_{device}/with/key/{IFTTT_API_KEY}\n\nResponse (from IFTTT):\n\nCongratulations! You've fired the {trigger_type}_{device} event\n```\n\n#### IFTTT Event Name / Key\nFrom the previous example, we are sending IFTTT an event name in the following format:\n\n```\n{trigger_type}_{device} # This data was received from the initial IFTTT webhook\n```\n\nIn a perfect world, this would be sufficient to be able to execute X command in Y device. Unfortunately, the Google Assistant will sometimes pick up extra words as part of applet command. \n\nE.g When saying \"turn off the kitchen lights in 30 minutes\", the following payload is generated:\n```\n{\n  \"device\": \"the kitchen lights\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\n```\n\nAs you can see, an extra 'the' was appended to the device name. Once our trigger was scheduled and ready to go back to IFTTT, the event name would be `turn_off_the_kitchen_lights`. \n\nIn order to keep things normalized, Triggo does the following preprocessing of the device name before scheduling a trigger:\n\n1. removes all words that are not nouns (using [prose](https://github.com/jdkato/prose)) from the device name. E.g will remove words such as `a, an, and, the, my, etc..`\n2. remap using mappings.yaml e.g. the lights =\u003e bedroom_lamp\n3. singularize device name e.g. bedroom lights =\u003e bedroom light, lamps =\u003e lamp, etc...\n4. convert to underscore_case e.g. Bedroom TV =\u003e bedroom_tv\n\nOnce the device name has been normalized, the trigger will be scheduled and sent to IFTTT once the delay has passed.\n\nGoing back to the previous example, given the following incoming request:\n\n```\n{\n  \"device\": \"the kitchen lights\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\n```\n\nTriggo will preprocess `the kitchen lights` into 'kitchen_light' and schedule the event `turn_off_kitchen_light` to be sent to IFTTT in 30 minutes.\n\n#### Supported Device Mappings\n\nTriggo supports mapping humanized device names to a standardized normalized device name to ensure the correct event type gets sent to IFTTT.\n\nGiven the following mappings.yaml:\n\n```\ntv: bedroom_tv\nlight: bedroom_lamp\nlamp: bedroom_lamp\nmy_light: bedroom_lamp\nkitchen_bulb: kitchen_light\n```\n\nTriggo will be able to convert the following requests:\n\n```\n1. Trigger Request:\n{\n  \"device\": \"tv\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\nMaps To Event =\u003e \"turn_off_bedroom_tv\"\n\n\n2. Trigger Request:\n{\n  \"device\": \"light\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\nMaps To Event =\u003e \"turn_off_bedroom_lamp\"\n\n\n3. Trigger Request:\n{\n  \"device\": \"my_light\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_off\"\n  \"secret_key\": \"yoursecretkey\"\n}\nMaps To Event =\u003e \"turn_off_bedroom_lamp\"\n\n\n4. Trigger Request:\n{\n  \"device\": \"kitchen_bulb\",\n  \"delay_mins: \"30\",\n  \"trigger_type\": \"turn_on\"\n  \"secret_key\": \"yoursecretkey\"\n}\nMaps To Event =\u003e \"turn_on_kitchen_light\"\n```\n\n\n## Configuration\n\nTriggo supports the following flag / configuration values:\n\n```\n▶ ./triggo -h\nUsage of ./triggo:\n\n-ifttt-api-key string\n      API Key for IFTTT [required for worker]\n-ifttt-api-url string\n      API URL for IFTTT [required for worker]\n-namespace string\n      namespace used for redis work queues. Defaults to program name (arg[0]). (default \"triggo\")\n-port string\n      port used to listen for incoming http requests [required for server]\n-redis-url string\n      url of Redis instance [required]\n-secret-key string\n      key used to authenticate requests\n-worker\n      run as background worker node\n\n``` \n\n## Deployment\n\nYou can deploy Triggo to any server that has the golang runtime \u003e= 1.12. \n\nTo get Triggo running, please make sure you have a Triggo instance running in server mode (to accept incoming IFTTT requests) and another in worker mode (to send requests to IFTTT)\n\nI personally used [Dokku](http://dokku.viewdocs.io/dokku/) to deploy my personal Triggo instance. I supplied a very basic Procfile that can be used for dokku / herokuish / heroku. \n\nIf deploying to a heroku-like PaaS, make sure you have at least one worker process scaled in your server / dyno:\n```\n(heroku|dokku) ps:scale worker=1\n```\n\n## IFTTT Setup\n\nIn my IFTTT account, I setup the following applet to send requests to Triggo:\n\n```\nAPPLET NAME: \n\nIf You say \"Turn off the $ in # minutes\", then Make a web request\n\n\nIF THIS: \n\n[Google Assistant] Say a phrase with both a number and a text ingredient \n\n* What do you want to say?: Turn off the $ in # minutes \n* What's another way to say it?: Stop the $ in # minutes\n* And another way?: Turn off $ in # minutes\n\nTHEN THAT: \n\n[Webhooks] Make a web request\n\n* URL: {{TRIGGO URL}}\n* Method: POST\n* Content Type: application/json\n* Body: { \n  \"device\": \"{{TextField}}\", \n  \"delay_mins\": \"{{NumberField}}\", \n  \"created_time_str\": \"{{CreatedAt}}\", \n  \"trigger_type\": \"turn_off\", \n  \"secret_key\": \"yoursecretkey\" \n}\n```\n\nTo receive Triggo events, I also have several IFTTT applets of the following format:\n\n```\n# Example. YMMV depending on which IoT devices you have in your house\n\nAPPLET NAME:\n\nIf Maker Event \"turn_off_bedroom_lamp\", then turn off Bedroom Lamp\n\nIF THIS:\n\n[Webhooks] Receive a web request\n\n* Event Name: 'turn_off_bedroom_lamp'\n\n\nTHEN THAT:\n\n[Wemo] Turn off \n\n* Which switch?: Bedroom Lamp\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawernick%2Ftriggo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawernick%2Ftriggo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawernick%2Ftriggo/lists"}