← Public packages
@tannerlinsley/imessage
Read, search, draft, and explicitly send iMessages on a Mac, using only built-in macOS tools.
Files
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);
}