new(core.gbapp): New appPackages in min.
This commit is contained in:
parent
0d3bea80e0
commit
557fcb0931
3 changed files with 11 additions and 4 deletions
|
@ -66,7 +66,7 @@
|
|||
"botbuilder-ai": "4.7.0",
|
||||
"botbuilder-dialogs": "4.7.0",
|
||||
"botframework-connector": "4.7.0",
|
||||
"botlib": "1.5.7",
|
||||
"botlib": "1.5.8",
|
||||
"cli-spinner": "0.2.10",
|
||||
"dotenv-extended": "2.7.1",
|
||||
"exceljs": "3.5.0",
|
||||
|
|
|
@ -211,7 +211,7 @@ export class GBMinService {
|
|||
public async mountBot(instance: IGBInstance) {
|
||||
|
||||
// Build bot adapter.
|
||||
const { min, adapter, conversationState } = await this.buildBotAdapter(instance, GBServer.globals.sysPackages);
|
||||
const { min, adapter, conversationState } = await this.buildBotAdapter(instance, GBServer.globals.sysPackages, GBServer.globals.appPackages);
|
||||
GBServer.globals.minInstances.push(min);
|
||||
|
||||
await this.deployer.deployPackage(min, 'packages/default.gbtheme');
|
||||
|
@ -431,7 +431,7 @@ export class GBMinService {
|
|||
}
|
||||
}
|
||||
|
||||
private async buildBotAdapter(instance: any, sysPackages: IGBPackage[]) {
|
||||
private async buildBotAdapter(instance: any, sysPackages: IGBPackage[], appPackages: IGBPackage[]) {
|
||||
const adapter = new BotFrameworkAdapter({
|
||||
appId: instance.marketplaceId,
|
||||
appPassword: instance.marketplacePassword
|
||||
|
@ -466,6 +466,7 @@ export class GBMinService {
|
|||
min.scriptMap = {};
|
||||
min.sandBoxMap = {};
|
||||
min.packages = sysPackages;
|
||||
min.appPackages = appPackages;
|
||||
|
||||
if (min.instance.whatsappServiceKey !== null) {
|
||||
min.whatsAppDirectLine = new WhatsappDirectLine(
|
||||
|
|
|
@ -35,12 +35,13 @@ import urlJoin = require('url-join');
|
|||
const Swagger = require('swagger-client');
|
||||
const rp = require('request-promise');
|
||||
const fs = require('fs');
|
||||
import { GBLog, GBService, GBMinInstance } from 'botlib';
|
||||
import { GBLog, GBService, GBMinInstance, IGBPackage } from 'botlib';
|
||||
import * as request from 'request-promise-native';
|
||||
import { GBServer } from '../../../src/app';
|
||||
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService';
|
||||
import { SecService } from '../../security.gblib/services/SecService';
|
||||
import { Messages } from '../strings';
|
||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||
|
||||
/**
|
||||
* Support for Whatsapp.
|
||||
|
@ -150,6 +151,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
|
||||
public async received(req, res) {
|
||||
|
||||
|
||||
if (req.body.messages === undefined) {
|
||||
res.end();
|
||||
return; // Exit here.
|
||||
|
@ -166,6 +168,10 @@ export class WhatsappDirectLine extends GBService {
|
|||
}
|
||||
GBLog.info(`GBWhatsapp: RCV ${from}(${fromName}): ${text})`);
|
||||
|
||||
await CollectionUtil.asyncForEach(this.min.appPackages, async (e:IGBPackage) => {
|
||||
await e.onExchangeData(this.min, "whatsappMessage", message);
|
||||
});
|
||||
|
||||
const id = req.body.messages[0].chatId.split('@')[0];
|
||||
const senderName = req.body.messages[0].senderName;
|
||||
let sec = new SecService();
|
||||
|
|
Loading…
Add table
Reference in a new issue