Integrations

Resend

The standard way to call a third-party endpoint in your workflow is by using context.call.

However, if you need to call the Resend endpoint to send emails (/emails or /emails/batch), you can leverage the type-safe method context.api.resend.call method:

context.api.resend.call is not yet available in workflow-py. You can use context.call instead to work with Resend. See our Roadmap for feature parity plans and Changelog for updates.

Single Email
const { status, body } = await context.api.resend.call(  "Call Resend",  {    token: "<RESEND_API_KEY>",    body: {      from: "Acme <onboarding@resend.dev>",      to: ["delivered@resend.dev"],      subject: "Hello World",      html: "<p>It works!</p>",    },    headers: {      "content-type": "application/json",    },  });
Batch Email
const { status, body } = await context.api.resend.call(  "Call Resend",  {    batch: true,    token: "<RESEND_API_KEY>",    body: [      {        from: "Acme <onboarding@resend.dev>",        to: ["delivered@resend.dev"],        subject: "Hello World",        html: "<p>It works!</p>",      },      {        from: "Acme <onboarding@resend.dev>",        to: ["delivered@resend.dev"],        subject: "Hello World",        html: "<p>It works!</p>",      },    ],    headers: {      "content-type": "application/json",    },  });

The SDK provides predefined types for the body field in both the request parameters and the response, simplifying common use cases. If you need to customize these types, you can override them as shown below:

type IsBatch = true; // Set to either true or falsetype ResponseBodyType = { ... }; // Define your response body typetype RequestBodyType = { ... };  // Define your request body typeconst { status, body } = await context.api.resend.call<  IsBatch,  ResponseBodyType,  RequestBodyType>(  "Call Resend",  {    ...  });
Loading search…