
Product
Introducing License Overlays: Smarter License Management for Real-World Code
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
A Node.js package for interacting with the Notify.lk API. This package provides functionality to send SMS messages, check account status, manage contacts, and retrieve SMS history using the Notify.lk service.
Welcome to the NotifyLK NPM package documentation. This package enables you to send SMS messages, check account status, and manage contacts using the Notify.lk API.
npm install notify-lk --save
Run the above command in your project directory to install the package.
Here’s how to use the NotifyLK package in your Node.js application:
const NotifyLK = require('notify-lk');
const notify = new NotifyLK('YOUR_USER_ID', 'YOUR_API_KEY', 'YOUR_SENDER_ID');
notify.sendSMS('9471XXXXXXX', 'Hello from NotifyLK')
.then(response => console.log(response))
.catch(error => console.error(error));
Constructor for creating a new instance of the NotifyLK class.
Sends an SMS to the specified number.
Retrieves the account status including the balance and active status.
This example demonstrates how to send a simple SMS using the NotifyLK package:
const NotifyLK = require('notify-lk');
const notify = new NotifyLK('YOUR_USER_ID', 'YOUR_API_KEY', 'YOUR_SENDER_ID');
notify.sendSMS('9471XXXXXXX', 'Hello from NotifyLK')
.then(response => console.log('SMS Sent:', response))
.catch(error => console.error('Error Sending SMS:', error));
This example shows how to check your account's status, including balance and active status:
notify.getAccountStatus()
.then(status => console.log('Account Status:', status))
.catch(error => console.error('Error Fetching Account Status:', error));
To send an SMS containing Unicode characters (e.g., emojis, non-Latin scripts), include the type
option:
notify.sendSMS('9471XXXXXXX', 'Hello from NotifyLK 😊', { type: 'unicode' })
.then(response => console.log('Unicode SMS Sent:', response))
.catch(error => console.error('Error Sending Unicode SMS:', error));
Sending SMS to multiple recipients in a loop:
const numbers = ['9471XXXXXXX', '9472XXXXXXX', '9473XXXXXXX'];
const message = 'Hello from NotifyLK';
numbers.forEach(number => {
notify.sendSMS(number, message)
.then(response => console.log(`SMS Sent to ${number}:`, response))
.catch(error => console.error(`Error Sending SMS to ${number}:`, error));
});
This example demonstrates how to handle errors, such as invalid phone numbers or API issues:
notify.sendSMS('invalid_number', 'This message will fail')
.then(response => console.log('SMS Sent:', response))
.catch(error => {
if (error.response && error.response.data) {
console.error('API Error:', error.response.data);
} else {
console.error('Unknown Error:', error.message);
}
});
If Notify.lk supports scheduling (hypothetical, as the real API may not), you could do something like this:
const scheduleDate = new Date(Date.now() + 60 * 60 * 1000); // 1 hour from now
notify.sendSMS('9471XXXXXXX', 'This message is scheduled for future delivery', { send_at: scheduleDate.toISOString() })
.then(response => console.log('Scheduled SMS Sent:', response))
.catch(error => console.error('Error Scheduling SMS:', error));
This package is maintained by Omindu Dissanayake.
This package is licensed under the MIT License. See the LICENSE file for more information.
FAQs
A Node.js package for interacting with the Notify.lk API. This package provides functionality to send SMS messages, check account status, manage contacts, and retrieve SMS history using the Notify.lk service.
We found that notify-lk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.