Access is invite-only during beta. Once invited, create a key to personalize these examples. Production sending requires a separate review.

Send emails with Trigger.dev

Install the Trigger.dev adapter and call sendEmail from a task.

sendEmail posts to POST /api/v1/teams/:teamId/clusters/:clusterId/sends. clusterId is required. Put catchPostShibaError on the task. A 429 with error throttled is the hourly throttle or 24-hour cap. Do not retry that send immediately. Permanent errors skip retrying.

Pass a stable idempotencyKey so a retried task does not double-send.

send.ts
1 import { task } from "@trigger.dev/sdk"
2 import { catchPostShibaError, defaultRetry, sendEmail } from "@postshiba/trigger"
3
4 export const sendWelcome = task({
5 id: "send-welcome",
6 retry: defaultRetry,
7 catchError: async ({ error }) => catchPostShibaError(error),
8 run: async (payload: { to: string; id: string }) => {
9 return await sendEmail(
10 {
11 apiKey: "YOUR_API_KEY",
12 teamId: "KjkAJW",
13 clusterId: "NmQpXr",
14 },
15 {
16 from: "hello@mail.example.com",
17 to: [payload.to],
18 subject: "Welcome",
19 text: "Glad you are here.",
20 idempotencyKey: payload.id,
21 },
22 )
23 },
24 })

Installation

install.sh
1 npm install github:postshiba/postshiba-trigger @trigger.dev/sdk

Node 18 or later. Open pull requests on postshiba/sdks.

Webhooks

http.ts
1 import { task } from "@trigger.dev/sdk"
2 import { handleWebhook } from "@postshiba/trigger"
3
4 export const processEmailEvent = task({
5 id: "process-email-event",
6 run: async (event: unknown) => event,
7 })
8
9 export async function POST(req: Request) {
10 return handleWebhook(req, {
11 secret: process.env.POSTSHIBA_WEBHOOK_SECRET!,
12 trigger: async (event) => {
13 await processEmailEvent.trigger(event)
14 },
15 })
16 }

HMAC-SHA256 of {timestamp}.{rawBody} against X-Capsule-Signature with a sha256= prefix. X-Capsule-Timestamp must be within 300 seconds.

Errors and throttling

Failed responses throw PostShibaHttpError with status, code, and retryable. Permanent errors become AbortTaskRunError.

A 429 with error throttled means the cluster hit its hourly throttle or its 24-hour cap. catchPostShibaError waits before retrying. Do not retry that send immediately.

See Errors.

About

PostShiba is the email platform that powers Bento behind the scenes. You can build your own products, like Bento, on top of it.

© 2026 PostShiba by Backpack Internet Pty. Ltd. All rights reserved.

The same policies that govern Bento are applied to PostShiba Privacy | Terms | Security