You can now get unique Spark email URLs through AppleScript

(Pinging @MacSparky who was asking the question…)

This is the long-lasting hiccup for using Spark: direct deep linking to individual messages. It’s now possible through AppleScript – see original post on the Hook forum:

Get Name

tell application "Spark"
	if HasSelectedMessage then
		set theResult to GetSelectedMessageTitle
		return theResult
	end if
end tell

Get Address

tell application "Spark"
	if HasSelectedMessage then
		set theResult to GetSelectedMessageBacklink
		return theResult
	end if
end tell

Tested through Keyboard Maestro, works perfectly. Opens the door for a true task-based email workflow on macOS with Spark, and erodes further the tiny lead Airmail still kept in functionality. I’m very happy as Spark is a lot more reliable.

1 Like

@anon85228692 I’ve been going back-and-forth with Spark for sometime. I’ve always wanted to use Spark but I continue to have two issues. One of which you just addressed. I don’t like going to the website for a link. This, however, does not solve the problem when using Spark on iOS. I tend to use it quite a bit on the iPad. The other issue is that Spark does not integrate with DEVONthink. Obviously, I can copy an email link and put it in DEVONthink, but Apple Mail can be sent directly to Devonthink through drag and drop or through import. This functionality is important to me because I connect specific emails with specific project notes in DEVONthink.

Those are the two main reasons right now why I’m still defaulting to Apple Mail. I would love to hear if you have any workarounds for those two remaining issues in my workflow. :slight_smile:

For iOS, still no luck I’m afraid. (I just tried drag and drop to OmniFocus, just in case… no joy.)

For DEVONthink, on Mac, since we can now freely access the Spark internal URL scheme, you can link to those messages from anywhere, including from your DT notes. That should also work on iOS – I haven’t tested it, but those links work cross-platform from task managers, so there’s no reason why they shouldn’t work for elsewhere. You need to create them on a Mac, though.

I have been following very closely Spark’s development and, unless I’ve missed it, I’ve seen no announcement whatsoever of this AppleScript support, which seems weird because it’s quite carefully implemented and I only ever found mention of it in the depths of the Hook forum. I want to see in that silence the sign that Readdle is quietly building Spark to a v.3.0 supporting lots of new automation features, including deep linking.

Here’s the Keyboard Maestro Macro on an old thread, btw:

@Bmosbacker, main problem there is that Spark reserves its spark:// scheme to its native integrations and will not allow for copying directly (it favor the https links for that).

That said, there are a few integrations that will export spark:// links if used. I use it to push links to Things. Devonthink doesn’t appear to be supported as per this screenshot:

There’s also a specific thread on this problem in this forum:

1 Like

Damn, I COMPLETELY missed the first macro posting. My apologies. I don’t even know how I could miss that as I’ve been literally looking for this for years…

No problem at all!

In fact, it’s a good thing to show how precious those Spark:// links are to the workflow of so many people here.

Folks on Readdle would very much help us if they make those links more addressable both on iOS and macOS (just a tip, @Maria_from_Readdle ).

It seems like a very low hanging fruit for them to implement.

1 Like

Yes, YES, for the love of all that is holy!

It drives me nuts that these links obviously exist and can be created and that there is no straightforward way to access them.

If they would only bring that into Spark 3.0, I would be happy and finally stop changing email apps every two months…

@anon85228692, @ldebritto Thanks for the good information. It looks like I will have to continue using Apple Mail. I don’t want to mess with Scripts and keyboard Maestro. I just want to send the email to DT and other apps and have a link directly back to the email without going to a website. One last question on this, do you know if Airmail handles this better and even if so, is the client stable and reliable? I’ve run into issues with AM in the past. It would need to work perfectly and do wha I want for me to justify paying a subscription for an email client. :slight_smile:

In my experience, only Mail.app, Spark and Outlook should be trusted with email. Airmail and many others I’ve tried failed me miserably previously.

While I can’t speak from present experience with Airmail, I can report that Spark has never failed me in the las t two years I’ve been using it as my primary email app on iOS and macOS.

My only gripe is that those spark:// links are way more hard to get than they should be. But that doesn’t offset their Smart Inbox and Send Later features that are just lacking on Mail.App.

1 Like

Airmail is… Airmail. It’s finicky. It does not work perfectly, it works if you know its quirks and want the most powerful app there is. So in your case, I’d say: stay away from it. I know it very well, but I’ll still be staying with Spark (even more now that there’s URL links we can access). I know I can trust Spark, while Airmail has to be monitored and really feels rough on the edges.

Are these spark:// links completely proprietary, or, if you examine them closely, is there some similarity to the link for the same message generated from a Mail app link? I’mve recently started using Spark on iOS again, but miss other apps where, although they generate their own links, those links could be easily modified to call up messages in the default apps.

A cursory glance has not revealed any similarity on my end with message:// links.

1 Like

I believe I will continue to avoid it. :slight_smile:

The only two apps I’ve found to use the generic message links are Apple Mail and MailMate. Those apps come with their own limitations however.

2 Likes

If this can be useful to anyone, I have replicated the OmniFocus “clip-o-tron” feature from Apple Mail in Spark using Keyboard Maestro, just combining the aforementioned scripts. You will have to change the first hotkey to your OmniFocus quick entry keyboard shortcut (mine being control-option-command-space).

Tried cross platform: works perfectly (you might just need to let Spark update on your other devices).

Now, please let us create those links on iOS…

3 Likes

While this is a workaround that may not be worth it for many users, I have found it worthwhile to use the built-in Reminders integration in spark as a way to send the spark:// links to Drafts, which can then be sent anywhere else. That is, Drafts can be set to auto-import from a reminders list, so on iOS, you can send a Spark mail message to that Reminders list, then Drafts will import it, and you have the link to be manipulated or sent elsewhere.

2 Likes

Quite hacky, but it definitely works… it’s a good reminder of the importance of using Apple’s stock app-pipes for some complex automation on iOS!

1 Like

Thank you so much for sharing this. This is something I’ve been looking for for a while now. I left Spark to Apple Mail but even those links don’t work well.

I’ve modified the script to copy the readdle-spark:// URL to the clipboard so that I could paste it anywhere (Drafts and Obsidian in my case). I trigger it via Keyboard Maestro and a hotkey trigger, which validates that the app is actually at the front.

For those interested:

tell application "Spark"
	if HasSelectedMessage then
		set the clipboard to (GetSelectedMessageBacklink)
	end if
end tell

Now, as others have mentioned, we need a solution for iOS, and one that doesn’t require a Mac running in the background.

1 Like

I love this script, thank you! Is there a way to convert this to URL to a hyperlink before pasting it, such as in OmniFocus?

Edit: thinking of using KM or TextExpander, but not finding a solution to create RTF hyperlink using these apps from the clipboard url

I think I’ve solved this by borrowing a solution on this post in the KM forums. Basically I used the script at the top to get the variables that KM uses in this workflow: Any way to "Add Link" to text within KM? - #2 by peternlewis - Questions & Suggestions - Keyboard Maestro Discourse

2 Likes