NodeJS
Welcome to the ReSMS NodeJS integration guide.
This guide explains how you can quickly and securely send SMS messages using the ReSMS API in your NodeJS applications.
Installation
First, install our official ReSMS NodeJS SDK:
npm install resms-sdk
# or
yarn add resms-sdk
# or
bun add resms-sdk
Quickstart
Here’s a minimal example to send an SMS:
import { ReSMSClient } from 'resms-sdk';
const client = new ReSMSClient({
apiKey: process.env.RESMS_API_KEY,
});
async function sendSMS() {
const response = await client.sendSMS({
to: '+1234567890',
message: 'Welcome to ReSMS!',
});
console.log('SMS sent:', response);
}
sendSMS().catch(console.error);
Authentication
Your API Key must be kept secret. Set it as an environment variable:
RESMS_API_KEY=your-api-key-here
Never hardcode it in your source files.
Features
- Send transactional and promotional SMS
- High deliverability and reliability
- Real-time message status tracking
- Global number support
Error Handling
All API calls can throw errors. We recommend wrapping your SMS calls with try-catch:
try {
await client.sendSMS({...});
} catch (error) {
console.error('Failed to send SMS:', error);
}
Going Further
Need help? Contact our support at support@resms.io
Last updated on