Drafts Reference


CallbackURL objects can be used to open x-callback-url requests and wait for a response from the target app.

NOTE: If you want to open a URL in Safari or another app and do not need a response or x-callback-url support, use the app.openURL(url) method on the App object.


Instance Functions

Class Functions


// Open callback URL for each line in a draft
// Setup base Fantastical URL, with no parameters
const baseURL = "fantastical2://x-callback-url/parse/";

// split draft and loop over lines
var lines = draft.content.split("\n");
for (var line of lines) {
	// create and configure callback object
	var cb = CallbackURL.create();
	cb.baseURL = baseURL;
	cb.addParameter("sentence", line);
	// open and wait for result
	var success = cb.open();
	if (success) {
		console.log("Event created");
	else { // something went wrong or was cancelled
	  	if (cb.status == "cancel") {
		else {