plasgate
v1.1.3
Published
Plagate Node module package
Downloads
3
Maintainers
Readme
Supported Node.js Versions
This library supports the following Node.js implementations:
- Node.js v12.22.12 => Node.js v21.7.1
TypeScript is supported for TypeScript version ^5.4.2
Warning Do not use this Node.js library in a front-end application. Doing so can expose your Twilio credentials to end-users as part of the bundled HTML/JavaScript sent to their browser.
Installation
npm install plasgate
Test your installation
To make sure the installation was successful, try sending yourself an SMS message, like this:
// Your AccountSID is you private_key and Auth Token is your secret_key
const accountSid = 'your private_key';
const authToken = 'your_secret';
const client = require('plasgate')(accountSid, authToken);
client.messages
.create({
to: '+855123456789', // Text your number
sender: 'SMS info', // Text your sender name
content: 'your_message', // From a valid Twilio number
})
.then((message) => console.log(message.sid));
After a brief delay, you will receive the text message on your phone.
Warning It's okay to hardcode your credentials when testing locally, but you should use environment variables to keep them secret before committing any code or deploying to production. Check out How to Set Environment Variables for more information.