How I Created A Robot Researcher With Zapier, Evernote and DuckDuckGo

An idea I’ve been noodling for quite some time (going back several years to my junior year at TCU) is a tool that automatically researches topics in the background for you. One such tool existed for a brief period of time, Dunno, but the company now appears defunct.

Earlier today, I decided to take a stab at setting up a complex multi-step zap in Zapier that would tie into Evernote to pull the subject and post the result. I figured DuckDuckGo would have some sort of API to access their instant answers and found that they do indeed. Zapier’s Code action allows you to run Python code, but doesn’t allow you to import additional libraries. To work around this, I found Mashape (listed on DuckDuckGo’s API page) fully sufficient.

The implementation details are below:

#1: Create a trigger to watch for new notes in a specific Evernote notebook.

#2: [Optional] Create a filter to only proceed with notes bearing a specific tag. You can skip this if you want the zap to run with any new note added to a certain notebook.

#3: Create a code action to fetch the DuckDuckGo results as JSON. I used Python. Sample code below.

query = input_data[“note”].replace(” “,”+”)

request_url = “https://duckduckgo-duckduckgo-zero-click-info.p.mashape.com/?format=json&no_html=1&no_redirect=1&q=” + query + “&skip_disambig=1”

response = requests.get(request_url,
headers={
“X-Mashape-Key”: “YOUR_KEY”,
“Accept”: “application/json”
}
)

output = response.json()

#4: [Optional] Create a code action to compile a link to launch a DuckDuckGo search for your topic. I create this mostly for convenience; if I wanted to dig further into a topic, I could easily click the generated link. Sample code below.

query = input_data[“note”].replace(” “,”+”)compiled_link = “https://duckduckgo.com/?q=” + query

output = [{‘search_link’: compiled_link}]

#5: Create an action to append the results to your note (or create a new note with the results).

 

I have a long list of topics I am idly interested in. I created this automated researcher to help feed those curiosities. If, after reading the results, the topic continues to pull on my mind I am free to devote my time to researching it deeper. If not, I can just file it away with the result included in case I ever want to look it up again.

I’m aiming to create a similar task using the Email Parser trigger to let me email topics to my automated researcher and have it save its results to a new Evernote note.

Google Cloud Platform OAuth Redirect URI Error Resolution

While working on installing an Apps Script to a Google Sheet, one step in the instructions required me to add the script project’s redirect URI to the list of authorized OAuth URIs in the supporting GCP project. Despite being the owner of the project, GCP refused to save my update to the authorized redirect URIs list, presenting me instead with this super informative error message about not having permission to perform the action:

I scoured the internet for an answer and came up with nothing even close to helpful. At my wit’s end, I decided to give a shot to just creating credentials for a second web application within my GCP project, inputting the necessary redirect URI from my Apps Script project. Lo and behold, this worked and I was successfully able to complete my implementation of the aforementioned script.

The steps are straightforward, but if you do encounter an issue with saving an update to your list of authorized redirect URIs for a web application in GCP, here they are spelled out:

On the “Credentials” page for your GCP project, select Create credentialsOAuth client ID.

Fill out the form to create a new client ID, with “Web application” under Application type, some relevant name and the authorized redirect URI you need to use. Click Create and you will be given a client ID/client secret pair to use as needed.

I hope this post helps shorten your search for a solution if you ever encounter this permissions issue!

Website Updates on iOS

If you follow me on Twitter, you may have noticed a little tweetstorm I had earlier tonight as I made some updates to my website.

While the homepage at varunpramanik.com is a pretty basic and lightweight page, I have a tendency to go a little nuts over the details on it (have a look at the source and stylesheet). I’m therefore happy that I was able to complete every task for the edits to my satisfaction on my iPad.

To start, I saved the logos for each company/service to Photos and then pulled them up in Pixelmator to get the hex codes for their dominant colors using the color picker for the brush tool. I used these hex codes to give the links a sense of character and relevance to their destinations.

I used Drafts as a Slide Over app to drop notes, like the aforementioned hex codes.

I grabbed copies of my website assets from my cloud storage using Documents, sending them to Transmit for management and Coda editor access.

I did the bulk of my code editing in Coda (I made some minor tweaks in Transmit’s built-in barebones text editor). Coda has some great syntax highlighting and preview features, though it has frustrating backspace and cursor movement behaviors.

Finally, I uploaded my assets via FTP to my host using Transmit, whose drag-and-drop uploads and permissions management I absolutely love.

Check out the end result.