Jump to content

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

Link to comment
  • 1 month later...
  • 3 weeks later...
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? 

Link to comment
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.

 

Link to comment

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

Link to comment
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)

 

Link to comment
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)"

Link to comment
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
Link to comment

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)"

 

Link to comment

Hi,

 

What a wonderful workflow!

 

I followed step by step your guide. However, it's not working on my side : no results are displayed :(

 

The debugger shows this

 

[11:26:15.798] Logging Stopped.

[11:26:16.595] Logging Started...

[11:26:23.441] Notion Search[Script Filter] Queuing argument 'l'

[11:26:23.488] Notion Search[Script Filter] Queuing argument 'le'

[11:26:23.550] Notion Search[Script Filter] Queuing argument 'lea'

[11:26:23.641] Notion Search[Script Filter] Queuing argument 'lean'

[11:26:25.844] Notion Search[Script Filter] Script with argv '(null)' finished

[11:26:25.847] Notion Search[Script Filter] {"items": [{"arg": "https://www.notion.so/", "type": "default", "uid": 1, "title": "No results - go to Notion homepage"}]}

[11:26:26.620] Notion Search[Script Filter] Script with argv '(null)' finished

[11:26:26.623] Notion Search[Script Filter] {"items": [{"arg": "https://www.notion.so/", "type": "default", "uid": 1, "title": "No results - go to Notion homepage"}]}

 

I use Alfred 4.0.9.

 

Any idea where the problem comes from ? 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...