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 🙏

© 2024 – Pkg Stats / Ryan Hefner

blockscanchat-sdk

v1.1.0

Published

NPM Package for Blockscan Chat APIs

Downloads

2

Readme

Blockscan Chat SDK

A Blockscan Chat API wrapper written in NodeJS

Prerequisites

  • NodeJS

    To verify installation

    node -v

    To install

    winget install OpenJS.NodeJS
  • Blockscan Chat API Key and URL (Apply at https://chat.blockscan.com/apis)

Set Up

  1. Install this package in your project directory
npm i blockscanchat-sdk

Usage

  1. Import the package to your project
const BlockscanChat = require('blockscanchat-sdk');
let blockscanchat = new BlockscanChat();
  1. Initalize the SDK by passing in the Blockscan API_KEY and API_URL parameters specified as your environment variables
blockscanchat.init('YOUR_API_KEY');
  1. Generally, for all methods, the calling convention is
blockscanchat.<METHOD_NAME>(PARAMETERS)

Example (if method does not require parameters):

blockscanchat.<METHOD_NAME>()

Example (if method requires parameters):

blockscanchat.getExternalMsgCount('EXTERNAL_WALLET_ADDRESS')

MESSAGE ENDPOINT

getLocalMsgCount

Retrieves the unread message count associated with your API key address.

Parameters: None Usage:

blockscanchat.getLocalMsgCount().then((response) => {
  console.log(response);
});

getExternalMsgCount

Retrieves the unread message count of an external address. (you must have additional apikey permissions)

Parameters:

  • address (REQUIRED) - The external wallet address.

Usage:

blockscanchat.getExternalMsgCount('WALLET_ADDRESS').then((response) => {
  console.log(response);
});

getFirstMsgId

Fetches the ID of the first message.

Parameters: None Usage:

blockscanchat.getFirstMsgId().then((response) => {
  console.log(response);
});

getLastMsgId

Fetches the ID of the last message.

Parameters: None Usage:

blockscanchat.getLastMsgId().then((response) => {
  console.log(response);
});

getAllMsg

Gets unread message count of your apikey address

Parameters:

  • startID (OPTIONAL) -> Integer message ID to start searching for chats
  • offset (OPTIONAL) -> Number of chats displayed per page, maximum is 100
  • cType (OPTIONAL) -> Chat Type, 0 = All, 1 = Incoming Messages, 2 = Outgoing Messages

Usage:

No parameters

blockscanchat.getAllMsg().then((response) => {
  console.log(response);
});

With parameters

blockscanchat.getAllMsg({startID: 539070, offset: 99, cType: 2}).then((response) => {
  console.log(response);
});

sendMsg

Sends a message to a wallet address

Parameters:

  • address (REQUIRED) -> Address you want to send the message to
  • message (REQUIRED) -> Message you want to sent to that address

Usage:

blockscanchat.sendMsg('TARGET_ADDRESS', 'YOUR_MESSAGE').then((response) => {
  console.log(response);
});

markAllMsgAsRead

All messages with a particular address will be marked as read

Parameters:

  • address (REQUIRED) -> The address with which you want to mark the messages as read Usage:
blockscanchat.markAllMsgAsRead('WALLET_ADDRESS').then((response) => {
  console.log(response);
});