X-url-callback: tag (in) vs. tags (out)

Preserving a note’s tags when sending it from Drafts to another application using x-url-callback is simple: Set whatever variable the target app uses for tags to [[tags]] and they will be transferred (assuming the target app can handle tags, of course).

Sending from another app to Drafts, on the other hand, is problematic: X-url-callback to Drafts has a variable called tag. Singular, and for a reason—it can only be used to add a single tag. However, the description says that this variable can be used multiple times to add multiple tags.

But that would mean that the sending application must be able to work with scripts that loop through the tags of an item and first generate the x-url-callback (including ...&tag=...&tag=...&tag=...) and then run it.

The only application (on mobile devices) I know of that can do this is Drafts itself. Other apps usually have a single field where you put the x-url(-callback) and if you’re lucky they offer all their metadata as variables.

So would it be possible to get tags instead of tag for x-url-callback to Drafts too?

You can actually us a comma separated list and Drafts will interpret it as multiple tags. Comma separated tags is a common way for other apps to define a list of multiple tags.

Try this link and it should add 5 tags to a new draft. Or at least it does for me on the iPhone.

drafts://x-callback-url/create?text=Hello%20World&tag=foo,bar,baz,quz,qux

Hope that helps helps.

1 Like

First of all, thank you for probably the fastest response ever - and it’s even Sunday!

And then thanks again. You pointed me in the right direction. Because of Draft’s distinction between [[tags]] and tag, I suspected that the latter was the cause of the problem. However, it was not Draft’s fault at all, but the fault of the sending application, GoodLinks. Which does not use comma separated tags.