1.0.2 • Published 5 months ago

sms-netgsm v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

netGSM SMS Sender

Installation:

First, install the package in your project using the following command:

npm install sms-netgsm

Usage:

Firstly do not forget that: You cannot send the same message to the same number over and over again.

To use the package in your project, follow these steps:

import { netGSMConfigType, sendMessage } from 'sms-netgsm';

const netGSMConfig: netGSMConfigType = {
usercode: "YOUR_USER_CODE",
password: "YOUR_PASSWORD",
msgheader: "COMPANY_NAME_OR_TITLE",
message: "MESSAGE_CONTENT",
gsmno: "NUMBER",
};

sendMessage(netGSMConfig)
.then(response => {
console.log("Message sent successfully:", response);
})
.catch(error => {
console.error("Error sending message:", error);
});

API Reference:

  • netGSMConfigType

    This type defines the configuration to be sent to the NetGSM API.

type netGSMConfigType = {
usercode: string;
password: string;
msgheader: string;
message: string;
gsmno: string;
};
  • sendMessage Function

This function sends a message to the NetGSM API.

    /**
     * @param netGSMConfig - NetGSM API configuration
     * @returns Promise<string> - API response (JSON or text)
     */
    declare const sendMessage: (netGSMConfig: netGSMConfigType) => Promise<string>;

Notes:

  • This package is designed to send messages to the NetGSM API.
  • The API response can be in JSON or text format.
  • Errors and successful cases are handled separately.
1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago