Jump to content
wrjlewis

Notion.so Instant Search Workflow

Recommended Posts

For those who love Notion.so (really great documentation & more tool), you will know how useful it would be to get instant search results from Notion in Alfred. 

 

To that reason I've created a workflow that does exactly that, allowing you to search your Notion.so workspace from Alfred, showing instant results, and the ability to open the browser to your selected page.

 

There are two env variables required (the notion search api isn't documented), these can be obtained by inspecting the network request from a notion search, as documented in github below. 

 

Check it out and download here: https://github.com/wrjlewis/notion-search-alfred-workflow/blob/master/README.md

Share this post


Link to post

This workflow is awesome. I'm going to use it hundreds of times every day.

I had it on my todo to make it myself, but haven't gotten around to it.

Notion is awesome. When the (official) Notion API hits, it's gonna change everything.

 

 

Share this post


Link to post

Hey, would it be much work (I don't know Python!) to add

- in addition to searching with `ns` an operator like `nsall` that returns every "title" from ny Notion items? 

- or searching and returning everything (or just the titles/names!) inside a particular Table?

 

Share this post


Link to post

Just want to say thanks for making this! I rely on notion so heavily that I have my own python scripts (using notion-py) to manipulate my productivity system.

Share this post


Link to post

This is beautiful, @wrjlewis

 

You're amazing!

 

In the readme you mention:

 

Quote

If you prefer using the Mac app of Notion, just replace https://www.notion.so with notion://www.notion.so/ in the workflow script.

 

Please clarify where, or just provide the full script, for simplicity. It isn't quite working for me.

 

Thanks so much!!

Share this post


Link to post
On 2/17/2020 at 5:26 PM, michaelwoodruff said:

I'd recommend adding to Packal. I'd love to see screenshots.

http://www.packal.org

 

I recommend against that. Packal has been a zombie for years. The site is falling apart and is abandoned by the developers, which don’t have time to work on it anymore.

Share this post


Link to post

@wrjlewis Thanks so much for creating this plugin. It's pretty awesome!

@MasterBruce to have the plugin work with desktop version of Notion:

1) you click the Script in Alfred workflow

image.png.bc0cfe4b9ac8013865ead87ea03b414f.png

2) in the Script Field, search for the words (there should be 2 instances)

http://www.notion.so/

3) replace the text with:

notion://www.notion.so/

 

Share this post


Link to post
15 hours ago, possertive said:

I'm not getting any results. Is this still working?

  

 

It's working for me.

1. Bring up Alfred

2. Type "ns " and then your search term.

3. After a small delay, the results populate.

Share this post


Link to post
On 5/6/2020 at 7:17 AM, possertive said:

I'm not getting any results. Is this still working?


Same here!

1. I show up alfred
2. type "ns term"
3. answer always "no results - go to notion homepage" 

What is wrong? 

Share this post


Link to post
2 hours ago, leo said:

3. answer always "no results - go to notion homepage" 
What is wrong? 

 

Probably your Notion.so authentication token has expired.

Create a new token according to documentation and try again. 

Try turning on debugging in the Alfred workflow and see what that outputs.

 

Share this post


Link to post

Really glad people are using this and finding it a good addition to their productivity workflows!

 

If you have any PRs or issues to add to the repo, I'll gladly review.

 

Thanks

Share this post


Link to post

Version 0.2 now out. 

 

Probably the most useful part is that you can toggle use of the desktop client or the web app.

 

+ returns 9 search items from notion to match the number that can be displayed at once in Alfred

+ refactored into a separate python script to allow for easier diffs and version control. Now using the releases feature in GitHub.

+ Option to change the 'isNavigableOnly' search filter via the 'isNavigableOnly' env variable. I personally prefer only to search notion objects that can be navigated to, as I have a large workspace which would clutter the results, but the default search in notion has this option as false, so including this as an env variable.

+ Option to switch support to the notion web app or the notion desktop app using the useDesktopClient env variable.

 

https://github.com/wrjlewis/notion-search-alfred-workflow/releases/latest/download/Notion.Search.alfredworkflow

Share this post


Link to post
On 5/12/2020 at 12:18 PM, wrjlewis said:

 

Have you copied the cookie and spaceid over to the env variables of the workflow?

Can you show me the output of the debug window when you try and search with the debugging view on? https://www.alfredapp.com/help/workflows/advanced/debugger/

 

Yes I did @wrjlewis My cookie starts with __cfduid= but your readme says the cookie starts with notion_browser_id. I tried both ways, also by deleting the __cfduid part so it starts with notion_browser_id and it didn't work.

 

Here's the debug:

[07:50:54.665] Notion Search[Script Filter] Queuing argument 'evernote'
[07:50:54.886] Notion Search[Script Filter] Script with argv '(null)' finished
[07:50:54.897] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last):
  File "notion.py", line 114, in <module>
    buildNotionSearchQueryData(alfredQuery), headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)

 

Share this post


Link to post
35 minutes ago, Yourname said:

 

Yes I did @wrjlewis My cookie starts with __cfduid= but your readme says the cookie starts with notion_browser_id. I tried both ways, also by deleting the __cfduid part so it starts with notion_browser_id and it didn't work.

 

Here's the debug:


[07:50:54.665] Notion Search[Script Filter] Queuing argument 'evernote'
[07:50:54.886] Notion Search[Script Filter] Script with argv '(null)' finished
[07:50:54.897] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last):
  File "notion.py", line 114, in <module>
    buildNotionSearchQueryData(alfredQuery), headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)

 


Looks like an issue with your SSL version. 
Whats the output of this in your terminal? 
python -c "import ssl; print(ssl.OPENSSL_VERSION)"

Share this post


Link to post
Posted (edited)
1 hour ago, wrjlewis said:

python -c "import ssl; print(ssl.OPENSSL_VERSION)"

 

OpenSSL 0.9.8zh 14 Jan 2016

 

Thanks @wrjlewis that seems super old lol, so running a brew update. 

Update: brew didn't seem to update it. So I'll wait for your response.

Edited by Yourname

Share this post


Link to post

It could be a couple of things - but I would suggest trying to update your SSL version first, as you've got a fairly old version.

 

Can you follow the steps in the top answer below?

https://apple.stackexchange.com/questions/126830/how-to-upgrade-openssl-in-os-x

 

If you haven't got 'brew' installed, which can be used to upgrade ssl (and loads of other packages),  it can be done with 

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

 

Share this post


Link to post
On 5/15/2020 at 10:08 AM, wrjlewis said:

It could be a couple of things - but I would suggest trying to update your SSL version first, as you've got a fairly old version.

 

Can you follow the steps in the top answer below?

https://apple.stackexchange.com/questions/126830/how-to-upgrade-openssl-in-os-x

 

If you haven't got 'brew' installed, which can be used to upgrade ssl (and loads of other packages),  it can be done with 


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

 

 

Thanks @wrjlewis!

I upgraded and now it's openssl 1.1.1g 21 apr 2020

 

And here's the new log of errors;

 

[18:30:47.655] Notion Search[Script Filter] Queuing argument 'task'
[18:30:47.867] Notion Search[Script Filter] Script with argv '(null)' finished
[18:30:47.872] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last):
  File "notion.py", line 114, in <module>
    buildNotionSearchQueryData(alfredQuery), headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...