This library provides a server side client for the httpSMS API to help you send and receive SMS messages from your Node.js applications in TypeScript or JavaScript.
pnpm install httpsms
# or
yarn install httpsms
POST /v1/messages/send: Send a new SMSEncrypt: Encrypt the content of a message to cipher textDecrypt: Decrypt an encrypted message content to plain textAn instance of the client can be created using httpsms.New().
import HttpSms from "httpsms"
const client = new HttpSms(""/* Get API Key from https://httpsms.com/settings */);
All API calls return a Promise<T> as the return object. You can handle the response in the then and catch methods.
POST /v1/messages/send: Send an SMS Messageawait client.messages.postSend({
content: 'This is a sample text message',
from: '+18005550199',
to: '+18005550100',
})
.then((message) => {
console.log(message.id);
})
.catch((err) => {
console.error(err);
});
const encryptionKey = "Password123";
const encryptedContent = await client.cipher.encrypt("This is a sample text message", encryptionKey);
await client.messages.postSend({
content: encryptedContent,
from: '+18005550199',
encrypted: true,
to: '+18005550100',
})
.then((message) => {
console.log(message.id);
})
.catch((err) => {
console.error(err);
});
You can run the unit tests for this client from the root directory using the command below:
pnpm run test
This project is licensed under the MIT License - see the LICENSE file for details
42 commits
24 commits
TypeScript
65.6%
JavaScript
34.4%
This library provides a server side client for the httpSMS API to help you send and receive SMS messages from your Node.js applications in TypeScript or JavaScript.
pnpm install httpsms
# or
yarn install httpsms
POST /v1/messages/send: Send a new SMSEncrypt: Encrypt the content of a message to cipher textDecrypt: Decrypt an encrypted message content to plain textAn instance of the client can be created using httpsms.New().
import HttpSms from "httpsms"
const client = new HttpSms(""/* Get API Key from https://httpsms.com/settings */);
All API calls return a Promise<T> as the return object. You can handle the response in the then and catch methods.
POST /v1/messages/send: Send an SMS Messageawait client.messages.postSend({
content: 'This is a sample text message',
from: '+18005550199',
to: '+18005550100',
})
.then((message) => {
console.log(message.id);
})
.catch((err) => {
console.error(err);
});
const encryptionKey = "Password123";
const encryptedContent = await client.cipher.encrypt("This is a sample text message", encryptionKey);
await client.messages.postSend({
content: encryptedContent,
from: '+18005550199',
encrypted: true,
to: '+18005550100',
})
.then((message) => {
console.log(message.id);
})
.catch((err) => {
console.error(err);
});
You can run the unit tests for this client from the root directory using the command below:
pnpm run test
This project is licensed under the MIT License - see the LICENSE file for details
42 commits
24 commits
TypeScript
65.6%
JavaScript
34.4%