So I have yet to create the piston, but that should be the easy part… the hard part is todoist and I prefer not go down that particular road without understanding whether I should do this directly through webcore or through webcore and IFTTT. Anyway here goes the simple piston.
If battery < 25%
Then
Add Todoist reminder replace {device_name} battery tonight at 7pm on #home list.
Obviously to add the todoist reminder, I must send data using the todoist web api WHICH I HAVE NEVER DONE BEFORE but seems like a fun challenge.
An example of the code needed to create a task is here:
curl https://todoist.com/api/v7/sync
-d token=0123456789abcdef0123456789abcdef01234567
-d sync_token=“VRyFHr0Qo3Hr–pzINyT6nax4vW7X2YG5RQlw3lB-6eYOPbSZVJepa62EVhO”
-d resource_types=’[“projects”, “items”]’
-d commands=’[
{ “type”: “item_add”,
“temp_id”: “fdef5d16-a40a-475e-bd4a-0ccbd6fd8c3f”,
“uuid”: “a3aa2f44-23b4-4986-b513-ef7663bbb752”,
“args”: { “project_id”: “24a193a7-46f7-4314-b984-27b707bd2331”, “content”: “Task1” } },
{ “type”: “item_add”,
“temp_id”: “6f5e0b50-af7a-4133-bfc0-e8c041b819d2”,
“uuid”: “d16ad84a-e10b-4894-af7d-93ba6adf7a1e”,
“args”: { “project_id”: 176637191, “content”: “Task2” } },
So again my question, is webcore capable of passing this through directly or should I use a web hook?