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

elysia-line

v1.0.3

Published

Official LINE Messaging API webhook plugin for Elysia — clean, typed, zero-config

Readme

elysia-line

Official LINE Messaging API webhook plugin for Elysia — clean, typed, zero-config.

This plugin for ElysiaJS simplifies the process of creating LINE bots by providing a clean, typed, and zero-config integration with the official LINE bot SDK.

Features

  • Zero-config: Just provide your channel secret and access token.
  • Type-safe: Fully typed event handling for all webhook events.
  • Easy to use: A simple and intuitive API for handling events and sending messages.
  • Official SDK: Built on top of the official @line/bot-sdk.

Installation

bun add elysia-line

Usage

import { Elysia } from "elysia";
import { line } from "elysia-line";

const app = new Elysia()
  .use(
    line({
      channelSecret: process.env.LINE_CHANNEL_SECRET!,
      channelAccessToken: process.env.LINE_CHANNEL_ACCESS_TOKEN!,
    })
  )
  .post("/webhook", async ({ line, set }) => {
    if (!line) {
      return "Not a LINE webhook";
    }

    line.on("message:text", (event) => {
      line.reply(event.replyToken, {
        type: "text",
        text: `You said: ${event.message.text}`,
      });
    });

    await line.handle();
    return "OK";
  })

  .listen(3000);

console.log(`Elysia is running at http://localhost:3000`);

API

line(options: LineOptions)

The main plugin function.

  • options.channelSecret: Your LINE channel secret.
  • options.channelAccessToken: Your LINE channel access token.
  • options.verbose (optional): Set to true to enable detailed, colorful logging for debugging. Defaults to false.

line.on(eventType, handler)

Registers an event handler for a specific event type. The event object in the handler is fully typed based on the eventType.

Supported event types:

  • message:text
  • message:image
  • message:video
  • message:audio
  • message:file
  • message:location
  • message:sticker
  • follow
  • unfollow
  • join
  • leave
  • postback
  • beacon
  • * (wildcard for all events)

line.reply(replyToken, messages)

Replies to a message.

line.push(to, messages)

Pushes a message to a user, group, or room.

line.getEvents()

Returns the raw webhook events.

line.getClient()

Returns the underlying MessagingApiClient from the @line/bot-sdk for advanced usage.

Exports

This package exports the following main components:

  • line: The main Elysia plugin.
  • LineHelper: The helper class for handling events and sending messages. You can access it via context.line.
  • LineLogger: The internal logger class.
  • All relevant types from the @line/bot-sdk, such as WebhookEvent, MessageEvent, etc.

Project Structure

The project is organized into the following directories:

  • src/: The main source code directory.
    • core/: Contains the core logic, like the LineHelper class.
    • logger/: Contains the LineLogger class for logging.
    • plugin/: Contains the main Elysia plugin logic.
    • types/: Contains all type definitions for the plugin.
    • index.ts: The main entry point, which exports all public APIs.
  • dist/: The compiled JavaScript output.
  • test/: Example and test applications.

Development

This project uses Bun for package management and running scripts.

To install dependencies:

bun install

To build the project (compiles TypeScript from src/ to JavaScript in dist/):

bun run build

To run the example application located in test/app.ts:

bun run test/app.ts