Missing Template Tag, related to X-Callback-URL action?

I have a prompt step that populates a ‘dotags_button’ template tag. Depending on the presence of a ‘Callback URL’ action step, the [[dotags_button]] template tag will go missing. Here are the specific steps:

  1. Prompt. key: dotags (include buttons).
  2. Callback URL (wait for response TRUE): streaks://x-callback-url/completed/F9FE30BD-012F-4046-9390-228798A0518F
  3. Script, which includes: draft.setTemplateTag("wordcount", stats.wordCount());
  4. Run Shortcut, with template: [[wordcount]]
  5. URL: dayone2://post?entry=[[draft]]&tags=[[dotags_button]]

If the Callback URL step is disabled, [[dotags_button]] is properly populated at the end URL step. If I enable the Callback URL step, [[dotags_button]] contains the prompt selection after the Callback URL, but the value is missing after the Run Shortcut step. I’m very confused! Can anyone offer help?


I’ve created a Draft action an a Shortcuts shortcut as follows.

  • Draft Action - ViewIt - uses action step to set template tag in the app beta | OR | Draft Action - ViewIt (script-based) - uses script step to set template tag, does not require beta app.
    • Sets a tag called temptag to a value of lorem ipsum.
    • Displays the contents of temptag in a prompt.
    • Uses and x-callback to a Shortcuts action.
      • Shortcut - ViewIt
        • Displays the text passed to it.
        • When the user selects done, the shortcut completes and control will return to Drafts.
      • Content of temptag is passed to the shortcut to be displayed.
    • Displays the contents of temptag in a prompt (for a second time).

In my test (which you can download and reproduce), the output for both prompts and the shortcut was “lorem ipsum”.

In effect, I’m not seeing the issue occurring in my simplified test which I think you are describing.

Can you share some actions like the above that we could use to reproduce your issue?

I’m afraid I don’t use Streaks and so can’t attempt to reproduce what you have. It may be that this is specifically related to Streaks, but if that’s the case, if you substitute in the Shortcuts shortcut call I use above for the Streaks one, that may give you some additional insight as to if the issue is there or elsewhere in the action.

Also if you add a prompt to display your template tag between each step as I used in my example, that will confirm which step is affecting your tag value. I note that you have said it is the Shortcut step, but you haven’t indicated how you know it is that rather that either of the two prior steps.

EDIT: Added versions to cover both the beta and non-beta for template tag setting options.

Thanks so much for the reply. I’ve got two actions that I simplified somewhat, but that still illustrate the behavior:

The steps are:

  • Prompt for a selection.
  • Confirms that the selection was set as a template tag (dotags_button).
  • Uses Run Shortcut to call out to your ViewIt shortcut The second Action above omits this step.
  • Confirms prompt selection again.
  • Runs a script that sets another template tag (wordcount).
  • Confirms prompt selection again. If the above Run Shortcut is present, at this point dotags_button will be empty.
  • Uses Run Shortcut to call out to your ViewIt shortcut again.
  • Confirms prompt selection again.

Again, any insight you have would be very welcome!

Edit: Adding image of steps

I made various action revisions and here’s the one I used in the screenshots below - Debug templateTag With X-Callback.

If I run the action against a sample draft with a single line of content I get a result that supports your assertion.

But, if I run the action against an empty sample draft however, then the result is different.

That difference in behaviour based on content suggests something strange yet inconsistent is going on.

@agiletortoise - any chance this is a bug or are we missing something obvious to explain the differing behaviour?

Interesting. Rather obscure issue, but definitely a bug. Will fix in the next update. Problem comes from Drafts refreshing the draft when returning from a callback to make sure nothing has changed while you were gone from the app (e.g. the Shortcut itself could update content of the draft) and the temp template tag storage not getting updated properly in the scripting runtime.

1 Like

Thank you both! I suspected as much, but was open to the possibility that I was doing something incorrectly.

I’ll watch for the update.

Latest beta (14.5.37) definitely resolves the test case I posted above :nerd_face:

Hadn’t expected it to appear quite so quickly Greg!