Tasks are executed after the job is triggered and are the main building blocks of a job. You can string together as many tasks as you want.

All tasks


Send an email to a recipient with a text payload. Official Resend Docs

  // Using the 'io.resend.sendEmail' method to send an email using Resend.
  await io.resend.sendEmail("send-email", {
    to: <recipient-email-address>, // Recipient's email address.
    subject: <email-subject>, // Email subject.
    text: <email-body>, // Plain text content of the email.
    from: "Your-Name <your-email-address>", // Sender's email address and name.


Function NameDescription
emails.sendSend an email
emails.createCreate an email
emails.getGet an email
batch.sendSend a batch of emails at once
batch.createCreate a batch of emails at once
audiences.createCreate an audience
audiences.getGet an audience
audiences.removeRemove an audience
audiences.listList audiences
contacts.createCreate a contact
contacts.getGet a contact
contacts.updateUpdate a contact
contacts.removeRemove a contact
contacts.listList contacts


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!,

  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: {
  run: async (payload, io, ctx) => {
    await io.resend.emails.send("send-email", {
      to: payload.to,
      subject: payload.subject,
      text: payload.text,
      from: "Trigger.dev <[email protected]>",

Was this page helpful?