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/entries.js

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

/**
 * List entries (messages) in a HEY topic.
 * Use when reading full purchase/shipping thread bodies after search.
 *
 * @param {{ topicId: number|string }} input
 * @returns {Promise<unknown[]>}
 *
 * @example
 * import getEntries from 'kody:@noah/hey-email/entries'
 * const entries = await getEntries({ topicId: 123456789 })
 */
export default async function getEntries(input) {
  const topicId = input?.topicId
  if (topicId == null) throw new Error('topicId is required')
  const data = await heyFetch(`/topics/${topicId}/entries.json`)
  return Array.isArray(data) ? data : []
}