English
Drafts
Drafts is a powerful text capture and automation app for Apple platforms (iPhone, iPad, Mac, Apple Watch). It allows you to quickly capture text and send it to other apps and services through actions. Protocol Launcher allows you to generate deep links to create, edit, and manage drafts in Drafts.
Usage
There are two ways to use this library:
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
- Full Import from the root package is convenient but includes all app modules.
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
Select Installation Method
On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.
Open Drafts
ts
import { open } from 'protocol-launcher/drafts'
const url = open()Open Existing Draft
ts
import { open } from 'protocol-launcher/drafts'
const url = open({
uuid: 'UUID-TO-VALID-DRAFT',
})Open Draft by Title
ts
import { open } from 'protocol-launcher/drafts'
const url = open({
title: 'MyDraft/Header Name',
})Create New Draft
ts
import { create } from 'protocol-launcher/drafts'
const url = create({
text: 'Hello World',
})Create Draft with Tags
ts
import { create } from 'protocol-launcher/drafts'
const url = create({
text: 'Hello World',
tag: ['work', 'important'],
flagged: true,
})Get Draft Content
ts
import { get } from 'protocol-launcher/drafts'
const url = get({
uuid: 'UUID-TO-VALID-DRAFT',
})Get Draft with Return Parameter
ts
import { get } from 'protocol-launcher/drafts'
const url = get({
uuid: 'UUID-TO-VALID-DRAFT',
retParam: 'input',
})Search Drafts
ts
import { search } from 'protocol-launcher/drafts'
const url = search({
query: 'meeting',
tag: 'work',
folder: 'inbox',
})Append Text to Draft
ts
import { append } from 'protocol-launcher/drafts'
const url = append({
uuid: 'UUID-TO-VALID-DRAFT',
text: 'TEXT-TO-ADD',
})Append Text with Action
ts
import { append } from 'protocol-launcher/drafts'
const url = append({
uuid: 'xxx',
text: 'Suffix',
action: 'MyAction',
})Prepend Text to Draft
ts
import { prepend } from 'protocol-launcher/drafts'
const url = prepend({
uuid: 'UUID-TO-VALID-DRAFT',
text: 'TEXT-TO-ADD',
})Prepend Text with Tags
ts
import { prepend } from 'protocol-launcher/drafts'
const url = prepend({
uuid: 'xxx',
text: 'Prefix',
tag: ['work', 'important'],
})Capture Text
ts
import { capture } from 'protocol-launcher/drafts'
const url = capture({
text: 'Note',
tag: 'work,important',
})Dictate Text
ts
import { dictate } from 'protocol-launcher/drafts'
const url = dictate({
locale: 'en-US',
save: false,
xSuccess: 'myapp://callback',
})Load Workspace
ts
import { workspace } from 'protocol-launcher/drafts'
const url = workspace({
name: 'Default',
})Run Action on Text
ts
import { runAction } from 'protocol-launcher/drafts'
const url = runAction({
text: 'TEXT',
action: 'VALID-ACTION-NAME',
})Quick Search
ts
import { quickSearch } from 'protocol-launcher/drafts'
const url = quickSearch({
query: 'QUERY-TEXT',
})Arrange Text
ts
import { arrange } from 'protocol-launcher/drafts'
const url = arrange({
text: 'unsorted list',
retParam: 'input',
xSuccess: 'myapp://callback',
})Action Search
ts
import { actionSearch } from 'protocol-launcher/drafts'
const url = actionSearch({
query: 'QUERY-TEXT',
})Command Palette
ts
import { commandPalette } from 'protocol-launcher/drafts'
const url = commandPalette({
query: 'QUERY-TEXT',
})Get Current Draft
ts
import { getCurrentDraft } from 'protocol-launcher/drafts'
const url = getCurrentDraft({
xSuccess: 'myapp://callback',
})Load Action Bar Group
ts
import { loadActionBarGroup } from 'protocol-launcher/drafts'
const url = loadActionBarGroup({
name: 'GROUP-NAME',
})Load Action Group
ts
import { loadActionGroup } from 'protocol-launcher/drafts'
const url = loadActionGroup({
name: 'GROUP-NAME',
})Replace Range in Draft
ts
import { replaceRange } from 'protocol-launcher/drafts'
const url = replaceRange({
uuid: 'UUID-TO-VALID-DRAFT',
text: 'TEXT-TO-INSERT',
start: 0,
length: 10,
})Scan Document
ts
import { scanDocument } from 'protocol-launcher/drafts'
const url = scanDocument({
save: false,
retParam: 'input',
xSuccess: 'myapp://callback',
})Chat Console
Open the Chat Console with an optional prompt and mode: onDevice, pcc, claudeSonnet, or claudeOpus.
ts
import { chat } from 'protocol-launcher/drafts'
const url = chat({
mode: 'claudeSonnet',
prompt: 'Summarize this draft'
})Speak
Speak the supplied text. The text parameter is optional; the official reference does not specify the behavior when it is omitted.
ts
import { speak } from 'protocol-launcher/drafts'
const url = speak({
text: 'Hello, Drafts!'
})Callbacks
Pass xSuccess, xError, xCancel as optional payload fields. Callback URLs are encoded, including nested query parameters. Drafts makes the x-callback-url host optional. Existing URLs keep their original form; the app decides which callbacks apply to each action. The documented loadActionBarGroup command is retained; loadKeyboardActionGroup appears only in a legacy example.
ts
import { create } from 'protocol-launcher/drafts'
const callbackUrl = create({
'text': 'Hello Drafts',
'xSuccess': 'myapp://done?source=drafts'
})