The Textng Node library provides convenient access to the Textng API from applications written in server-side JavaScript.
See the Textng
API docs.Written in PHP Language
Node 8, 10 or higher.
Install the package with:
npm install textng --save
# or
yarn add textng
The package needs to be configured with your account's secret key.This could be found at the bottom of your Account Profile page. The key authorizes the transaction.
const textng = new Textng({
key: "xxxxxxxxx",
sender:"yyyyyyyyy"
})
textng.sendSMS({
phone: "0800000000",
message:"hello world"
})
.then(textng => console.log(textng))
.catch(error => console.error(error));
Or using ES modules and async
/await
:
import Textng from 'textng';
const textng = new Textng({
key: "xxxxxxxxx",
sender:"yyyyyyyyy"
})
(async () => {
const textng = await textng.sendSMS({
email: "0800000000",
message:"hello world"
});
console.log(textng);
})();