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

line-bot-sdk-rs

v1.1.0

Published

High-performance LINE Messaging API SDK built with Rust and NAPI-RS

Readme

line-bot-sdk

High-performance LINE Messaging API SDK for Node.js / TypeScript, powered by Rust native bindings via napi-rs.

Disclaimer: This is a community SDK and is not affiliated with or endorsed by LINE Corporation. For the official SDK, see @line/bot-sdk.

Features

  • Native performance — core HTTP client and crypto run in Rust
  • Full TypeScript support — auto-generated types + ergonomic wrapper
  • Messaging — push, reply, multicast, broadcast, quota, content download
  • Profile & followers — user profile, follower IDs
  • Group & room — member profiles, member IDs, leave group/room
  • Rich menu — create, upload image, link/unlink, bulk operations
  • Insight — message delivery overview, followers statistics
  • Webhook — signature verification and typed event parsing

Requirements

  • Node.js >= 18.17.0 (or 20+, 21+)
  • Rust (for building from source)

Installation

npm install line-bot-sdk-rs
# or
yarn add line-bot-sdk-rs

Quick Start

1. Create a client

Get your Channel Access Token from LINE Developers Console.

import { LineClient } from 'line-bot-sdk-rs'

const client = new LineClient(process.env.LINE_CHANNEL_ACCESS_TOKEN!)

const bot = await client.getBotInfo()
console.log(bot.displayName)

2. Send messages

await client.pushText('Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Hello from line-bot-sdk!')

await client.pushMessages('Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', [
  { type: 'text', text: 'Hello!' },
  { type: 'sticker', packageId: '446', stickerId: '1988' },
])

await client.replyText(replyToken, 'Got your message!')

3. Get user profile

const profile = await client.getProfile('Uxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
console.log(profile.displayName, profile.pictureUrl)

4. Webhook handler (Next.js / Express)

For Next.js, add serverExternalPackages in next.config.ts and use a Route Handler (server-side only):

// next.config.ts
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  serverExternalPackages: ['line-bot-sdk-rs'],
}

export default nextConfig
import { verifySignature, parseWebhook, LineClient } from 'line-bot-sdk-rs'

const CHANNEL_SECRET = process.env.LINE_CHANNEL_SECRET!
const client = new LineClient(process.env.LINE_CHANNEL_ACCESS_TOKEN!)

export async function POST(req: Request) {
  const rawBody = await req.text()
  const signature = req.headers.get('x-line-signature') ?? ''

  if (!verifySignature(rawBody, signature, CHANNEL_SECRET)) {
    return new Response('Invalid signature', { status: 401 })
  }

  const { events } = parseWebhook(rawBody)

  for (const event of events) {
    if (event.type === 'message' && event.message?.type === 'text') {
      await client.replyText(event.replyToken!, `You said: ${event.message.text}`)
    }
  }

  return new Response('OK')
}

API Overview

LineClient

| Category | Methods | | ------------- | ---------------------------------------------------------------------------------------- | | Bot | getBotInfo() | | Messaging | pushText, pushMessages, replyText, replyMessages, multicast, broadcast | | Quota | getMessageQuota(), getMessageQuotaConsumption() | | Content | getMessageContent(messageId) | | Profile | getProfile(userId), getFollowerIds(next?) | | Group | getGroupSummary, getGroupMemberProfile, getGroupMemberIds, leaveGroup | | Room | getRoomMemberProfile, getRoomMemberIds, leaveRoom | | Rich Menu | createRichMenu, uploadRichMenuImage, setDefaultRichMenu, linkRichMenuToUser, ... | | Insight | getMessageDeliveryOverview(date), getFollowersInsight(date) |

Webhook helpers

| Function | Description | | ------------------------------------------------- | ------------------------------------------- | | verifySignature(body, signature, channelSecret) | Validate X-Line-Signature header | | parseWebhook(body) | Parse webhook JSON into typed WebhookBody |

Environment Variables

| Variable | Description | | --------------------------- | ------------------------------------------------- | | LINE_CHANNEL_ACCESS_TOKEN | Channel access token for API calls | | LINE_CHANNEL_SECRET | Channel secret for webhook signature verification |

Never commit tokens to git. Use .env locally and secrets in CI/production.

Development

yarn install
yarn build:debug
yarn test

# Integration test with a real token
LINE_CHANNEL_ACCESS_TOKEN=xxx yarn test

Publishing

Platform binaries are built in CI for macOS, Linux, and Windows. To publish a new version:

  1. Bump version in package.json (and run yarn version if you use git tags).
  2. Add NPM_TOKEN to GitHub repository secrets.
  3. Push a version tag:
git tag v1.0.1
git push origin v1.0.1

CI will build all platform .node files, run tests, and publish line-bot-sdk-rs plus the platform packages to npm.

Important: Do not run npm publish locally without CI artifacts — platform packages would ship without .node binaries (this caused the v1.0.0 install error).

Jenkins

Use the included Jenkinsfile at the repo root. Setup:

  1. Agents with labels: linux-x64, windows-x64, macos (each needs Node 22+, Rust, Yarn via corepack).
  2. Credential in Jenkins: ID NPM_TOKEN (Secret text) — your npm access token.
  3. Job trigger: Multibranch Pipeline or Pipeline from SCM, filter branches/tags v*.
  4. Publish: runs automatically when the build is triggered by a tag like v1.0.1.

Flow mirrors GitHub Actions: parallel native builds → test → collect artifacts → yarn artifactsnpm publish.

Project structure

src/
├── client.rs          # HTTP client & auth
├── api/endpoints.rs   # LINE API URL paths
├── services/          # API methods (messaging, profile, group, ...)
├── types/             # Request/response types
└── webhook.rs         # Signature verify & event parsing

typescript/
├── line-client.ts     # Ergonomic TypeScript wrapper
└── types.ts           # Shared TypeScript types

Low-level API

Call the native binding directly if you prefer:

import { LineClient } from './index'

const client = new LineClient(token)
await client.pushMessage('Uxxx', 'hello')
await client.getProfile('Uxxx')

The TypeScript wrapper in typescript/line-client.ts provides a cleaner API (objects instead of JSON strings).

Platform Support

Prebuilt binaries for:

  • macOS (x64, arm64)
  • Linux (x64 gnu)
  • Windows (x64)

Built with napi-rs — no node-gyp or C++ toolchain required for end users.

Related Projects

License

MIT © Panudetingai