0.0.1 • Published 2 years ago
letesend v0.0.1
Letesend
This is a nodejs package for sending and monitoring SMS with letesend. Letesend is a sms gateway that tries to make sms price cheaper, more information at letesend.com.
Installation
Install using npm with :
npm install letesend
Example Usage
Go to letesend.com/console and copy your auth token. After installing, import letesend into your program and replace your auth token, see the code below.
import SMS from "letesend"
const AUTH_TOKEN = "Replace_Your_Auth_Token_Here"
const sms = new SMS(AUTH_TOKEN)
let to = "+243*********"
let name = "Company"
let body = "Hello World !"
await sms.send(to, name, body)
if(sms.ok){
console.log('SMS processed successfully')
}
console.log(sms.status_code, sms.status_text)
Output
SMS processed successfully
201 {
"id":5,
"to":"+243*********",
"name":"Company",
"body":"Hello World !",
"status":"0",
"date":"2022-03-05",
"time":"11:57:28.357820"
}
Troubleshoot
403 {
"detail": "Your balance (0.0$) is insufficient to send 1 SMS."
}
It means you don't have enough money in your account For sending the SMS.
400 {
"to": ["The phone number entered is not valid."]
}
The phone number must be a E.164 format.
Class Description
The SMS class description provides methods and attributes for sending and monitoring SMS.
Methods
Send
Send sms with letesend gateway.
Parameters | Type | Description |
---|---|---|
to | String | The receiver phone number (E.164 format) |
name | String | The name (will be displayed in the SMS header) |
body | Strimg | The sms body (the message) |
attributes
Name | Type | Description |
---|---|---|
id | Number | The unique sms indetification |
to | String | The receiver phone number (E.164 format) |
name | String | The name (will be displayed in the SMS header) |
body | String | The sms body (the message) |
status | String | The SMS status 0 : Processed 1 : Sent 2 : Queued 3 : Scheduled 4 : Undelivered 5 : Delivered 6 : Delivery_unknown 7 : Failed |
date | String | The date the request was sent to our server |
time | String | The time the request was sent to our server |
status_code | String | The http response status 201 : The SMS has successfully Processed 403 : Can not send SMS for some reasons 400 : Bad Request |
status_text | String | The http response details |
ok | Boolean | SMS processed successfully |
auth_token | String | The Authentication token. |
More information at letesend.com or contact us at support@letesend.com
0.0.1
2 years ago