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

ippanel-node-sdk

v1.0.1

Published

Node.js SDK for ippanel API

Readme

ippanel Node.js SDK

A Node.js SDK for interacting with the ippanel API to send various types of SMS messages.

Installation

Install the SDK using npm:

npm install ippanel-node-sdk

Or using yarn:

yarn add ippanel-node-sdk

Usage

Creating a Client

First, import and instantiate the client with your API key:

// Using CommonJS
const { createClient } = require('ippanel-node-sdk');
const client = createClient('YOUR_API_KEY');

// Or using ES Modules
import { createClient } from 'ippanel-node-sdk';
const client = createClient('YOUR_API_KEY');

// Alternatively, you can use the Client class directly
const { Client } = require('ippanel-node-sdk');
const client = new Client('YOUR_API_KEY');

Sending a Web Service Message

Send a simple message to one or more recipients:

client.sendWebservice(
  'Hello from ippanel!', 
  '+983000505', // sender number
  ['+989123456789', '+989356789012'] // recipient numbers
)
  .then(response => console.log('Message sent:', response))
  .catch(error => console.error('Error sending message:', error));

Sending a Pattern Message

Send a message using a predefined pattern:

client.sendPattern(
  'YOUR_PATTERN_CODE',
  '+983000505', // sender number
  '+989123456789', // recipient number
  { 
    param1: 'value1',
    param2: 'value2'
  } // pattern parameters
)
  .then(response => console.log('Pattern message sent:', response))
  .catch(error => console.error('Error sending pattern message:', error));

Sending a VOTP (Verification OTP) Message

Send a verification OTP message:

client.sendVOTP(
  123456, // OTP code
  '+989123456789' // recipient number
)
  .then(response => console.log('VOTP message sent:', response))
  .catch(error => console.error('Error sending VOTP message:', error));

Using async/await

All methods return promises and can be used with async/await:

async function sendMessages() {
  try {
    // Send a web service message
    const webResult = await client.sendWebservice(
      'Hello from ippanel!', 
      '+983000505', 
      ['+989123456789']
    );
    console.log('Web service result:', webResult);
    
    // Send a pattern message
    const patternResult = await client.sendPattern(
      'PATTERN_CODE', 
      '+983000505', 
      '+989123456789', 
      { name: 'John', code: '12345' }
    );
    console.log('Pattern result:', patternResult);
    
    // Send a VOTP message
    const votpResult = await client.sendVOTP(123456, '+989123456789');
    console.log('VOTP result:', votpResult);
  } catch (error) {
    console.error('Error sending messages:', error);
  }
}

Configuration & Customization

Custom Base URL

You can specify a custom base URL when creating the client:

const client = createClient('YOUR_API_KEY', 'https://custom-api.example.com/v1/api');

Custom HTTP Client

You can customize the HTTP client settings:

const axios = require('axios');
const { createClient } = require('ippanel-node-sdk');

const client = createClient('YOUR_API_KEY');

// Create custom axios instance
const customAxios = axios.create({
  timeout: 30000, // 30 seconds timeout
  headers: {
    'Authorization': client.apiKey,
    'Content-Type': 'application/json',
    'User-Agent': 'My Custom App'
  }
});

// Set the custom HTTP client
client.setHttpClient(customAxios);

Error Handling

The SDK throws meaningful errors that you can catch and handle:

client.sendWebservice('Test message', '+983000505', ['+989123456789'])
  .then(response => {
    console.log('Success:', response);
  })
  .catch(error => {
    if (error.message.includes('API Error:')) {
      console.error('API returned an error:', error.message);
    } else if (error.message === 'No response received from the API') {
      console.error('Network or timeout issue');
    } else {
      console.error('Unexpected error:', error.message);
    }
  });

Response Structure

Successful responses have the following structure:

{
  data: {
    // Response data specific to the API endpoint
  },
  meta: {
    status: true,
    message: "Operation successful",
    message_parameters: [],
    message_code: "success"
  }
}

TypeScript Support

The SDK includes TypeScript definitions for improved development experience with TypeScript.

import { createClient, SendResponse } from 'ippanel-node-sdk';

const client = createClient('YOUR_API_KEY');

async function sendSMS(): Promise<SendResponse> {
  return client.sendWebservice('Hello', '+983000505', ['+989123456789']);
}

License

MIT