@inboxkit/sdk
v0.1.0
Published
Inboxkit SDK: read inboxes and events, verify inbound webhooks.
Readme
@inboxkit/sdk
Tiny TypeScript client for inboxkit. Read inboxes and events, verify inbound webhooks. Works in Node 18+, browsers, Cloudflare Workers, Bun, Deno. Zero dependencies.
Install
npm i @inboxkit/sdkRead inboxes and events
import { inboxkit } from '@inboxkit/sdk';
const client = inboxkit({ apiKey: process.env.INBOXKIT_KEY! });
const { data: inboxes } = await client.inboxes.list();
const { data: events } = await client.events.list({ inboxId: 'inb_...' });
const { data: event } = await client.events.get(events!.events[0]!.id);
console.log(event!.subject, event!.attachments[0]?.url);Every method returns { data, error }. No throwing on HTTP errors.
Verify a webhook
import { verifyWebhook } from '@inboxkit/sdk';
export async function POST({ request, env }) {
const event = await verifyWebhook(request, env.INBOXKIT_SECRET);
// event.from.address, event.subject, event.text_preview, event.attachments[0].url
return new Response('ok');
}verifyWebhook throws WebhookSignatureError if the signature is missing, malformed, stale, or does not match. Signature timestamps older than 5 minutes are rejected by default; pass { tolerance: 60 } to tighten.
Endpoints
GET /v1/inboxes
GET /v1/inboxes/:id
GET /v1/events?inbox_id=&cursor=&limit=
GET /v1/events/:idAll require Authorization: Bearer ik_live_.... Get a key from the dashboard at app.inboxkit.app/app/keys.
License
MIT
