Skip to content

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 ​

{{currentMethod}}
ts
import { open } from 'protocol-launcher/drafts'

const url = open()

Open Existing Draft ​

{{currentMethod}}
ts
import { open } from 'protocol-launcher/drafts'

const url = open({
  uuid: 'UUID-TO-VALID-DRAFT',
})

Open Draft by Title ​

{{currentMethod}}
ts
import { open } from 'protocol-launcher/drafts'

const url = open({
  title: 'MyDraft/Header Name',
})

Create New Draft ​

{{currentMethod}}
ts
import { create } from 'protocol-launcher/drafts'

const url = create({
  text: 'Hello World',
})

Create Draft with Tags ​

{{currentMethod}}
ts
import { create } from 'protocol-launcher/drafts'

const url = create({
  text: 'Hello World',
  tag: ['work', 'important'],
  flagged: true,
})

Get Draft Content ​

{{currentMethod}}
ts
import { get } from 'protocol-launcher/drafts'

const url = get({
  uuid: 'UUID-TO-VALID-DRAFT',
})

Get Draft with Return Parameter ​

{{currentMethod}}
ts
import { get } from 'protocol-launcher/drafts'

const url = get({
  uuid: 'UUID-TO-VALID-DRAFT',
  retParam: 'input',
})

Search Drafts ​

{{currentMethod}}
ts
import { search } from 'protocol-launcher/drafts'

const url = search({
  query: 'meeting',
  tag: 'work',
  folder: 'inbox',
})

Append Text to Draft ​

{{currentMethod}}
ts
import { append } from 'protocol-launcher/drafts'

const url = append({
  uuid: 'UUID-TO-VALID-DRAFT',
  text: 'TEXT-TO-ADD',
})

Append Text with Action ​

{{currentMethod}}
ts
import { append } from 'protocol-launcher/drafts'

const url = append({
  uuid: 'xxx',
  text: 'Suffix',
  action: 'MyAction',
})

Prepend Text to Draft ​

{{currentMethod}}
ts
import { prepend } from 'protocol-launcher/drafts'

const url = prepend({
  uuid: 'UUID-TO-VALID-DRAFT',
  text: 'TEXT-TO-ADD',
})

Prepend Text with Tags ​

{{currentMethod}}
ts
import { prepend } from 'protocol-launcher/drafts'

const url = prepend({
  uuid: 'xxx',
  text: 'Prefix',
  tag: ['work', 'important'],
})

Capture Text ​

{{currentMethod}}
ts
import { capture } from 'protocol-launcher/drafts'

const url = capture({
  text: 'Note',
  tag: 'work,important',
})

Dictate Text ​

{{currentMethod}}
ts
import { dictate } from 'protocol-launcher/drafts'

const url = dictate({
  locale: 'en-US',
  save: false,
  xSuccess: 'myapp://callback',
})

Load Workspace ​

{{currentMethod}}
ts
import { workspace } from 'protocol-launcher/drafts'

const url = workspace({
  name: 'Default',
})

Run Action on Text ​

{{currentMethod}}
ts
import { runAction } from 'protocol-launcher/drafts'

const url = runAction({
  text: 'TEXT',
  action: 'VALID-ACTION-NAME',
})
{{currentMethod}}
ts
import { quickSearch } from 'protocol-launcher/drafts'

const url = quickSearch({
  query: 'QUERY-TEXT',
})

Arrange Text ​

{{currentMethod}}
ts
import { arrange } from 'protocol-launcher/drafts'

const url = arrange({
  text: 'unsorted list',
  retParam: 'input',
  xSuccess: 'myapp://callback',
})
{{currentMethod}}
ts
import { actionSearch } from 'protocol-launcher/drafts'

const url = actionSearch({
  query: 'QUERY-TEXT',
})

Command Palette ​

{{currentMethod}}
ts
import { commandPalette } from 'protocol-launcher/drafts'

const url = commandPalette({
  query: 'QUERY-TEXT',
})

Get Current Draft ​

{{currentMethod}}
ts
import { getCurrentDraft } from 'protocol-launcher/drafts'

const url = getCurrentDraft({
  xSuccess: 'myapp://callback',
})

Load Action Bar Group ​

{{currentMethod}}
ts
import { loadActionBarGroup } from 'protocol-launcher/drafts'

const url = loadActionBarGroup({
  name: 'GROUP-NAME',
})

Load Action Group ​

{{currentMethod}}
ts
import { loadActionGroup } from 'protocol-launcher/drafts'

const url = loadActionGroup({
  name: 'GROUP-NAME',
})

Replace Range in Draft ​

{{currentMethod}}
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 ​

{{currentMethod}}
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.

{{currentMethod}}
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.

{{currentMethod}}
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.

{{currentMethod}}
ts
import { create } from 'protocol-launcher/drafts'

const callbackUrl = create({
  'text': 'Hello Drafts',
  'xSuccess': 'myapp://done?source=drafts'
})

Official Documentation ​