new(security.gblib): SMS Auth.
This commit is contained in:
parent
1a5f76f2ac
commit
36a9a8eb1d
1 changed files with 18 additions and 15 deletions
|
@ -354,7 +354,10 @@ export class GBConversationalService {
|
|||
|
||||
// tslint:disable:no-unsafe-any due to Nexmo.
|
||||
public async sendSms(min: GBMinInstance, mobile: string, text: string): Promise<any> {
|
||||
let botNumber = process.env.BOT_NUMBER;
|
||||
|
||||
let botNumber = min.core.getParam<string>(min.instance, 'Bot Number', null);
|
||||
if (botNumber) {
|
||||
|
||||
|
||||
GBLog.info(`Sending SMS from ${botNumber} to ${mobile} with text: '${text}'.`);
|
||||
const accountSid = process.env.TWILIO_ACCOUNT_SID;
|
||||
|
@ -370,7 +373,7 @@ export class GBConversationalService {
|
|||
})
|
||||
|
||||
GBLogEx.info(min, `SMS sent, return: ${msg.sid}.`);
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
if (!min.instance.smsKey && min.instance.smsSecret) {
|
||||
|
@ -423,7 +426,7 @@ export class GBConversationalService {
|
|||
|
||||
public async sendToMobile(min: GBMinInstance, mobile: string, message: string, conversationId) {
|
||||
GBLog.info(`Sending message ${message} to ${mobile}...`);
|
||||
return min.whatsAppDirectLine ? await min.whatsAppDirectLine.sendToDevice(mobile, message, conversationId):
|
||||
return min.whatsAppDirectLine ? await min.whatsAppDirectLine.sendToDevice(mobile, message, conversationId) :
|
||||
await this.sendSms(min, mobile, message);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue