Always start a sender number with + on twillio
This commit is contained in:
parent
f020ea1f47
commit
2f451c5893
1 changed files with 3 additions and 1 deletions
|
|
@ -14,11 +14,13 @@ function sendMessage (account, rec) {
|
||||||
const client = twilio(account.accountSid, account.authToken)
|
const client = twilio(account.accountSid, account.authToken)
|
||||||
const body = rec.sms.body
|
const body = rec.sms.body
|
||||||
const _toNumber = rec.sms.toNumber || account.toNumber
|
const _toNumber = rec.sms.toNumber || account.toNumber
|
||||||
|
const from = _.startsWith('+')(account.fromNumber)
|
||||||
|
? account.fromNumber : `+${account.fromNumber}`
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
body: body,
|
body: body,
|
||||||
to: _toNumber,
|
to: _toNumber,
|
||||||
from: account.fromNumber
|
from
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.messages.create(opts)
|
return client.messages.create(opts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue