const https = require('https')
const data = JSON.stringify({
"sms": {
"message": {
"text": "Message API",
"sender": "",
},
"recipients": {
"gsm": [
{
"value": "33612345678"
}
]
}
}
})
//Your first token must be generated on our plateform at https://my.smsfactor.com/developers/api-tokens
const token = "your.token"
const options = {
hostname: 'api.smsfactor.com',
port: 443,
path: '/send',
method: 'POST',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + token
}
}
const req = https.request(options, (res) => {
console.log(`statusCode: ${res.statusCode}`)
res.on('data', (d) => {
process.stdout.write(d)
})
})
req.on('error', (error) => {
console.error(error)
})
req.write(data)
req.end()