Create tagged note in Bear if it does not exist yet

I have text to move from Drafts to Bear. I want to put it into a journal note with today’s date as the heading, and today’s date as the tag as well. So (eg) title = 20-07-01, tag =#jnl/20/07/01.

If the note exists, I want to append, but if it does not yet exist I want to create it with the title and the tag. How do I do that?

Looks like the add-text URL scheme would support this…a Callback URL step like the below should work:

bear://x-callback-url/add-text?title={{MY NOTE TITLE}}&text=[[draft]]

(You could duplicate your existing Bear action and modify the URL - clear you need to edit the “MY NOTE TITLE” part to match the actual note you are using - see Bear URL docs for additional parameters)

That works fine once the note is created, and the tag is added.

But if I modify it to include the tag, then it always includes the tag. So the first time I run it I get what I want.


Line 1


But the second time I run it I get this:


Line 1

Line 2



I can’t know in advance if the tag has already been created. This is an ok kludge, but not very aesthetically pleasing. Especially after I have added 6 or 8 lines to it. :slight_smile:

I doubt there’s a good way to do this with URL schemes. Not sure what Bear’s Shortcuts support looks like, but maybe they have Shortcuts actions that would allow querying for the note and making conditional updates.

Could you put the tag in the title? Would that work in Bear?

Thanks for the feedback. I have not found a solution in the Bear shortcuts support either, but still hoping on that front. I thought this could not be that hard a problem, but obviously I am wrong.

Bear has an x-callback that opens a tag, and I have tried that with x-error to create the note and tag if it does not exist, but it does not work. At least so far.

Could you not parse the JSON returned by a call to bear://x-callback-url/tags?token=123456-123456-123456 (use own API token), and if today’s tag isn’t in there then you can create your new note with the new day’s tag, and if it is in there, you append without including the day’s tag?

I tried this.


The x-error clause does not appear to be called. I don’t understand enough to debug.

Probably I have not encoded it correctly, but I am now way in over my head.