Jump to content

Notion.so Instant Search Workflow


Recommended Posts

14 hours ago, dterranova said:

I just screengrabbed the contents of Chrome's headers. Redacted private data but made sure to keep all var definitions intact.... I wonder if this is due to Notion's Team functionality that others have mentioned, being that there's is no spaceId anymore? Excuse my ignorance, just spitballing.

EDIT: I tried copying notion_user_id into Alfred, just in case. No change.

 

EDIT 2: 

Found it! My bad.

Didn't realize spaceID is under the Payload tab, not Headers. 

It's there and it just started working! Thanks so much.
Just saved myself probably 15min per day with this workflow :)

 

Awesome! Really glad to hear it helps. I find it so useful personally!

Link to comment
  • 1 month later...

First of all, thank you for the great workflow. It runs great. I have only one question about the function "Show Recently Viewed". Unfortunately I don't get any results here. As soon as I search for a page, they are displayed. However, not the most recently used ones. If you only enter the command "ns" without anything behind it. Here is the debugger code. Maybe someone can help:

[11:28:36.785] Notion Search[Script Filter] Queuing argument ''
[11:28:36.923] Notion Search[Script Filter] Script with argv '(null)' finished
[11:28:36.930] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "subtitle": " ", "arg": "https://www.notion.so/"}]}

 

image.png.6428cdad5dba141005fa0ed3f923f25e.png

Edited by Pirat
Link to comment
3 minutes ago, Pirat said:

First of all, thank you for the great workflow. It runs great. I have only one question about the function "Show Recently Viewed". Unfortunately I don't get any results here. As soon as I search for a page, they are displayed. However, not the most recently used ones. If you only enter the command "ns" without anything behind it. Here is the debugger code. Maybe someone can help:

[11:28:36.785] Notion Search[Script Filter] Queuing argument ''
[11:28:36.923] Notion Search[Script Filter] Script with argv '(null)' finished
[11:28:36.930] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "subtitle": " ", "arg": "https://www.notion.so/"}]}

 

image.png.6428cdad5dba141005fa0ed3f923f25e.png

 

Pleased to hear it's working (mostly) well! 

 

For the "Show Recently Viewed" function to work, you need to make sure that in your cookie you have a user id value. This will be the case if you have copied the whole cookie value from your browser rather than just the token_v2. 

 

Have you got user_id in your cookie? (don't paste your cookie here because the information is sensitive)

Link to comment

Thank you for the quick reply.

I have used chrome to get the values (I did after I typed "search" in notion in the search box). Took the complete value at "request headers" after "cookie:". Among other things, the field "cb_user_id" and "notion_user_id" is also included here. After the value "notion_user_id=" is a letter number sequence separated by dashes. So everything looks good for now.

 

I have also already copied the cookies first to a text file and then to Alfred.

 

In addition, the "Show recently Viewed" is checked in the workflow.


There is no field with only "user_id". Only the fields "cb_user_id" and "notion_user_id"

 

Link to comment
3 hours ago, Pirat said:

Thank you for the quick reply.

I have used chrome to get the values (I did after I typed "search" in notion in the search box). Took the complete value at "request headers" after "cookie:". Among other things, the field "cb_user_id" and "notion_user_id" is also included here. After the value "notion_user_id=" is a letter number sequence separated by dashes. So everything looks good for now.

 

I have also already copied the cookies first to a text file and then to Alfred.

 

In addition, the "Show recently Viewed" is checked in the workflow.


There is no field with only "user_id". Only the fields "cb_user_id" and "notion_user_id"

 

 

Ah thanks, yes the right one is notion_user_id.

 

This could be related to a bug that I haven't released a fix to in relation to the way python handles cookies. Basically if there is a curly brace '{' or a '}' in the cookie somewhere, the code will not read anything after this point. 

 

Could you check if there is a curly brace in your cookie somewhere, and if so delete that whole part of the cookie. Most likely you will need to delete everything from and including 'notion_cookie_consent'= to and including the next semi colon ';' .  That should cover removing all values that have a curly braces. 

 

Try again with you have left, and I wonder if that will work for you now. 

Link to comment

Thank you for the quick reply. I have changed it and now everything works. In fact, the symbols were there. I have changed these in the field "g_state=" and "notion_cookie_consent=".
 

Now everything runs smoothly and makes my everyday life much easier.
 

I have one more small hint. It's nothing important, but maybe it helps. With me it is so that I use the desktop app of Notion on a Mac. If the desktop app was not yet open and I then open a Notion page via Alfred, the Notion app starts and the correct page opens. Everything is fine.
This is also the case when Notion is minimized, after the command "CMD" + "M". The desired page is opened by the Alfred workflow and the Notion app appears. Everything is fine.
However, if Notion is open and closed by "CMD" + "W". So the app is still running in the background, but it is not minimized as a window, then you can't open the Notion page directly via the workflow in Aflred anymore, but you have to restart the desktop app once before. So that again the window of the Notion app is open. I suspect, however, that the problem is not in the workflow.

Thanks again for providing the workflow.

Link to comment
2 hours ago, Pirat said:

Thank you for the quick reply. I have changed it and now everything works. In fact, the symbols were there. I have changed these in the field "g_state=" and "notion_cookie_consent=".
 

Now everything runs smoothly and makes my everyday life much easier.
 

I have one more small hint. It's nothing important, but maybe it helps. With me it is so that I use the desktop app of Notion on a Mac. If the desktop app was not yet open and I then open a Notion page via Alfred, the Notion app starts and the correct page opens. Everything is fine.
This is also the case when Notion is minimized, after the command "CMD" + "M". The desired page is opened by the Alfred workflow and the Notion app appears. Everything is fine.
However, if Notion is open and closed by "CMD" + "W". So the app is still running in the background, but it is not minimized as a window, then you can't open the Notion page directly via the workflow in Aflred anymore, but you have to restart the desktop app once before. So that again the window of the Notion app is open. I suspect, however, that the problem is not in the workflow.

Thanks again for providing the workflow.

 

Thanks @Pirat

 

Yeah the second issue you notice is one we're aware of:

https://github.com/wrjlewis/notion-search-alfred-workflow/issues/73

It's frustrating, I think it's related to the notion app rather than the alfred workflow. Is there any other way you can trigger the desktop app to open a page, and does it exhibit the same behaviour? 

Link to comment

I have trouble getting it to run after updating on the latest MacOS. 

 

I tried the certificates command and get

sudo: /Applications/Python 3.9/Install Certificates.command: command not found
 ~ % python --version
zsh: command not found: python
 ~ %

 

I also reinstalled Python 3 and then Python 2 via homebrew as explained here:

https://www.alfredapp.com/help/kb/install-dependencies/

 

No success. I always get this error message:

[13:54:27.046] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "253: 'Payload' object has no attribute 'pages'", "arg": "notion://www.notion.so/"}]}

 

