Building the IFTTT rules engine
Now that we are sending the required data to the API engine, we will be doing two things:
- Showing data that we got from the smart wearable on the web, desktop, and mobile apps
- Executing rules on top of the data
We will get started with the second objective first. We will be building a rules engine to execute rules based on the data we have received.
Let's get started by creating a folder named ifttt
at the root of the api-engine/server
folder. Inside the ifttt
folder, create a file named rules.json
. Update api-engine/server/ifttt/rules.json
, as follows:
[{ "device": "b8:27:eb:39:92:0d", "rules": [ { "if": { "prop": "fall", "cond": "eq", "valu": 1 }, "then": { "action": "EMAIL", "to": "arvind.ravulavaru@gmail.com" } }] }]
As you can see from the preceding code, we are maintaining a JSON file with all of our rules. In our scenario...