Integrations
Resend
Getting started
If you have not yet set up Trigger.dev in your project, go to the quick start guide.
Installation
npm install @trigger.dev/resend@latest
Authentication
Resend supports API Keys
import { Resend } from "@trigger.dev/resend";
const resend = new Resend({
id: "resend",
apiKey: process.env.RESEND_API_KEY!,
});
Example
In this example we use Zod, a TypeScript-first schema declaration and validation library.
import { Resend } from "@trigger.dev/resend";
import { Job, eventTrigger } from "@trigger.dev/sdk";
import { z } from "zod";
...
const resend = new Resend({
id: "resend",
apiKey: process.env.RESEND_API_KEY!,
});
client.defineJob({
id: "send-resend-email",
name: "Send Resend Email",
version: "0.1.0",
trigger: eventTrigger({
name: "send.email",
schema: z.object({
to: z.union([z.string(), z.array(z.string())]),
subject: z.string(),
text: z.string(),
}),
}),
integrations: {
resend,
},
run: async (payload, io, ctx) => {
await io.resend.sendEmail("send-email", {
to: payload.to,
subject: payload.subject,
text: payload.text,
from: "Trigger.dev <[email protected]>",
});
},
});
Tasks
Function Name | Description |
---|---|
sendEmail | Send an email |