Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@tannerlinsley/imessage

Read, search, draft, and explicitly send iMessages on a Mac, using only built-in macOS tools.

FollowFork

Files

draft.ts

17 lines · 912 B · TypeScript
import { draft } from "./core.ts";
import type { Target, MessageDraft, MessageService } from "./core.ts";
/**
 * Prepare a Messages draft for review without opening Messages or contacting anyone.
 * @param input - Exact target ({recipient: E.164 phone or email} OR {chatId: local conversation ID}) and text (1..8000 characters). Optional service defaults to iMessage. SMS and RCS require an existing chatId.
 * @returns The exact target, text, explicit service, and a digest that detects edits. This is a returned object, not a draft saved inside Messages.
 * @example
 * import prepare from 'kody:@tannerlinsley/imessage/draft';
 * const draft = await prepare({target:{recipient:'test@example.invalid'},text:'Synthetic preview, do not send.'});
 */
export default async function prepare(input: {
  target: Target;
  text: string;
  service?: MessageService;
}): Promise<MessageDraft> {
  return draft(input);
}