fix twilio bug; update packages
This commit is contained in:
parent
4b0e4065ca
commit
95aaee4037
4 changed files with 3270 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
const Client = require('twilio')
|
||||
const twilio = require('twilio')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const NAME = 'Twilio'
|
||||
|
|
@ -7,7 +7,7 @@ const BAD_NUMBER_CODES = [21201, 21202, 21211, 21214, 21216, 21217, 21219, 21408
|
|||
21610, 21612, 21614, 21608]
|
||||
|
||||
function sendMessage (account, rec) {
|
||||
const client = Client(account.accountSid, account.authToken)
|
||||
const client = twilio(account.accountSid, account.authToken)
|
||||
const body = rec.sms.body
|
||||
const _toNumber = rec.sms.toNumber || account.toNumber
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ function sendMessage (account, rec) {
|
|||
from: account.fromNumber
|
||||
}
|
||||
|
||||
return client.sendMessage(opts)
|
||||
return client.messages.create(opts)
|
||||
.catch(err => {
|
||||
if (_.includes(err.code, BAD_NUMBER_CODES)) {
|
||||
const badNumberError = new Error(err.message)
|
||||
|
|
|
|||
3263
package-lock.json
generated
Normal file
3263
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,6 @@
|
|||
"bignumber.js": "^4.0.1",
|
||||
"bip39": "^2.3.1",
|
||||
"bitcoind-rpc": "^0.7.0",
|
||||
"bitgo": "^2.2.4",
|
||||
"body-parser": "^1.15.1",
|
||||
"cookie-parser": "^1.4.3",
|
||||
"ethereumjs-tx": "^1.3.0",
|
||||
|
|
@ -32,7 +31,7 @@
|
|||
"node-hkdf-sync": "^1.0.0",
|
||||
"node-mailjet": "^3.1.0",
|
||||
"numeral": "^2.0.3",
|
||||
"pg": "^6.2.3",
|
||||
"pg": "^6.2.4",
|
||||
"pg-native": "latest",
|
||||
"pg-promise": "^5.8.1",
|
||||
"pify": "^3.0.0",
|
||||
|
|
|
|||
|
|
@ -3810,9 +3810,9 @@ pg@5.1:
|
|||
pgpass "0.0.6"
|
||||
semver "4.3.2"
|
||||
|
||||
pg@^6.2.3:
|
||||
version "6.2.3"
|
||||
resolved "https://registry.yarnpkg.com/pg/-/pg-6.2.3.tgz#8988b7c69a1875a997d73b92036c42590b5f8024"
|
||||
pg@^6.2.4:
|
||||
version "6.2.4"
|
||||
resolved "https://registry.yarnpkg.com/pg/-/pg-6.2.4.tgz#4f7ede70241e97506627d5d6078360701a647c45"
|
||||
dependencies:
|
||||
buffer-writer "1.0.1"
|
||||
packet-reader "0.3.1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue