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

@smartlyqofficial/chat-sdk-adapter

v0.1.0

Published

Build multi-platform chatbots on the SmartlyQ unified inbox - verified webhooks in, normalized messages to your handlers, replies out.

Readme

SmartlyQ Chat SDK Adapter

npm

Build a multi-platform chatbot on the SmartlyQ unified inbox. SmartlyQ aggregates DMs and comments from every connected social account and fires signed webhooks; this adapter verifies them, normalizes them, and hands them to your handler code with reply-capable helpers.

Write once - works on every platform your accounts cover (Instagram, Facebook, X, TikTok, LinkedIn, and the rest).

Platforms -> SmartlyQ unified inbox -> webhook -> this adapter -> your bot
                                                       |
                                 replies sent back via the SmartlyQ API

Installation

npm install @smartlyqofficial/chat-sdk-adapter

Three steps to a multi-platform chatbot

1. Get your SmartlyQ API key - from the Developer Dashboard; set it as SMARTLYQ_API_KEY.

2. Create a webhook subscribed to message.received and comment.received, pointing at your app. Save the whsec_... signing secret it returns.

3. Add the adapter to your app:

// app/api/smartlyq/route.ts (Next.js App Router)
import { createAdapter, toFetchHandler } from '@smartlyqofficial/chat-sdk-adapter';

const adapter = createAdapter({
  webhookSecret: process.env.SMARTLYQ_WEBHOOK_SECRET!,
  // apiKey: taken from SMARTLYQ_API_KEY automatically
})
  .onMessage(async ({ message, thread }) => {
    // Every DM from every platform lands here, normalized.
    if (message.text.toLowerCase().includes('pricing')) {
      await thread.post('Our plans start at... - full details: https://example.com/pricing');
    }
  })
  .onComment(async ({ comment, reply }) => {
    if (!comment.isReply) {
      await reply(`Thanks ${comment.authorName ?? 'friend'}!`);
    }
  });

export const POST = toFetchHandler(adapter);

Express instead? Mount with a raw body and toNodeHandler:

import express from 'express';
import { toNodeHandler } from '@smartlyqofficial/chat-sdk-adapter';

app.post('/webhooks/smartlyq', express.raw({ type: '*/*' }), toNodeHandler(adapter));

Wiring an AI reply

The handler is plain code - call any model you like:

adapter.onMessage(async ({ message, thread }) => {
  const history = await thread.fetchMessages();
  const answer = await yourModel.respond(message.text, history);
  await thread.post(answer);
});

Prefer zero code? SmartlyQ also has a built-in chatbot builder with an inbox bridge - train it on your content in the dashboard and skip the adapter entirely. This package is for when you want full control.

Security

  • Every delivery is verified against your whsec_... secret (HMAC-SHA256, X-SmartlyQ-Signature: t=...,v1=..., 5-minute replay window) before your handlers run. Unverified requests get a 401.
  • Pass the raw request body to the adapter - JSON-parsing middlewares break signature verification.
  • Events other than message.received / comment.received are acknowledged and ignored, so a chat endpoint never causes webhook retries.

API

| Export | Purpose | | --- | --- | | createAdapter(options) | Build an adapter (webhookSecret required; apiKey or a preconfigured client optional) | | .onMessage(handler) | Handle incoming DMs - ctx: { message, thread: { id, post, fetchMessages }, raw } | | .onComment(handler) | Handle incoming comments - ctx: { comment, reply, raw } | | adapter.handleWebhook(rawBody, signatureHeader) | Framework-agnostic core - returns { status, body } | | toFetchHandler(adapter) | Request/Response wrapper (Next.js, Remix, Bun, Deno) | | toNodeHandler(adapter) | Node http / Express wrapper (raw body required) | | verifySignature(rawBody, header, secret) | Standalone signature check |

License

MIT