√ Craft and Hook compatibility

There is a new note-taking app that is similar but better than Notion that is having a great reception in the Mac community: Craft: https://www.craft.do It allows for bidirectional linking and backlinks. They have an active user forum on Slack - see the bottom of their home page. But their app is not compatible (yet) with Hook. I have asked them to look into it and Viktor at Craft said they will check it. I explained that Hook allows linking across app documents etc.

Their app is written native for the Mac and iOS. See also here: Craft - Press kit
SHort youtube video here about the iPad and iPhone user interface. Mac works also well. Introducing Craft for iPhone, iPad, and Mac - YouTube

1 Like

Hi there,

I got in touch with them too the day I heard about them last month, via Steven Svartling, who linked to: Craft Review: A Powerful, Native Notes and Collaboration App - MacStories, and requested automation for linking..

Awesome! seems like a natural fit. Thanks much for getting in touch with them!

2 Likes

I’ve been spending some time with Craft recently…and am really impressed wit the app. The UI is both beautiful and highly intuitive and, despite being a relative newcomer, Craft has a rich feature set.

I’d really like to see Hook integration. I’m planning to contact the Craft devs with some feedback and requests and will make sure that I include Hook support on my wish list. Craft has a “Copy deeplink” feature that makes it possible to link, for example, Craft and OmniFocus, but Craft doesn’t appear to have AppleScript support or a public API.

3 Likes

There does appear to be a limited URL Scheme now. It’s buried in their slack channel.

3 Likes

See the discussion here Craft Community/Threads

2 Likes

I really second Tim’s feature request :slight_smile:

-mic

2 Likes

We’ve heard great things about Craft, including that they value linking. (They even support bidirectional linking within their app’s world.)

However, as far as we can tell, Craft does not yet have any automation or even a UI that would enable automated linking. I.e., it’s not yet a fully linkable app.

We would welcome having a couple of joint users act as App Advocates / Software Liaisons [between Craft and Hook], who would apprise the Craft devs of the situation (cf. Contacting Developers of Other Apps and Information for Developers – Hook). The Craft devs might appreciate knowing that by providing a little API, their objects could be linked to anything truly linkable. We will be in touch with the devs too. And if the liaisons would keep this forum apprised of any relevant developments with the crafts dev, that would be appreciated.

1 Like

Hi - Balint here, CEO of Craft. We’re adding our “copy deeplink” option to the file menu which would enable than the following script
tell application "System Events" to tell process "Craft" click menu item "Copy Deeplink" of menu 1 of menu bar item "File" of menu bar 1 delay 0.05 repeat 50 times -- poll clipboard for ~2.5 seconds try if (the clipboard) is not equal to "" then exit repeat end if end try delay 0.05 end repeat end tell get the clipboard
Any suggestions on making this better, or is this the preferred way? One issue I have is that within localized versions of the app this wouldn’t work - or would need to be adjusted?

3 Likes

Starting from next version (coming around 18th Jan) this script will work for Craft :
//START///
click menu item “Copy Markdown Deeplink” of menu 1 of menu bar item “File” of menu bar 1
delay 0.05
repeat 50 times – poll clipboard for ~2.5 seconds
try
if (the clipboard) is not equal to “” then
exit repeat
end if
end try
delay 0.05
end repeat
set theLink to the clipboard
return theLink
end tell
//END///

Welcome to the Hook Productivity Forum , @balint. I’m delighted by the direction of Craft.

UI Scripting is a good first start. However,

UI scripting is not reliable, it requires translations. And if the UI of the app changes (e.g., you move the Copy Link menu items around), then the scripts will break. It would be better to have an API ( AppleScript/ JavaScript or a command line interface ) or x-callback-url.

It is also helpful to to support “new item” per point #4 of Creating and Modifying Integration Scripts – Hook. (See also Hook to Copied Link. That would enable users to automatically link items in other apps to new Craft documents/notes. That’s very helpful for note-taking (e.g., if the user is reading a PDF, spreadsheet or webpage, in any linkable app, the user could then do Hook to New > Craft. That gives them a new craft note that has been named, stored , and linked … in one operation). So the new item x-callback-url, for instance, would take the name of the item as a parameter, and Craft would return the URL of the newly created Craft note.

Once you have the automation in place, we CogSci Apps can write the integration scripts.

1 Like

UI Scripting is also slower than an API.

Thanks, succesfully implemented x-callback-url. Can you point me to what format Hook is expecting - or alternatively a sample script utilizing x-callback-url I can take and modify?

2 Likes

Well this more than anything else has convinced me to give Craft a try! Way to be a team player @balint!

1 Like

Awesome!!!

New item

