npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@weweb/backend-resend

v0.2.3

Published

Resend integration for WeWeb backend services

Readme

WeWeb Resend Integration

A WeWeb backend integration for Resend's email API, providing robust email sending capabilities within WeWeb backend workflows. This integration uses the official resend package for reliable email delivery with features like HTML templates, attachments, and tracking.

Features

  • Simple integration with Resend's email API
  • Send transactional emails with HTML or plain text content
  • Support for CC, BCC, and reply-to fields
  • File attachments support
  • Email tracking capabilities
  • Domain management functions
  • API key management

Installation

This package is designed to work with the WeWeb Supabase Backend Builder and Deno.

import { serve } from '@weweb/backend-core';
import { createResendIntegration } from '@weweb/backend-resend';

Usage

Basic Setup

import type { BackendConfig } from '@weweb/backend-core';
import { serve } from '@weweb/backend-core';
import Resend from '@weweb/backend-resend';

// Define your backend configuration
const config: BackendConfig = {
  workflows: [
    // Your workflows here
  ],
  integrations: [
    // Use the default Resend integration
    Resend,
    // Or add other integrations
  ],
  production: false,
};

// Start the server
const server = serve(config);

Custom Configuration

You can customize the Resend client by using the createResendIntegration function:

import { createResendIntegration } from '@weweb/backend-resend';

// Create a custom Resend integration
const customResend = createResendIntegration({
  apiKey: 're_123456789', // Override environment variable
});

If not specified, the integration will use the following environment variable:

  • RESEND_API_KEY - Your Resend API Key

Available Methods

Send Email

Send transactional emails to one or multiple recipients.

// Example workflow action
const config = {
  type: 'action',
  id: 'send_welcome_email',
  actionId: 'resend.send_email',
  inputMapping: [
    {
      from: '[email protected]',
      to: '$body.email',
      subject: 'Welcome to Our Platform',
      html: '<h1>Welcome!</h1><p>Thank you for signing up.</p>',
      text: 'Welcome! Thank you for signing up.'
    }
  ]
};

Get Email

Retrieve details about a sent email.

// Example workflow action
const config = {
  type: 'action',
  id: 'get_email_details',
  actionId: 'resend.get_email',
  inputMapping: [
    {
      id: '$body.emailId'
    }
  ]
};

List Emails

Get a list of all sent emails with pagination support.

// Example workflow action
const config = {
  type: 'action',
  id: 'list_recent_emails',
  actionId: 'resend.list_emails',
  inputMapping: [
    {
      limit: 20
    }
  ]
};

Create Domain

Add a new domain to your Resend account.

// Example workflow action
const config = {
  type: 'action',
  id: 'add_new_domain',
  actionId: 'resend.create_domain',
  inputMapping: [
    {
      name: 'marketing.yourdomain.com',
      region: 'us-east-1'
    }
  ]
};

List Domains

Get a list of all domains in your Resend account.

// Example workflow action
const config = {
  type: 'action',
  id: 'get_all_domains',
  actionId: 'resend.list_domains',
  inputMapping: [{}]
};

Example: Complete Email Service Application

import type { BackendConfig } from '@weweb/backend-core';
import { serve } from '@weweb/backend-core';
import Resend from '@weweb/backend-resend';

const config: BackendConfig = {
  workflows: [
    {
      path: '/send-email',
      methods: ['POST'],
      security: {
        accessRule: 'public',
      },
      inputsValidation: {
        body: {
          type: 'object',
          properties: {
            to: { type: 'string' },
            subject: { type: 'string' },
            message: { type: 'string' },
            template: { type: 'string', enum: ['welcome', 'password_reset', 'invoice'] }
          },
          required: ['to', 'subject', 'message', 'template'],
        },
      },
      workflow: [
        {
          type: 'action',
          id: 'send_email',
          actionId: 'resend.send_email',
          inputMapping: [
            {
              from: '[email protected]',
              to: '$body.to',
              subject: '$body.subject',
              html: `
                {{#if (eq $body.template 'welcome')}}
                  <h1>Welcome to Our Service</h1>
                {{else if (eq $body.template 'password_reset')}}
                  <h1>Password Reset Request</h1>
                {{else if (eq $body.template 'invoice')}}
                  <h1>Your Invoice</h1>
                {{/if}}
                <div>{{$body.message}}</div>
                <footer>© Your Company 2025</footer>
              `,
              text: '$body.message'
            },
          ],
        },
      ],
    },
  ],
  integrations: [Resend],
  production: false,
};

console.log('Starting email service on http://localhost:8000/send-email');
serve(config);

Authentication

This integration uses the official Resend client and requires a Resend API key to function:

You can get your API key from the Resend Dashboard.

Getting Started with Resend

  1. Create a Resend account at resend.com
  2. Verify your domain to ensure better deliverability
  3. Generate an API key from the dashboard
  4. Set the RESEND_API_KEY environment variable or provide it in the configuration

Resend offers features like:

  • Email analytics and tracking
  • Bounce handling
  • Template management
  • Webhook integration for delivery status
  • Domain verification for improved deliverability

For full details, see Resend's documentation.