Skip to content

Commit

Permalink
fix(core.gbapp): ms-rest-azure updated due to Azure/ms-rest-js#347.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Jun 17, 2019
1 parent f29c8c2 commit d61d2f8
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 27 deletions.
2 changes: 1 addition & 1 deletion gbot.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ ECHO Compiling...
CALL tsc

:ALLSET
node app.js
node boot.js
78 changes: 61 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"mocha-typescript": "1.1.17",
"ms": "2.1.1",
"ms-rest-azure": "2.6.0",
"ms-rest-js": "1.0.1",
"@azure/ms-rest-js": "1.8.13",
"nexmo": "2.4.1",
"ngrok": "3.1.1",
"npm": "6.9.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/azuredeployer.gbapp/services/AzureDeployerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@

'use strict';

import { HttpHeaders, HttpMethods, ServiceClient, WebResource } from '@azure/ms-rest-js';
import { CognitiveServicesManagementClient } from 'azure-arm-cognitiveservices';
import { ResourceManagementClient, SubscriptionClient } from 'azure-arm-resource';
import { SearchManagementClient } from 'azure-arm-search';
import { SqlManagementClient } from 'azure-arm-sql';
import { WebSiteManagementClient } from 'azure-arm-website';
//tslint:disable-next-line:no-submodule-imports
import { AppServicePlan, Site, SiteConfigResource, SiteSourceControl, SiteLogsConfig } from 'azure-arm-website/lib/models';
import { AppServicePlan, Site, SiteConfigResource, SiteLogsConfig, SiteSourceControl } from 'azure-arm-website/lib/models';
import { GBLog, IGBInstallationDeployer, IGBInstance } from 'botlib';
import { HttpHeaders, HttpMethods, ServiceClient, WebResource } from 'ms-rest-js';
import { GBAdminService } from '../../../packages/admin.gbapp/services/GBAdminService';
import { GBCorePackage } from '../../../packages/core.gbapp';
import { GBConfigService } from '../../../packages/core.gbapp/services/GBConfigService';
Expand Down Expand Up @@ -719,7 +719,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
serverFarmId: serverFarmId,
siteConfig: {
appSettings: [
{ name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: WebSiteResponseTimeout },
{ name: 'WEBSITES_CONTAINER_START_TIME_LIMIT', value: `${WebSiteResponseTimeout}` },
{ name: 'WEBSITE_NODE_DEFAULT_VERSION', value: GBAdminService.getNodeVersion() },
{ name: 'ADDITIONAL_DEPLOY_PATH', value: `` },
{ name: 'ADMIN_PASS', value: `${instance.adminPass}` },
Expand Down
20 changes: 15 additions & 5 deletions packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class WhatsappDirectLine extends GBService {
public whatsappServiceKey: string;
public whatsappServiceNumber: string;
public whatsappServiceUrl: string;
public whatsappServiceWebhookUrl: string;
public botId: string;
public watermark: string;

Expand All @@ -28,17 +27,15 @@ export class WhatsappDirectLine extends GBService {
directLineSecret,
whatsappServiceKey,
whatsappServiceNumber,
whatsappServiceUrl,
whatsappServiceWebhookUrl
whatsappServiceUrl
) {
super();

this.botId = botId;
this.whatsappServiceKey = whatsappServiceKey;
this.whatsappServiceNumber = whatsappServiceNumber;
this.whatsappServiceUrl = whatsappServiceUrl;
this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl;
var fs = require('fs')
const fs = require('fs');

this.directLineClient =
new Swagger({
Expand Down Expand Up @@ -94,7 +91,10 @@ export class WhatsappDirectLine extends GBService {
client.Conversations.Conversations_StartConversation()
.then(response => {
return response.obj.conversationId;
}).catch(err => {
GBLog.error(`Error calling Conversations_StartConversation on Whatsapp channel ${err}`);
})

.then(generatedConversationId => {
this.conversationIds[from] = generatedConversationId;
this.inputMessage(client, generatedConversationId, text, from, fromName);
Expand All @@ -108,7 +108,10 @@ export class WhatsappDirectLine extends GBService {
this.inputMessage(client, conversationId, text, from, fromName);
}
res.end();
}).catch(err => {
GBLog.error(`Error initializing DirectLine for Whatsapp channel ${err}`);
});

}

public inputMessage(client, conversationId, text, from, fromName) {
Expand Down Expand Up @@ -143,9 +146,16 @@ export class WhatsappDirectLine extends GBService {

return response.obj.activities;
})
.catch(err => {
GBLog.error(`Error calling Conversations_GetActivities on Whatsapp channel ${err}`);
})
.then(activities => {
this.printMessages(activities, conversationId, from, fromName);
})
.catch(err => {
GBLog.error(`Error calling printMessages on Whatsapp channel ${err}`);
});

}, this.pollInterval);
}

Expand Down

0 comments on commit d61d2f8

Please sign in to comment.