The note taking app Bear supports integration via it’s Share extension, and URL schemes. For basic needs, use the Drafts Share action and select Bear in the iOS share sheet. Bear’s share extension supports capturing new notes, or append-prepending to existing notes you select in the share extension.
URL Actions
Bear has extensive x-callback-url support, allowing creation of new notes, as well as appending/prepending text, navigating to and searching notes. More details can be found in the Bear URL scheme documentation. A few ready-to-use example actions:
- Send to Bear: Send current draft to Bear as a new note, using the first line as the note title, and remaining text as the content of the note - returns to Drafts after completion.
- Append to Bear Journal: Append draft to rolling series of monthly Journal notes.
Cross-Linking
Drafts’ cross-linking syntax supports linking directly to notes in Bear using their title, in the format [[bear:Title of Note]]
. Using this syntax you can create tappable links which open Bear directly to a specific note.
Scripting
Although URL schemes are the only method to integrate with Bear, they can be powerful. @olivierg has shared a BearAPI that makes using the more advanced features available with Bear’s URL schemes easy in Drafts action scripts. Advanced users might want to take a look at it.
5 Likes
How do I send text in Drafts to prepend / append an existing note in Bear?
Take a look at the Append to Bear Journal action linked above, and then take a closer look at the URL scheme documentation for Bear (also linked above).
1 Like
Thanks but editing the code is somewhat beyond my abilities.
I doubt it is beyond your abilities. We’re talking the same level of “coding” as programming an old VCR, or a thermostat.
The Bear documentation is pretty clear and the action has no code, just the URL to use and some special Drafts tags - tokens that substitute in the data you want tk use.
In the above append example, the URL used in the URL step of the actions is:
bear://x-callback-url/add-text?title=Journal-[[date|%Y-%m]]&text=[[draft]]&mode=append
URLs send information to the target app as query arguments, which is the part of the URL after the ?
, and is a set of key=value
pairs, separated by ampersands (&
).
To target a different, specific note in Bear, you would only need to change the title
argument in this URL. It is currently title=Journal-[[date|%Y-%m]]
, which looks a little intimidating because it includes a Drafts template tag, but does not need to. You can replace that part with title=MyNoteTitle
and the action would append to a note with the name “MyNoteTitle” in Bear.
Because URLs also require some characters (like spaces) to be encoded in argument values, I would recommend you actually use title={{MyNoteTitle}}
for that value to make sure any special characters that might be in your note title are encoded properly in the URL. So, the new URL, which you can use when you edit the “Append” example action would look like:
bear://x-callback-url/add-text?title={{MyNoteTitle}}&text=[[draft]]&mode=append
(Of course, replace “MyNoteTitle” with the note title you actually want to target).
Hope this helps!
1 Like
Do I need a subscription in order to create/add this action to Drafts? I’m confused about that…
You can use and install existing actions with the free version of Drafts. Pro is only required to modify them.
1 Like