Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@noah/hey-email

HEY.com email integration with Kody: search threads, read messages/attachments, create drafts, and send with explicit confirmation.

src/message.js

19 lines · 676 B · JavaScript
import { heyFetch } from './client.js'

/**
 * Fetch a full HEY message by entry/message id.
 * Use when reading body HTML (including trix PDF attachments) — entries list
 * does not include attachment markup.
 *
 * @param {{ messageId: number|string, entryId?: number|string }} input
 * @returns {Promise<any>}
 *
 * @example
 * import getMessage from 'kody:@noah/hey-email/message'
 * const msg = await getMessage({ messageId: 123456789 })
 */
export default async function getMessage(input) {
  const messageId = input?.messageId ?? input?.entryId
  if (messageId == null) throw new Error('messageId is required')
  return await heyFetch(`/messages/${messageId}.json`)
}