Has anyone an idea how to solve this?

Link to comment
49 minutes ago, nebaon said:

I have trouble getting it to run after updating on the latest MacOS. 

 

I tried the certificates command and get

sudo: /Applications/Python 3.9/Install Certificates.command: command not found
 ~ % python --version
zsh: command not found: python
 ~ %

 

I also reinstalled Python 3 and then Python 2 via homebrew as explained here:

https://www.alfredapp.com/help/kb/install-dependencies/

 

No success. I always get this error message:

[13:54:27.046] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "253: 'Payload' object has no attribute 'pages'", "arg": "notion://www.notion.so/"}]}

 

Has anyone an idea how to solve this?

 

Have you tried running the command with the quotes? 
 

sudo '/Applications/Python 3.9/Install Certificates.command'
 

The single quotes are required. If this file doesn't exist, run "python --version" to find out what version you have and update command accordingly.

If you installed python homebrew it might be that you don't have the Install Certificates script, you might want to try running: 

pip install certifi

However, the error message you're getting doesn't show the certificate error. So I'd suggest refreshing your notion cookie and space id, in addition to the above steps. 

Link to comment

Hello,

 

great that you answer that fast, thanks a million.

 

It does not seem solvable though. 

I tried the commands but somethings seems to be off:

Last login: Fri Apr 14 14:29:33 on ttys000
 ~ % sudo '/Applications/Python 3.9/Install Certificates.command'

Password:
sudo: /Applications/Python 3.9/Install Certificates.command: command not found
 ~ % pip install certifi

zsh: command not found: pip
 ~ % 

 

I will try to update Cookie / SpaceID later on.

 

Thanks again, 

 David

Link to comment
  • 1 month later...

I might have a similar error as people before me, but I couldnt find the exact one and the tips didn't do it for me. Here is the debugger:

[22:08:09.602] Notion Search[Script Filter] Queuing argument ''
[22:08:10.060] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:10.069] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "subtitle": " ", "arg": "notion://www.notion.so/"}]}
[22:08:10.113] Notion Search[Script Filter] Queuing argument 'h'
[22:08:10.257] Notion Search[Script Filter] Queuing argument 'hu'
[22:08:10.388] Notion Search[Script Filter] Queuing argument 'hus'
[22:08:10.501] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:10.507] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "291: 'Payload' object has no attribute 'results'", "arg": "notion://www.notion.so/"}]}
[22:08:11.000] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:11.006] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "291: 'Payload' object has no attribute 'results'", "arg": "notion://www.notion.so/"}]}

