Skip to content

Commit

Permalink
fix(all): /check added.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Dec 20, 2021
1 parent 68369c2 commit 7410085
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
11 changes: 10 additions & 1 deletion packages/customer-satisfaction.gbapp/dialogs/QualityDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -82,7 +91,7 @@ export class QualityDialog extends IGBDialog {
setTimeout(resolve, ms);
});
};

await service.insertQuestionAlternate(
min.instance.instanceId,
user.lastQuestion,
Expand Down
7 changes: 4 additions & 3 deletions packages/customer-satisfaction.gbapp/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...',
Expand All @@ -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.',
}
};
11 changes: 8 additions & 3 deletions packages/hubspot.gblib/services/HubSpotServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
});
Expand Down

0 comments on commit 7410085

Please sign in to comment.