"hook to new bear" doesn't work for me

Hello, just bought the hook.
How to set hook so it would create notes in bear with clickable links?
Now it just creates notes with the name of the file.
image

The video with what I have now:

Macos 10.15.7
Interface - English
Hook Version 2.2 (3971)

Ok, almost figured it out:

I needed to modify default script in settings

set callbackURL to "hook://x-callback-url/link-to-new"
set partialURL to "bear://x-callback-url/open-note%3Fid%3D"
set encodedSrc to "$encoded_link"

set callbackURL to callbackURL & "%3FpartialURL%3D" & partialURL & "%26src%3D" & encodedSrc

set encodedTitle to "$encoded_title"
set myURL to "bear://x-callback-url/create?title=" & encodedTitle & "&x-success=" & callbackURL
set myScript to "open '" & myURL & "'"

do shell script myScript

get "hook://x-callback-url/link-to-new"

To this one:

set callbackURL to "hook://x-callback-url/link-to-new"
set partialURL to "bear://x-callback-url/open-note%3Fid%3D"
set encodedSrc to "$encoded_link"

set callbackURL to callbackURL & "%3FpartialURL%3D" & partialURL & "%26src%3D" & encodedSrc

set encodedTitle to "$encoded_title"
set myURL to "bear://x-callback-url/create?text=[" & encodedTitle & "](" & encodedSrc & ")&x-success=" & callbackURL
set myScript to "open '" & myURL & "'"

do shell script myScript

get "hook://x-callback-url/link-to-new"

but now created links doesn’t open the destination file.
Probably I should change encodedSrc to something different. But to what?

Welcome to the Hook Productivity Forum , @maxim. Thanks for asking about that. We have not yet tried to roll out support for adding a linkback directly into Bear. I don’t yet know whether Bear even supports it.

The way to see a linkback is in the Hook window. Invoke Hook on the newly created item, and you should see a ‘hook’ back to the item.

If you want to insert its link into the Bear doc, just

  • invoke Hook
  • Copy Markdown Link on the selected link, using ⇧⌘M or its link menu
  • paste

This could be automated with Keyboard Maestro or the like.

Thank you!
Are you sure that I cannot do it via callbackurl interface of bear?

Where I can find the documentation about such parameters "$encoded_link" - what are exist?

I just meant that we have not gotten to it yet and would have a look, and noted KM as an option. However, based on X-callback-url Scheme documentation | FAQ & Support | Bear App it does seem content can easily be inserted while creating a new Bear note.

I’m sorry to bother you, but I do not undestand why we can’t use “text” parameter as in example? Could you be so kind as to explain me this?

It seems to me that I just need to change string encodedSrc encoding, and it should work. Or I miss something?

I tried using this:

With this script hook app for files creates note with the link that doesn’t work:

[Hook productivity app 2.2.dmg](hook://file/t1PrhFkRC%3Fp%3DbWF4aW11dmFyb3YvRG93bmxvYWRz%26n%3DHook%2520productivity%2520app%25202.2.dmg)

If I use copy markdown - it gives link

[Hook productivity app 2.2.dmg](hook://file/t1PrhFkRC?p=bWF4aW11dmFyb3YvRG93bmxvYWRz&n=Hook%20productivity%20app%202.2.dmg)

So I conclude that the problem is symbols lik “?”, “=”, etc. And that is why I ask if I can use somehow another encoding. I tried to google this parameters in documentation but with no success.

Automatically pasting linkbacks in new Bear notes is on our list, @maxim, we just haven’t gotten to it yet.

cf. Hook integration scripts v.147 now available — Updates for Notes, Drafts, Bear, PDFpenPro - Releases - Hook Productivity Forum

1 Like

@LucB, Thank you so much for your fast reaction to my request! Happy New Year!

1 Like