Skip to content
← Public packages

@kody/agent-mail

AgentMail inboxes for agents: create/list inboxes, messages, threads, and Svix webhook ingress.

src/get-inbox.ts

25 lines · 688 B · TypeScript
import { agentMailRequest, encodePathSegment } from './core.ts'

export type GetInboxInput = {
	inboxId: string
}

/**
 * Get one AgentMail inbox by id.
 * Read-only; uses GET /v0/inboxes/{inbox_id}.
 *
 * @param input.inboxId - AgentMail inbox id (required)
 * @returns Inbox object from AgentMail
 *
 * @example
 * import getInbox from 'kody:@kody/agent-mail/get-inbox'
 * const inbox = await getInbox({ inboxId: 'inbox_123' })
 */
export default async function getInbox(input: GetInboxInput) {
	const inboxId = encodePathSegment(input.inboxId, 'inboxId')
	const inbox = await agentMailRequest({
		path: `/v0/inboxes/${inboxId}`,
		label: 'AgentMail get inbox',
	})
	return { inbox }
}