A library to interact with SMS Gateway API.
npm install --save sms-gateway-nodejs
emailAddress
(String): Your smsgateway usernamepassword
(String): Your smsgateway password
smsGateway = require('sms-gateway-nodejs')('ntrinquier@provider.com', 'p4ssw0rd')
listOfMessages
fetchSingleMessage
sendMessageToNumber
sendMessageToNumbers
sendMessageToContact
sendMessageToContacts
sendMessagesToRecipients
Create a contact.
name
(String): The contact's namenumber
(String): The contact's number
smsGateway.contact.createContact('Nicolas', '+33612121212')
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a list of the contacts.
page
(String): The page number
smsGateway.contact.listOfContacts(2)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a specific contact.
id
(String): The contact ID
smsGateway.contact.fetchSingleContact(2182)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a list of the devices.
page
(String): The page number
smsGateway.device.listOfDevices(2)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a specific device.
id
(String): The device ID
smsGateway.device.fetchSingleDevice(2182)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a list of the messages.
page
(String): The page number
smsGateway.message.listOfMessages(2)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Get a specific message.
id
(String): The message ID
smsGateway.message.fetchSingleMessage(2182)
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Send a message to a number.
device
(String): The ID of device you wish to send the message fromnumber
(String): The number to send the message tomessage
(String): The content of the message to be sent[sendAt=undefined]
(String): Time to send the message in Unix Time format[expiresAt=undefined]
(String): Time to give up trying to send the message at in Unix Time format
smsGateway.message.sendMessageToNumber('2012', '+33123456789', 'Hello world :)')
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Send a message to numbers.
device
(String): The ID of device you wish to send the message fromnumbers
(Array): The numbers to send the message tomessage
(String): The content of the message to be sent[sendAt=undefined]
(String): Time to send the message in Unix Time format[expiresAt=undefined]
(String): Time to give up trying to send the message at in Unix Time format
smsGateway.message.sendMessageToNumbers('2012', ['+33123456789', '+33987654321'], 'Penguins rock!')
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Send a message to a contact.
device
(String): The ID of device you wish to send the message fromcontact
(String): The contact to send the message tomessage
(String): The content of the message to be sent[sendAt=undefined]
(String): Time to send the message in Unix Time format[expiresAt=undefined]
(String): Time to give up trying to send the message at in Unix Time format
smsGateway.message.sendMessageToContact('2012', '30', 'Hello world :)')
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Send a message to contacts.
device
(String): The ID of device you wish to send the message fromcontacts
(Array): The contacts to send the message tomessage
(String): The content of the message to be sent[sendAt=undefined]
(String): Time to send the message in Unix Time format[expiresAt=undefined]
(String): Time to give up trying to send the message at in Unix Time format
smsGateway.message.sendMessageToContacts('2012', ['5', '30'], 'Penguins rock!')
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})
Send messages to numbers or contacts.
data
(Array): Objects containing the messages to send, at the following format:device
(String): The ID of device you wish to send the message fromcontact|number
(String): The contact or number to send the message tomessage
(String): The content of the message to be sent[sendAt=undefined]
(String): Time to send the message in Unix Time format[expiresAt=undefined]
(String): Time to give up trying to send the message at in Unix Time format
smsGateway.message.sendMessagesToRecipients([{
device: '2190',
contact: '42',
message: 'Hi!',
}, {
device: '2109',
number: '+33123456789',
message: 'Hello!',
}])
.then((response) => {
// do something with response
})
.catch((error) => {
// handle error
})