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

@devotel/devhub

v0.0.3

Published

Node.js SDK for DevHub Communication API

Readme

DevHub Node.js SDK 📡

npm version TypeScript Node.js License: MIT ESM CommonJS

Official Node.js SDK for the DevHub Communication API.

📦 Installation

npm i @devotel/devhub

🔧 Module Compatibility

This SDK supports both ESM (ES Modules) and CommonJS module systems:

ESM (ES Modules)

// Default import (recommended)
import DevHubSDK from "@devotel/devhub";

// Named import
import { DevHubSDK } from "@devotel/devhub";

const devhub = new DevHubSDK({
  apiKey: "<your-api-key>",
});

CommonJS

// Default import (recommended)
const DevHubSDK = require("@devotel/devhub").default;

// Named import
const { DevHubSDK } = require("@devotel/devhub");

const devhub = new DevHubSDK({
  apiKey: "<your-api-key>",
});

🚀 Quick Start

import DevHubSDK from "@devotel/devhub";

const devhub = new DevHubSDK({
  apiKey: "your-api-key",
});

// Send SMS
await devhub.sms.send({
  recipient: "+1234567890",
  message: "Hello from DevHub!",
  sender: "<sender>",
});

// Send Email
await devhub.email.send({
  recipient: "[email protected]",
  subject: "Hello",
  body: "<h1>Hello from DevHub!</h1>",
  sender: "[email protected]",
});

// Send WhatsApp message
await devhub.whatsapp.sendNormalMessage({
  account_id: "your-account-id",
  to: "+1234567890",
  type: "text",
  text: { body: "Hello from DevHub!" },
});

📚 API Reference

SMS Service

// Send SMS
await devhub.sms.send({
  recipient: "+1234567890",
  message: "Your message",
  sender: "optional-sender-id",
});

// Get available senders
await devhub.sms.getSenders();

// Buy a number
await devhub.sms.buyNumber({
  country_code: "US",
  area_code: "555",
});

// Get available numbers
await devhub.sms.getNumbers();

Email Service

// Send email
await devhub.email.send({
  recipient: "[email protected]",
  subject: "Subject",
  body: "<p>HTML content</p>",
  sender: "[email protected]",
});

WhatsApp Service

// Get WhatsApp accounts
await devhub.whatsapp.getAccounts();

// Send template message
await devhub.whatsapp.sendTemplateMessage("account-id", {
  to: "+1234567890",
  template: {
    name: "template-name",
    language: { code: "en" },
  },
});

// Send normal message
await devhub.whatsapp.sendNormalMessage({
  account_id: "your-account-id",
  to: "+1234567890",
  type: "text",
  text: { body: "Hello!" },
});

// Get templates
await devhub.whatsapp.getTemplates();

Contacts Service

// Get contacts
await devhub.contacts.getContacts();

// Create contact
await devhub.contacts.createContact({
  firstName: "John",
  lastName: "Doe",
  phoneNumber: "+1234567890",
  email: "[email protected]",
});

// Update contact
await devhub.contacts.updateContact("contact-id", {
  firstName: "Jane",
});

// Create custom field
await devhub.contacts.createCustomField({
  label: "Company",
  component: "Input",
  required: false,
});

RCS Service

// Get RCS accounts
await devhub.rcs.getAccounts();

// Send RCS message
await devhub.rcs.send({
  account_id: "your-account-id",
  number: "+1234567890",
  contentMessage: {
    text: "Hello from RCS!",
  },
});

// Create RCS template
await devhub.rcs.createTemplate({
  name: "greeting",
  content: "Hello {{name}}!",
});

Contact Groups Service

// Get contact groups
await devhub.contactGroups.getContactGroups();

// Create contact group
await devhub.contactGroups.createContactGroup({
  name: "VIP Customers",
  description: "High value customers",
});

// Update contact group
await devhub.contactGroups.updateContactGroup("group-id", {
  name: "Premium Customers",
});

Unified Messages Service

// Send message via any channel
await devhub.messages.send({
  channel: "SMS",
  sms: {
    sender: "DevHub",
    recipient: "+1234567890",
    message: "Hello!",
  },
});

⚠️ Error Handling

All methods return a response object with the following structure:

{
  success: boolean,
  data?: any,
  error?: string
}

Example:

const result = await devhub.sms.send({
  recipient: "+1234567890",
  message: "Hello!",
});

if (result.success) {
  console.log("Message sent:", result.data);
} else {
  console.error("Error:", result.error);
}

🔷 TypeScript Support

The SDK is written in TypeScript and provides full type definitions. Available types:

Core Types

import { DevHubConfig, ApiResponse, ChannelType } from "@devotel/devhub";

SMS Types

import { SmsMessage, BuyNumberRequest } from "@devotel/devhub";

// Usage
const smsData: SmsMessage = {
  recipient: "+1234567890",
  message: "Hello!",
  sender: "DevHub",
};

Email Types

import { EmailMessage } from "@devotel/devhub";

// Usage
const emailData: EmailMessage = {
  recipient: "[email protected]",
  subject: "Hello",
  body: "<h1>Hello!</h1>",
  sender: "[email protected]",
};

WhatsApp Types

import { WhatsAppTemplate, WhatsAppNormalMessage } from "@devotel/devhub";

// Template message
const templateData: WhatsAppTemplate = {
  to: "+1234567890",
  template: {
    name: "hello_world",
    language: { code: "en" },
  },
};

// Normal message
const normalData: WhatsAppNormalMessage = {
  account_id: "your-account-id",
  to: "+1234567890",
  type: "text",
  text: { body: "Hello!" },
};

Contact Types

import { Contact, CustomField } from "@devotel/devhub";

// Contact
const contactData: Contact = {
  firstName: "John",
  lastName: "Doe",
  email: "[email protected]",
  phoneNumber: "+1234567890",
};

// Custom field
const fieldData: CustomField = {
  label: "Company",
  component: "Input",
  required: false,
};

RCS Types

import { RcsMessage } from "@devotel/devhub";

// Usage
const rcsData: RcsMessage = {
  account_id: "your-account-id",
  number: "+1234567890",
  contentMessage: {
    text: "Hello from RCS!",
  },
};

Unified Messages

import { UnifiedMessage } from "@devotel/devhub";

// Usage
const unifiedData: UnifiedMessage = {
  channel: "SMS",
  sms: {
    sender: "DevHub",
    recipient: "+1234567890",
    message: "Hello!",
  },
};

📄 License

MIT