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

@redoykumardas/snaplink-sdk

v1.0.2

Published

Unofficial Node.js SDK for Snapchat Web automation workflows.

Readme

SnapLink SDK

Unofficial Node.js SDK for automating Snapchat Web workflows with a clean, high-level API.

@redoykumardas/snaplink-sdk hides Puppeteer setup, browser lifecycle, login sessions, Snapchat selectors, scrolling, chat navigation, retries, message watching, and snap sending behind one client.

Highlights

  • Simple SnapchatClient API for auth, friends, messaging, snaps, and browser cleanup.
  • Automatic cookie restore/save with session.key.
  • Friend list and friend status extraction from Snapchat Web.
  • Message sending, conversation reading, bulk conversation reads, and event-based watchers.
  • Image snap creation with captions, friend IDs, groups, targets, and shortcuts.
  • ESM package with bundled TypeScript declarations.

Requirements

  • Node.js 20 or newer.
  • A Snapchat account you are authorized to operate.
  • A runtime that can launch Chromium through Puppeteer.

This SDK automates Snapchat Web through a browser. Snapchat UI changes can require SDK updates. Use it responsibly and keep your usage compliant with the services involved.

Installation

npm install @redoykumardas/snaplink-sdk

Quick Start

import { SnapchatClient } from "@redoykumardas/snaplink-sdk";

const snapchat = new SnapchatClient({
  browser: { headless: false },
  session: { key: process.env.SNAPCHAT_USERNAME },
});

try {
  await snapchat.init();

  if (!(await snapchat.isLoggedIn())) {
    await snapchat.login({
      username: process.env.SNAPCHAT_USERNAME,
      password: process.env.SNAPCHAT_PASSWORD,
    });
  }

  const friends = await snapchat.getFriends({ limit: 50 });

  await snapchat.sendMessage(friends[0].id, "Hello from SnapLink SDK");
} finally {
  await snapchat.close();
}

Client Setup

const snapchat = new SnapchatClient({
  browser: {
    headless: false,
    args: ["--start-maximized"],
  },
  session: {
    key: "my-snapchat-account",
  },
  debug: {
    screenshots: true,
    directory: ".snapchat-debug",
  },
  logger: console,
});

session.key controls cookie storage. When it is set, init() attempts to restore the saved session and login() saves cookies after a successful login.

API Overview

Top-level methods:

| Method | Purpose | | --- | --- | | init(config?) | Launch Snapchat Web and prepare the browser session. | | login(credentials) | Log in with username and password. | | logout() | Log out from the active Snapchat Web session. | | isLoggedIn() | Check whether the current browser session is authenticated. | | getFriends(options?) | Load friends from Snapchat's virtualized list. | | getFriendStatus(options?) | Read visible friend status rows. | | sendMessage(friendId, message, options?) | Send one or more chat messages. | | getConversation(friendId, options?) | Read the visible conversation for one friend. | | getConversations(friendIds, options?) | Read multiple conversations and return a Map. | | watchMessages(options) | Watch sidebar changes and emit message events. | | onEvent(callback) | Shortcut watcher for common sidebar events. | | sendSnap(options) | Create and optionally send an image snap. | | close() | Stop watchers and close the browser. |

Grouped modules are also available:

await snapchat.api.auth.login({ username, password });
const friends = await snapchat.api.friends.getFriends({ limit: 100 });
await snapchat.api.messaging.sendMessage(friends[0].id, "Hello");
await snapchat.api.snap.sendSnap({ path: "./image.png", friendIds: [friends[0].id] });
await snapchat.api.browser.close();

See docs/api.md for the full API reference.

Friends

const friends = await snapchat.getFriends({ limit: 100 });
const filtered = await snapchat.getFriends({ search: "alex", limit: 20 });
const statuses = await snapchat.getFriendStatus({ limit: 100 });

Friend IDs returned by getFriends() should be used for chat and snap operations.

Messaging

await snapchat.sendMessage(friend.id, "Hello");

await snapchat.sendMessage(friend.id, [
  "First message",
  "Second message",
]);

const conversation = await snapchat.getConversation(friend.id, {
  maxMessages: 25,
});

Bulk conversation reads return a Map keyed by friend ID:

const conversations = await snapchat.getConversations(
  friends.slice(0, 5).map(friend => friend.id),
  {
    maxMessages: 20,
    onProgress: ({ current, total }) => {
      console.log(`${current}/${total}`);
    },
  }
);

Watch Messages

Use watchMessages() for auto-reply systems instead of polling every friend manually.

const watcher = await snapchat.watchMessages({
  triggers: ["received", "new_chat", "new_snap"],
  onMessage: async (event) => {
    const latest = event.latestMessage;
    if (!latest?.text) return;

    await snapchat.sendMessage(event.friendId, "Thanks for your message.");
  },
  onError: console.error,
});

// later
await watcher.stop();

Useful triggers include received, new_chat, new_snap, opened, delivered, say_hi, unread, and new_friend.

Send Snaps

await snapchat.sendSnap({
  path: "./image.png",
  caption: "Hello",
  friendIds: friends.slice(0, 3).map(friend => friend.id),
});

Other recipient styles:

await snapchat.sendSnap({ path: "./image.png", friends: friends.slice(0, 3) });
await snapchat.sendSnap({ path: "./image.png", recipients: [friends[0].id] });
await snapchat.sendSnap({ path: "./image.png", target: "bestfriends" });
await snapchat.sendSnap({ path: "./image.png", shortcuts: ["close-friends"] });

Examples

Local Development

cd snaplink-sdk
npm ci
npm run test:ci

Live browser verification is available when you provide credentials in .env or your shell:

npm run test:live

Real message or snap sending is disabled unless live-send environment variables are explicitly enabled. See .env.example.

Publishing

Before publishing:

npm run test:ci
npm run pack:dry

Publish manually:

npm run version:patch
npm publish --access public

Use version:minor for backward-compatible features and version:major for breaking API changes.

Documentation

License

ISC