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

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

const url = open()

Open Existing Draft

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

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

Open Draft by Title

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

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

Create New Draft

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

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

Create Draft with Tags

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

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

Get Draft Content

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

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

Get Draft with Return Parameter

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

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

Search Drafts

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

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

Append Text to Draft

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

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

Append Text with Action

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

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

Prepend Text to Draft

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

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

Prepend Text with Tags

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

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

Capture Text

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

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

Dictate Text

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

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

Load Workspace

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

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

Run Action on Text

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

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

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

Arrange Text

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

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

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

Command Palette

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

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

Get Current Draft

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

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

Load Action Bar Group

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

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

Load Action Group

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

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

Replace Range in Draft

On-Demand
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

On-Demand
ts
import { scanDocument } from 'protocol-launcher/drafts'

const url = scanDocument({
  save: false,
  retParam: 'input',
  xSuccess: 'myapp://callback',
})