**smsQuick**
simplifies integration with various SMS providers for Node.js applications. This library allows you to send SMS messages quickly and efficiently with just a few lines of code.
- Installation
- Usage
- Supported Providers
- Example Usage
- Response Formats
- Troubleshooting
- Contributors
- License
Add smsQuick
to your project using npm:
npm install smsQuick
const smsQuick = require('smsQuick');
Here's how you can configure the twilio
provider:
const sms = smsQuick.init({
provider: 'twilio', // Supported providers: netgsm, twilio, iletimerkezi, vatansms, vonage
accountSid: 'your_account_sid',
authToken: 'your_auth_token',
from: 'your_phone_number'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello, this is a test message!'
}).then(response => {
console.log(response); // { status: true, message: 'SMS sent successfully' }
}).catch(error => {
console.error(error); // Error handling
});
-
URL:
https://api.netgsm.com.tr/sms/send/get
-
Required Parameters:
header
,username
,password
- URL: Twilio API
-
Required Parameters:
accountSid
,authToken
,from
-
URL:
https://api.iletimerkezi.com/v1/send-sms/get/
-
Required Parameters:
apiKey
,apiHash
,from
-
URL:
https://api.vatansms.net/api/v1/1toN
-
Required Parameters:
apiId
,apiKey
,sender
- URL: Vonage API
-
Required Parameters:
apiKey
,apiSecret
,from
const sms = smsQuick.init({
provider: 'netgsm',
header: 'your_header',
username: 'your_username',
password: 'your_password'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello from Netgsm!'
});
const sms = smsQuick.init({
provider: 'twilio',
accountSid: 'your_account_sid',
authToken: 'your_auth_token',
from: 'your_phone_number'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello from Twilio!'
});
const sms = smsQuick.init({
provider: 'iletimerkezi',
apiKey: 'your_api_key',
apiHash: 'your_api_hash',
from: 'your_sender_name'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello from Iletimerkezi!'
});
const sms = smsQuick.init({
provider: 'vatansms',
apiId: 'your_api_id',
apiKey: 'your_api_key',
sender: 'your_sender_name'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello from Vatansms!'
});
const sms = smsQuick.init({
provider: 'vonage',
apiKey: 'your_api_key',
apiSecret: 'your_api_secret',
from: 'your_phone_number'
});
sms.send({
to: 'recipient_phone_number',
message: 'Hello from Vonage!'
});
Each provider may return different response formats. Here are common examples:
{
"status": true,
"message": "SMS sent successfully"
}
{
"status": false,
"message": "SMS could not be sent"
}
Responses may vary by provider. Check their API documentation and review the responses using console.log
to handle them appropriately.
-
Missing Parameters: If you receive
status: false, message: 'Missing parameters'
, ensure all required parameters are provided. -
Network Errors: Network issues or API errors generally return
status: false, message: 'SMS could not be sent'
. Check your API keys and network connection. -
Response Errors: Different providers use different response formats. Examine the responses with
console.log
to diagnose issues.
- fastuptime - Project owner and developer
This project is licensed under the MIT License. See the LICENSE file for more details.
With **smsQuick**
, sending SMS is now simpler and faster! 🚀
GitHub: fastuptime/smsQuick
npm: smsQuick