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 🙏

© 2026 – Pkg Stats / Ryan Hefner

thormail-adapter-generic-rest

v1.0.5

Published

Standard REST API adapter for ThorMail. Send messages via any RESTful service with configurable URL, method, and headers.

Downloads

619

Readme

ThorMail Generic REST API Adapter

A highly configurable adapter for ThorMail that allows sending messages to any generic REST API.

[!IMPORTANT] To use this adapter, you must have a running instance of ThorMail installed. This adapter is designed to be installed and managed directly from the ThorMail Admin Panel.

Installation

  1. Go to your ThorMail Admin Panel.
  2. Navigate to the Adapters section.
  3. Click Add New Adapter.
  4. Search for thormail-adapter-generic-rest and click Install.

📖 Overview

This adapter provides a flexible bridge between ThorMail and any external service that accepts HTTP requests (POST, PUT, PATCH, GET). It is ideal for:

  • Integrating with bespoke internal APIs.
  • Connecting to small providers without dedicated adapters.
  • Prototyping new integrations quickly.
  • Webhook-based messaging.

🛠️ Configuration

When creating a new Connection in ThorMail, select Generic REST API and configure the following fields:

| Field | Type | Description | |-------|------|-------------| | Base URL | text | The full HTTP(S) endpoint of the external API. | | HTTP Method| select | The method to use (POST, PUT, PATCH, GET). | | Custom Headers | customHeaders | Headers required for authentication or metadata (e.g., Authorization). | | Payload Template | json-template | A JSON template with {{to}}, {{subject}}, and {{body}} placeholders. | | Success Status Code(s) | text | Comma-separated list of successful HTTP codes (default: 200,201,202). |

Payload Replacements

You can use the following variables in your Payload Template:

  • {{to}}: The recipient's identifier (address, phone, ID).
  • {{subject}}: The message subject or title.
  • {{body}}: The main content of the message.
  • {{any_data_key}}: Any key passed in the data object during the send request.

Example Configuration: Simple Webhook

  • Base URL: https://hooks.example.com/services/T0000/B0000/XXXX
  • Method: POST
  • Payload Template:
{
  "text": "New Mail to {{to}}: {{subject}}",
  "details": "{{body}}"
}

Example Configuration: authenticated API

  • Base URL: https://api.provider.com/v1/messages
  • Method: POST
  • Custom Headers:
    • X-API-Key: your-secret-key
    • Content-Type: application/json
  • Payload Template:
{
  "recipient": "{{to}}",
  "title": "{{subject}}",
  "html_body": "{{body}}",
  "metadata": {
    "source": "thormail"
  }
}

🚀 Features

  • Standard Idempotency: Automatically sends Idempotency-Key or X-Idempotency-Key headers if available.
  • Smart Retries: Correctly identifies 429 and 5xx errors as temporary for ThorMail's retry logic.
  • Custom Success Logic: Configurable success status codes to match legacy or non-standard APIs.
  • Dynamic Headers: Merges headers provided in the specific send request with the global configuration.

📜 License

This adapter is licensed under the MIT License. See the main ThorMail repository for details.


Powered by ThorMail - The God of Deliveries.