Append-to-note url scheme command

Hi, I’m trying to use append-to-note in an action in Drafts on iOS to quickly append content to a note in Agenda for upcoming meetings. My Drafts action looks up the date of the next meeting in the calendar and then attempts to append to a note in Agenda with a title based on that date, e.g. “Staff Meeting 2019-01-15"

As best as I can work out, the append-to-note url scheme command fails silently if a note with the specified title doesn’t already exist; i.e. it doesn’t do anything but it returns x-success. There also doesn’t seem to be a way to test if the note exists as open-note also returns x-success whether the note exists or not.

Ideally, it would be great if the append command would fall back to creating a new note if a note by that title doesn’t exist; but alternatively I think it should return x-error if the append fails for any reason.

We will investigate this. Thanks for reporting it!

Please note that version 4.1 and later should fix the error problem, and also provide return parameters to x-success that are useful, such as the note identifier of a newly created note.

Perfect, thanks!

@jon.rumble would you please share your draft action? I am trying to do the same thing with little success

Hey @colingoldmail , no worries, my drafts action consists of a single Script step, I’ll paste the code in below. This works perfectly for me but just looking through the code again I note that there are all sorts of potential failure cases that I never bothered to account for!

let cal = Calendar.find("Staff team");

if (cal) {

	var future = new Date();
	future.setDate(future.getDate() + 30);

	let events = Date(), future);

	for (var event of events) {
		if (event.title.includes("Staff Meeting")){
	meetingDate = event.startDate.toISOString().split('T')[0];
	draft.setTemplateTag('meetingDate', meetingDate);

let appendURL = 'agenda://x-callback-url/append-to-note';

var appendCallBack = CallbackURL.create();
appendCallBack.baseURL = appendURL;
appendCallBack.addParameter('title','Staff Meeting ' + meetingDate);
appendCallBack.addParameter('project-title','Prov City Staff');
appendCallBack.addParameter('text', draft.content);

var appendSuccess =;

if (appendSuccess){
	console.log("Agenda item appended.");
} else {
	//Try creating note if append didn't work
	if (appendCallBack.callbackResponse.reason == 'Target was not found'){
		let createURL = 'agenda://x-callback-url/create-note';
		var createCallBack = CallbackURL.create();
		createCallBack.baseURL = createURL;
		createCallBack.addParameter('title', 'Staff Meeting ' + meetingDate);
		createCallBack.addParameter('project-title','Prov City Staff');
		createCallBack.addParameter('text', draft.content);
		createCallBack.addParameter('on-the-agenda', 'true');
		createCallBack.addParameter('date', meetingDate);
		var createSuccess =;

		if (createSuccess){
			console.log("Agenda item created.");
		} else {
			//If create fails, produce error;
	} else {
	//If append failure was for another reason, produce error;