chore: server code formatting
This commit is contained in:
parent
aedabcbdee
commit
68517170e2
234 changed files with 9824 additions and 6195 deletions
|
|
@ -1,46 +1,47 @@
|
|||
const axios = require('axios')
|
||||
|
||||
const NAME = 'InforU'
|
||||
|
||||
function sendMessage (account, rec) {
|
||||
const username = account.username
|
||||
const apiKey = account.apiKey
|
||||
|
||||
const to = rec.sms.toNumber || account.toNumber
|
||||
const text = rec.sms.body
|
||||
const from = account.fromNumber
|
||||
|
||||
const url = 'https://capi.inforu.co.il/api/v2/SMS/SendSms'
|
||||
|
||||
const config = {
|
||||
auth: {
|
||||
username: username,
|
||||
password: apiKey
|
||||
},
|
||||
maxBodyLength: Infinity,
|
||||
headers:{
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
Message: text,
|
||||
Recipients: [{
|
||||
Phone: to
|
||||
}],
|
||||
Settings: {
|
||||
Sender: from
|
||||
}
|
||||
}
|
||||
|
||||
axios.post(url, data, config)
|
||||
.catch(err => {
|
||||
// console.log(err)
|
||||
throw new Error(`inforu error: ${err.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage
|
||||
}
|
||||
const axios = require('axios')
|
||||
|
||||
const NAME = 'InforU'
|
||||
|
||||
function sendMessage(account, rec) {
|
||||
const username = account.username
|
||||
const apiKey = account.apiKey
|
||||
|
||||
const to = rec.sms.toNumber || account.toNumber
|
||||
const text = rec.sms.body
|
||||
const from = account.fromNumber
|
||||
|
||||
const url = 'https://capi.inforu.co.il/api/v2/SMS/SendSms'
|
||||
|
||||
const config = {
|
||||
auth: {
|
||||
username: username,
|
||||
password: apiKey,
|
||||
},
|
||||
maxBodyLength: Infinity,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}
|
||||
|
||||
const data = {
|
||||
Message: text,
|
||||
Recipients: [
|
||||
{
|
||||
Phone: to,
|
||||
},
|
||||
],
|
||||
Settings: {
|
||||
Sender: from,
|
||||
},
|
||||
}
|
||||
|
||||
axios.post(url, data, config).catch(err => {
|
||||
// console.log(err)
|
||||
throw new Error(`inforu error: ${err.message}`)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
sendMessage,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue