diff --git a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts index 129119f8..2f1aa5bb 100644 --- a/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts +++ b/packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts @@ -58,6 +58,15 @@ export class QualityDialog extends IGBDialog { public static setup(bot: BotAdapter, min: GBMinInstance) { const service = new CSService(); + min.dialogs.add(new WaterfallDialog('/check', [ + async step => { + const locale = step.context.activity.locale; + await min.conversationalService.sendText(min, step, Messages[locale].check_whatsapp_ok); + return await step.replaceDialog('/ask', { isReturning: true }); + } + ] + )); + min.dialogs.add(new WaterfallDialog('/quality', [ async step => { const locale = step.context.activity.locale; @@ -82,7 +91,7 @@ export class QualityDialog extends IGBDialog { setTimeout(resolve, ms); }); }; - + await service.insertQuestionAlternate( min.instance.instanceId, user.lastQuestion, diff --git a/packages/customer-satisfaction.gbapp/strings.ts b/packages/customer-satisfaction.gbapp/strings.ts index 634ee147..8227e239 100644 --- a/packages/customer-satisfaction.gbapp/strings.ts +++ b/packages/customer-satisfaction.gbapp/strings.ts @@ -12,7 +12,8 @@ export const Messages = { please_no_bad_words: 'Please, no bad words.', please_wait_transfering: 'Please, wait while I find an agent to answer you.', notify_agent: (name) => `New call available for *${name}*, you can answer right here when you are finished, type /qt.`, - notify_end_transfer: (botName) => `Now talking to ${botName} again.` + notify_end_transfer: (botName) => `Now talking to ${botName} again.`, + check_whatsapp_ok: 'If you are seeing this message, WhatsApp API is OK.', }, 'pt-BR': { about_suggestions: 'Sugestões melhoram muito minha qualidade...', @@ -26,7 +27,7 @@ export const Messages = { please_no_bad_words: 'Por favor, sem palavrões!', please_wait_transfering: 'Por favor, aguarde enquanto eu localizo alguém para te atender.', notify_agent: (name) => `Existe um novo atendimento para *${name}*, por favor, responda aqui mesmo para a pessoa. Para finalizar, digite /qt.`, - notify_end_transfer: (botName) => `Falando novamente com o bot ${botName}.` - + notify_end_transfer: (botName) => `Falando novamente com o bot ${botName}.`, + check_whatsapp_ok: 'Se você está recebendo esta mensagem, significa que a API do WhatsApp está OK.', } }; diff --git a/packages/hubspot.gblib/services/HubSpotServices.ts b/packages/hubspot.gblib/services/HubSpotServices.ts index e142bbf8..7d512760 100644 --- a/packages/hubspot.gblib/services/HubSpotServices.ts +++ b/packages/hubspot.gblib/services/HubSpotServices.ts @@ -36,6 +36,8 @@ const { promisify } = require('util'); import { GBLog, GBMinInstance, GBService } from 'botlib'; import { GBServer } from '../../../src/app'; import { SecService } from '../../security.gbapp/services/SecService'; +const hubspot = require('@hubspot/api-client'); + /** * Support for Hub Spot XRM. @@ -69,7 +71,6 @@ export class HubSpotServices extends GBService { public async getActiveTasks(): Promise<[]> { - const hubspot = require('@hubspot/api-client'); const client = new hubspot.Client({ apiKey: this.key }); let properties = ['hs_task_subject', 'hubspot_owner_id', 'hs_task_status', 'hs_task_priority']; const pageSize = 100; @@ -87,8 +88,12 @@ export class HubSpotServices extends GBService { let final; final = []; list.forEach(e => { - if (e.properties.hs_task_status === "NOT_STARTED") - { + if (e.properties.hs_task_status === "NOT_STARTED") { + e['status'] = e.properties.hs_task_status; + e['title'] = e.properties.hs_task_subject; + e['ownerId'] = e.properties.hubspot_owner_id; + e['priority'] = e.properties.hs_task_priority; + final.push(e); } });