Skip to content

Commit

Permalink
fix(core.gbapp): Auto start for whatsapp OK.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jun 4, 2021
1 parent 94e791c commit 9cb4d11
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions packages/core.gbapp/services/GBMinService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ export class GBMinService {
activeMin.core.getParam(activeMin.instance, 'Start Dialog', null);

if (startDialog) {
GBLog.info(`Calling /call to Auto start ${startDialog} for ${activeMin.instance.instanceId}...`);
req.body.messages[0].body = `/call ${startDialog}`;
GBLog.info(`Calling /start to Auto start ${startDialog} for ${activeMin.instance.instanceId}...`);
req.body.messages[0].body = `/start`;

// Resets HEAR ON DIALOG value to none and passes
// current dialog to the direct line.
Expand Down Expand Up @@ -345,8 +345,8 @@ export class GBMinService {


if (startDialog) {
GBLog.info(`Calling /call for Auto start : ${startDialog} for ${activeMin.instance.botId}...`);
req.body.messages[0].body = `/call ${startDialog}`;
GBLog.info(`Calling /start for Auto start : ${startDialog} for ${activeMin.instance.botId}...`);
req.body.messages[0].body = `/start`;
await (activeMin as any).whatsAppDirectLine.received(req, res);
} else {
await (activeMin as any).whatsAppDirectLine.sendToDevice(
Expand Down Expand Up @@ -866,10 +866,18 @@ export class GBMinService {

await step.beginDialog('/');
}
else {

GBLog.info(`Member added to conversation: ${member.name}`);
}
} else {
GBLog.info(`Person added to conversation: ${member.name}`);

if (this.userMobile(step)) {
const startDialog = min.core.getParam(min.instance, 'Start Dialog', null);
if (startDialog && !user.welcomed) {
user.welcomed = true;
GBLog.info(`Auto start (whatsapp) dialog is now being called: ${startDialog} for ${min.instance.instanceId}...`);
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
}
}
}

} else if (context.activity.type === 'message') {
Expand Down Expand Up @@ -1006,8 +1014,9 @@ export class GBMinService {
const cmdOrDialogName = parts[0];
parts.splice(0, 1);
const args = parts.join(' ');

if (cmdOrDialogName === '/call') {
if (cmdOrDialogName === '/start') {
// TODO: Args to BASIC.
} else if (cmdOrDialogName === '/call') {
await GBVMService.callVM(args, min, step, this.deployer);
} else {
await step.beginDialog(cmdOrDialogName, { args: args });
Expand Down

0 comments on commit 9cb4d11

Please sign in to comment.