Here is how I got a widget/button on Android home screen that quickly adds an item to my Dynalist inbox. It uses Tasker, an Android automation tool.
-
In Tasker, add my “Capture to Dynalist Inbox” task from TaskerNet (direct link)
-
Edit the task to enter your Dynalist API token where indicated. You can find your token at https://dynalist.io/developer
-
Add a widget to your home screen: Tasker -> Task Shortcut -> Capture to Dynalist Inbox
The widget may not always work, especially if your item has exotic characters, because I don’t know how to properly escape special characters in the input before sending to the API. I have tried to handle backslashes and quotes correctly, though.
Here is the task description in case you are interested:
Task: Capture To Dynalist Inbox
<Enter your API token here:>
A1: Variable Set [
Name: %dynalist_api_token
To: None
Max Rounding Digits: 3
Structure Output (JSON, etc): On ]
A2: Popup [
Text: You must first edit this task to enter your Dynalist API token
Layout: Popup
Timeout (Seconds): 600
Show Over Keyguard: On ]
If [ %dynalist_api_token ~ None ]
A3: Stop [
With Error: On ]
If [ %dynalist_api_token ~ None ]
A4: Input Dialog [
Title: Capture to Dynalist inbox
Close After (Seconds): 30
Pre-Select Input: On ]
<Escape backslashes>
A5: Variable Search Replace [
Variable: %input
Search: \\
Replace Matches: On
Replace With: \\\\ ]
<Escape quotes>
A6: Variable Search Replace [
Variable: %input
Search: "
Replace Matches: On
Replace With: \\" ]
A7: HTTP Request [
Method: POST
URL: https://dynalist.io/api/v1/inbox/add
Headers: Content-type:application/json
Body: {
"token": "%dynalist_api_token",
"index": -1,
"content": "%input",
"note": ""
}
Timeout (Seconds): 30
Structure Output (JSON, etc): On
Continue Task After Error:On ]
<Debug>
A8: [X] Popup [
Title: Debug
Text: %input
%http_data
Layout: Popup
Timeout (Seconds): 5
Show Over Keyguard: On ]
A9: Popup [
Title: Error Adding To Dynalist
Text: Received response code: %http_data._code
Layout: Popup
Timeout (Seconds): 5
Show Over Keyguard: On ]
If [ %http_data._code !~ Ok ]
A10: Flash [
Text: Successfully added to Dynalist!
Continue Task Immediately: On
Dismiss On Click: On ]
If [ %http_data._code ~ Ok ]