Link to comment
2 minutes ago, alsbjer said:

I might have a similar error as people before me, but I couldnt find the exact one and the tips didn't do it for me. Here is the debugger:

[22:08:09.602] Notion Search[Script Filter] Queuing argument ''
[22:08:10.060] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:10.069] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "Open Notion - No results, empty query, or error", "subtitle": " ", "arg": "notion://www.notion.so/"}]}
[22:08:10.113] Notion Search[Script Filter] Queuing argument 'h'
[22:08:10.257] Notion Search[Script Filter] Queuing argument 'hu'
[22:08:10.388] Notion Search[Script Filter] Queuing argument 'hus'
[22:08:10.501] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:10.507] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "291: 'Payload' object has no attribute 'results'", "arg": "notion://www.notion.so/"}]}
[22:08:11.000] Notion Search[Script Filter] Script with argv '(null)' finished
[22:08:11.006] Notion Search[Script Filter] {"items": [{"uid": 1, "type": "default", "title": "There was an error:", "subtitle": "291: 'Payload' object has no attribute 'results'", "arg": "notion://www.notion.so/"}]}

Hi, just to check because it’s surprising how often this fixes this issue, have you tried re obtaining your cookie and space id? Thanks 

Link to comment
Posted (edited)
9 hours ago, wrjlewis said:

Hi, just to check because it’s surprising how often this fixes this issue, have you tried re obtaining your cookie and space id? Thanks 

Hi!

Yes, I've tried multiple times in multiple browsers. I also tried to exclude parts with {} but unfortunately I get the same error. My cookie is much longer than in the tutorial example, which parts of the cookie is needed?

Edited by alsbjer
Link to comment

Absolutely amazing workflow! 🙏  Been using it every day for a couple of weeks and it is now indispensable. Thank you so much.

 

I don't know whether you're open to requests, or whether this has been asked, but it would be terrific to be able to copy the URL of a Notion page by using a modifier key and hitting enter in Alfred. So you'd type NS


and instead of hitting Enter to take you there, you hit Alt or Opt or Shift or something and Enter, and it copies the URL instead. Don't know about others but would be terrific for my use case.

 

Again, thanks so much!

 

 

Link to comment
23 minutes ago, hug101 said:

Absolutely amazing workflow! 🙏  Been using it every day for a couple of weeks and it is now indispensable. Thank you so much.

 

I don't know whether you're open to requests, or whether this has been asked, but it would be terrific to be able to copy the URL of a Notion page by using a modifier key and hitting enter in Alfred. So you'd type NS


and instead of hitting Enter to take you there, you hit Alt or Opt or Shift or something and Enter, and it copies the URL instead. Don't know about others but would be terrific for my use case.

 

Again, thanks so much!

 

 

This is actually already possible I think! Try the Mac key (cmd) and enter, it should copy to the clipboard? Glad it’s been really helpful

Link to comment
6 hours ago, alsbjer said:

Hi!

Yes, I've tried multiple times in multiple browsers. I also tried to exclude parts with {} but unfortunately I get the same error. My cookie is much longer than in the tutorial example, which parts of the cookie is needed?

Specifically the token_v2 bit, but as long as that’s in your cookie somewhere, it should be fine 

Link to comment
On 5/19/2023 at 8:12 AM, wrjlewis said:

This is actually already possible I think! Try the Mac key (cmd) and enter, it should copy to the clipboard? Glad it’s been really helpful

Thanks for the reply but that does not work on my end. The other modifier keys have different functions, too. 'option' searches in Finder and 'control' searches with something called 'default fallback'. Any suggestions?

Link to comment
9 hours ago, hug101 said:

Thanks for the reply but that does not work on my end. The other modifier keys have different functions, too. 'option' searches in Finder and 'control' searches with something called 'default fallback'. Any suggestions?

Ah thats strange, I was almost sure I was able to do that at some point. 

 

Either way, I've found how to do it and will add it to the next release. I'm not sure when that will be, I tend to add a few features then go through the process of releasing a new version of the workflow. But you can track that here https://github.com/wrjlewis/notion-search-alfred5-workflow/issues/6

 

Thanks for the suggestion

Link to comment
On 5/22/2023 at 10:10 AM, wrjlewis said:

Ah thats strange, I was almost sure I was able to do that at some point. 

 

Either way, I've found how to do it and will add it to the next release. I'm not sure when that will be, I tend to add a few features then go through the process of releasing a new version of the workflow. But you can track that here https://github.com/wrjlewis/notion-search-alfred5-workflow/issues/6

 

Thanks for the suggestion

 

This would be terrific and much appreciated. Again, kudos on releasing such a fantastic workflow. It's really appreciated!

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...