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

open-message

v1.0.4

Published

Template-first messaging tool for Slack, Notion, and more

Readme


open-message lets you define your messages as YAML or JSON templates — including the destination, formatting, and variables — and send them from the CLI or your Node.js code.

Features

  • Template-first — message structure, destination, and variables all live in one file
  • YAML or JSON templates
  • CLI for use in CI/CD pipelines
  • Programmatic API for use in Node.js applications
  • Variable interpolation with {{var}}, env vars ({{MY_ENV_VAR}}), and built-ins ({{now}}, {{uuid}})
  • Built-in adapter for Slack (Block Kit)

Documentation

Detailed template and DSL docs (templates, variables, Slack blocks and elements):

| Doc | Description | |-----|-------------| | DSL overview | What the template DSL is, Slack shorthand vs raw Block Kit | | Template structure | version, name, destination, variables, message | | Variables | Interpolation, {{tokens}}, resolution order, built-ins, env | | Slack blocks | header, section, context, divider, actions, image, video, markdown, file, table, raw | | Slack elements | button, overflow, select, multi_select, datepicker, timepicker | | Examples | Full template examples |

Each doc has Previous / Next links at the bottom to move through the guide.

Installation

npm install open-message

For CLI use, install globally:

npm install -g open-message

Quick start

1. Create a template (./templates/deploy.yml):

version: '1'
name: Deploy Notification
destination:
  service: slack
  settings:
    channel: '#deployments'
variables:
  app_name:
    required: true
  version:
    required: true
  environment:
    default: production
message:
  blocks:
    - type: header
      text:
        type: plain_text
        text: ':rocket: {{app_name}} deployed to {{environment}}'
    - type: section
      fields:
        - type: mrkdwn
          text: '*Version:*\n`{{version}}`'
        - type: mrkdwn
          text: '*Status:*\n:large_green_circle: Success'
    - type: context
      elements:
        - type: mrkdwn
          text: 'Deployed at {{now}}'

2. Set your credentials:

export SLACK_TOKEN=xoxb-your-token

3. Send it:

open-message send ./templates/deploy.yml --var app_name=api --var version=1.2.3

CLI

open-message send <path> [options]        Send a message
open-message validate <path>              Validate a template
open-message list <dir>                   List templates in a directory

open-message send options

| Flag | Description | |---|---| | -v, --var <key=value> | Set a template variable (repeatable) | | --dry-run | Print resolved payload without sending | | --json | Output result as JSON (for scripting) | | --config <file> | Path to a credentials config file | | -e, --env-file <file> | Load a .env file for credentials |

Examples

# Send with variables
open-message send ./templates/deploy.yml --var app_name=api --var version=2.0.0

# Preview the resolved payload
open-message send ./templates/deploy.yml --var app_name=api --var version=2.0.0 --dry-run

# JSON output for CI/CD scripting
open-message send ./templates/build-report.yml --var branch=main --var status=passing --json

# Validate a template
open-message validate ./templates/slack-deploy.yml

# List templates in a directory
open-message list ./templates

Programmatic API

import openMessage from 'open-message';

// Send a message
await openMessage.send('./templates/deploy.yml', { app_name: 'api', version: '1.2.3' });

// With options (dry-run, limits/chunking for long messages)
await openMessage.send('./templates/deploy.yml', { app_name: 'api', version: '2.0.0' }, {
  dryRun: true,
  limits: { maxBlocksPerMessage: 40, maxMessageChars: 8000 },
  chunking: { enabled: true, footerTemplate: 'Part {{ index }} of {{ total }}' },
});

Templates can use multiple destinations (destinations array) to send the same message to several channels or services; see Template structure.

Template DSL

All templates share a common shape: version, name, destination, optional variables, and message. For Slack you can use DSL shorthand (e.g. header, section, context) or raw Block Kit.

Quick reference:

  • Variable tokens{{my_var}} (caller/API), {{MY_ENV_VAR}} (env, ALL_CAPS only), {{now}}, {{timestamp}}, {{uuid}}. Resolution order: built-ins → caller vars → env (ALL_CAPS) → template defaults.
  • Full reference — See Documentation above for the full DSL guide (template structure, variables, Slack blocks and elements, examples).

Credentials

Credentials are resolved in this priority order (highest wins):

  1. Programmatic opts.credentials
  2. CLI --config <file>
  3. Environment variables
  4. .open-message.yml in the current directory
  5. ~/.open-message/config.yml

Environment variables

SLACK_TOKEN=xoxb-...

Config file (.open-message.yml or ~/.open-message/config.yml)

slack:
  botToken: xoxb-your-token

License

MIT