Hook’s current New Item script for the Drafts app is a good example of x-callback-url usage by Hook.
Hook uses Draft’s x-callback-url 's in it’s New Item script (which is used by the Hook to New > Drafts command).

The conforming app’s x-callback-url for New Item needs to take a name (title) string as input, and return the address, that’s all. Hook is not fussy about the specific API. The method can return more than is needed. (Drafts’ API is quite generous, providing information Hook need not use, and that’s fine). Hook will then create a new bookmark for the item, caching that name (updating as necessary in the future), and it will use the URL to open the bookmark going forward.

There’s also this example: Hook to New with Momenta’s Agenda app using x-callback-url – Hook

Get Address

Drafts recently added an x-callback-url Hook can use in its Get Address tab. However, Hook has not yet been updated for this. It was / is , coincidentally, the next item on our integration update list. We hope to publish an update tomorrow on the forum.

Get Name

Get Name is mostly for legacy purpose. The Get Address command can be used to return both the address and the name of the item, in Markdown format (for convenience).

Hook’s integration documentation updates

We will soon update our Integration: How Hook Works with Your Favorite Apps – Hook, improving our examples. It would make sense for us to use Craft and Drafts as examples in our Help pages.

I should point out that if the app contains an API to insert hypertext, then on Hook to New, Hook would insert a linkback to the new Crafts doc, like it does for

  • Drafts
  • OmniFocus
  • Apple Notes

this is particularly handy for iOS apps, so that users can get the benefit of links there too.

That’s also something we’ll add to the updated integration documentation.

1 Like

Awesome, exciting!! I’m really starting to “get it” finally.

1 Like

There are two patterns of Get Address scripts for Hook that are based on x-callback-url. This post illustrates each with Draft. The first way uses the third-party app’s x-callback-url that returns the URL and title of the current item (and possibly other info which Hook would likely ignore). The second uses the third-party app’s x-callback-url method that returns the UUID and title of the current item.

Hook defines names to represent the name of the key in the key-value pair returned by the third party app’s x-callback-url. They are:

  1. urlkey: the name of the key in the URL key-value pair (i.e., for obtaining the URL of the current item)
  2. identifierKey: the name of the key in the UUID key-value pair (i.e., for obtaining the UUID of the current item)
  3. titleKey: the name of the key in the title key-value pair (i.e., for obtaining the title of the current item)

Hook’s Get Address script for an app needs to set (1) or (2), and (3). The first is preferred (the URL). (If the name is not set in (3) it can be set in the Get Name script, but it’s preferable to leave the Get Name script blank.)

Here are two examples of Get Address for Drafts app using Drafts getCurrentDraft URL Schemes :

  1. This one uses urlkey (and titleKey, of course):

    set callbackURL to “hook://x-callback-url/currentlink”

    set callbackURL to callbackURL & “?” & “%26urlkey=url%26titleKey=title”

    set myURL to “drafts://x-callback-url/getCurrentDraft?text=” & “&x-success=” & callbackURL

    set myScript to “open '” & myURL & “’”
    do shell script myScript

  2. This one uses identifierKey (and titleKey, of course):

    set callbackURL to “hook://x-callback-url/currentlink”
    set partialURL to “drafts5://x-callback-url/open%3Fuuid%3D”

    set callbackURL to callbackURL & “?%26identifierKey=uuid%26titleKey=title%26partialURL=” & partialURL

    set myURL to “drafts://x-callback-url/getCurrentDraft?text=” & “&x-success=” & callbackURL

    set myScript to “open '” & myURL & “’”
    do shell script myScript

The above scripts require Hook 2.2.1 which will be released shortly, and which has extra code for handling x-callback-url -baed Get Address scripts.

Basically, Hook just needs the URL and title of the currently selected item. Some apps just return an ID and title; Hook can create a URL using the ID (case 2). As long as the app developer provides the x-callback-url (or AppleScript or whatever API) we ( CogSci Apps) can normally write Hook’s scripts to integrate with it.

Awesome, can’t wait for 2.2.1!

1 Like

Sorry to be a pest, but any update on the timeline here? I…uhhh…got a little excited and broke my Drafts integration script and was hoping to just hit “update” before too long! :slight_smile:

My initial thought about this on Tue was Thu (today) as ETA. But I’ve learned the hard way that making ETA predictions is risky. (I don’t know how Apple has managed to stick to its yearly pace all these years. It is truly remarkable.) It’s not just a script, but there’s a core change under the hood to handle the callback. We need to put it through code review and QA, and potentially iterate. QA for an app like is very time consuming. Then there’s customer documentation. Having said that, I hope we can release it this week-end.

2 Likes