CallbackURL
Inter-app communication via x-callback-url
Opens another app over x-callback-url and waits for its reply. Blocks until the app calls back or 120 seconds pass.
Methods
CallbackURL.open(baseURL, parameters?)CallbackResponse ›Open the target app URL with parameters, wait for callback, and return the response.
- baseURL String required
The target's x-callback-url endpoint, such as shortcuts://x-callback-url/run-shortcut.
- parameters Any
Query items to append. Keys and values are strings and are URL-encoded. x-source, x-success, x-error and x-cancel are added for you.
CallbackURL.build(baseURL, parameters?)StringBuild the full URL string with encoded parameters without opening it.
- baseURL String required
The target's x-callback-url endpoint, such as bear://x-callback-url/create.
- parameters Any
Query items to append, URL-encoded. No x-callback keys are added, so the target has no way to reply.
Examples
Run a Shortcut and get result
let result = CallbackURL.open(
"shortcuts://x-callback-url/run-shortcut",
{ name: "My Shortcut" }
);
if (result.ok) {
console.log(result.params);
}Build URL without opening
let url = CallbackURL.build(
"bear://x-callback-url/create",
{ title: "Note", text: "Hello" }
);
console.log(url);