{"id":103,"date":"2018-01-28T21:58:22","date_gmt":"2018-01-29T03:58:22","guid":{"rendered":"http:\/\/varunpramanik.com\/chronicles\/?p=103"},"modified":"2018-01-28T22:47:13","modified_gmt":"2018-01-29T04:47:13","slug":"how-i-created-a-robot-researcher-with-zapier-evernote-and-duckduckgo","status":"publish","type":"post","link":"https:\/\/varunpramanik.com\/chronicles\/2018\/01\/28\/how-i-created-a-robot-researcher-with-zapier-evernote-and-duckduckgo\/","title":{"rendered":"How I Created A Robot Researcher With Zapier, Evernote and DuckDuckGo"},"content":{"rendered":"<p>An idea I\u2019ve been noodling for quite some time (going back several years to my junior year at <a href=\"http:\/\/www.tcu.edu\">TCU<\/a>) is a tool that automatically researches topics in the background for you. One such tool existed for a brief period of time, <a href=\"https:\/\/thenextweb.com\/apps\/2012\/06\/15\/dunno-for-mac-and-ios-will-change-the-way-that-you-take-notes-forever\/\">Dunno<\/a>, but the company now appears defunct.<\/p>\n<p>Earlier today, I decided to take a stab at setting up a complex multi-step zap in <a href=\"https:\/\/zapier.com\/\">Zapier<\/a> that would tie into <a href=\"https:\/\/www.evernote.com\">Evernote<\/a> to pull the subject and post the result. I figured <a href=\"https:\/\/duckduckgo.com\">DuckDuckGo<\/a> would have some sort of API to access their instant answers and found that <a href=\"https:\/\/duckduckgo.com\/api\">they do indeed<\/a>. Zapier&#8217;s <a href=\"https:\/\/zapier.com\/apps\/code\/integrations\">Code action<\/a> allows you to run Python code, but doesn&#8217;t allow you to import additional libraries. To work around this, I found <a href=\"https:\/\/market.mashape.com\/explore?query=duckduckgo&amp;page=1#zero-click-info\">Mashape<\/a> (listed on DuckDuckGo&#8217;s API page) fully sufficient.<\/p>\n<p>The implementation details are below:<\/p>\n<p><strong>#1: Create a trigger to watch for new notes in a specific Evernote notebook.<\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-104\" src=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?resize=840%2C372\" alt=\"\" width=\"840\" height=\"372\" srcset=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?resize=1024%2C454&amp;ssl=1 1024w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?resize=300%2C133&amp;ssl=1 300w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?resize=768%2C341&amp;ssl=1 768w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?resize=1200%2C532&amp;ssl=1 1200w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.26.52-PM.png?w=1556&amp;ssl=1 1556w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p><strong>#2: [Optional] Create a filter to only proceed with notes bearing a specific tag.<\/strong> You can skip this if you want the zap to run with any new note added to a certain notebook.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-105\" src=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?resize=840%2C459\" alt=\"\" width=\"840\" height=\"459\" srcset=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?resize=1024%2C560&amp;ssl=1 1024w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?resize=300%2C164&amp;ssl=1 300w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?resize=768%2C420&amp;ssl=1 768w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?resize=1200%2C656&amp;ssl=1 1200w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.37-PM.png?w=1552&amp;ssl=1 1552w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p><strong>#3: Create a code action to fetch the DuckDuckGo results as JSON. <\/strong>I used Python. Sample code below.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-106\" src=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?resize=840%2C695\" alt=\"\" width=\"840\" height=\"695\" srcset=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?resize=1024%2C847&amp;ssl=1 1024w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?resize=300%2C248&amp;ssl=1 300w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?resize=768%2C635&amp;ssl=1 768w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?resize=1200%2C993&amp;ssl=1 1200w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.27.59-PM.png?w=1552&amp;ssl=1 1552w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<div style=\"font-family: monospace;\">\n<p>query = input_data[&#8220;note&#8221;].replace(&#8221; &#8220;,&#8221;+&#8221;)<\/p>\n<p>request_url = &#8220;https:\/\/duckduckgo-duckduckgo-zero-click-info.p.mashape.com\/?format=json&amp;no_html=1&amp;no_redirect=1&amp;q=&#8221; + query + &#8220;&amp;skip_disambig=1&#8221;<\/p>\n<p>response = requests.get(request_url,<br \/>\nheaders={<br \/>\n&#8220;X-Mashape-Key&#8221;: &#8220;YOUR_KEY&#8221;,<br \/>\n&#8220;Accept&#8221;: &#8220;application\/json&#8221;<br \/>\n}<br \/>\n)<\/p>\n<p>output = response.json()<\/p>\n<\/div>\n<p><strong>#4: [Optional] Create a code action to compile a link to launch a DuckDuckGo search for your topic.<\/strong> 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.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-107\" src=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?resize=840%2C529\" alt=\"\" width=\"840\" height=\"529\" srcset=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?resize=1024%2C645&amp;ssl=1 1024w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?resize=300%2C189&amp;ssl=1 300w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?resize=768%2C484&amp;ssl=1 768w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?resize=1200%2C756&amp;ssl=1 1200w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.14-PM.png?w=1552&amp;ssl=1 1552w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<div style=\"font-family: monospace;\">\n<p>query = input_data[&#8220;note&#8221;].replace(&#8221; &#8220;,&#8221;+&#8221;)compiled_link = &#8220;https:\/\/duckduckgo.com\/?q=&#8221; + query<\/p>\n<p>output = [{&#8216;search_link&#8217;: compiled_link}]<\/p>\n<\/div>\n<p><strong>#5: Create an action to append the results to your note (or create a new note with the results).<\/strong><\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-108\" src=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=840%2C842\" alt=\"\" width=\"840\" height=\"842\" srcset=\"https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=1021%2C1024&amp;ssl=1 1021w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=768%2C770&amp;ssl=1 768w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?resize=1200%2C1203&amp;ssl=1 1200w, https:\/\/i0.wp.com\/varunpramanik.com\/chronicles\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-28-at-9.29.58-PM.png?w=1556&amp;ssl=1 1556w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>I\u2019m aiming to create a similar task using the <a href=\"https:\/\/zapier.com\/apps\/email-parser\/integrations\">Email Parser trigger<\/a> to let me email topics to my automated researcher and have it save its results to a new Evernote note.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An idea I\u2019ve 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 &hellip; <a href=\"https:\/\/varunpramanik.com\/chronicles\/2018\/01\/28\/how-i-created-a-robot-researcher-with-zapier-evernote-and-duckduckgo\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How I Created A Robot Researcher With Zapier, Evernote and DuckDuckGo&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[31,15,34],"tags":[40,37,36,38,6,39,35],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-automation","category-code","category-zapier","tag-automation","tag-duckduckgo","tag-evernote","tag-notes","tag-python","tag-research","tag-zapier"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7tP59-1F","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":3,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/posts\/103\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/varunpramanik.com\/chronicles\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}