Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

O aplicativo do evolux phone vai disparar alguns eventos que podem ser capturados por uma aplicação no SalesForce.

Exemplo de uso:

Code Block
languagejs
titleExemplo
addEventListener('message', event => {
   if (event.data.eventName === 'softphoneCallInvited') {
        	console.log('softphoneCallInvitedreceived from Evolux', event.data.payload);
   }
});


Eventos:

softphoneCallInvited

Exemplo de payload:

Info

Informações adicionais capturadas por URA Inteligentes (ex.: número de CPF) podem ser recuperadas no campo "extra".


Code Block
languagejs
{
  agent: {"id": 1, name: "Teste", extension: 612},
  answerTime: null"8eb4d68e-722a-11eb-914b-d185dd1424c7",
  "uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "recordingUUID": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "originationLegUuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "direction": "outboundinbound",
  endTime"hangupCause": null,
  extra: {cpf: "09536679433"}"startTime": "2021-02-18T20:47:47.476Z",
  "answerTime": null,
  "endTime": null,
  "from": {
    "name": "612Suporte 601",
    "number": "612601"
  },
  "to": {
 hangupCause   "name": null"700",
    id"number": "09a4482a60916f51-a81bc6f5-4a69a853-6fa1-114327490832",
  originationLegUuid: "09a4482a-a81b-4a69-6fa1-114327490832",
  queue: {slug: "pao2", number: "4002"},
  startTime: "2019-04-11T19:38:41.046Z",
  to: {name: "601", number: "601"},
  uuid: "09a4482a-a81b-4a69-6fa1-114327490832"
}

softphoneCallAccepted

Exemplo de payload:

Code Block
languagejs
{
  agent: {id: 1, name: "Teste", extension: 612},
  answerTime: "2019-04-11T19:38:44.101Z",
  direction: "outbound",
  endTime: null,
  extra: {cpf: "09536679433"},
  from: {name: "612", number: "612"},
  hangupCause: null,
  id: "09a4482a-a81b-4a69-6fa1-114327490832",
  originationLegUuid: "09a4482a-a81b-4a69-6fa1-114327490832",
  queue: {slug: "pao2", number: "4002"},
  startTime: "2019-04-11T19:38:41.046Z",
  to: {name: "601", number: "601"},
  uuid: "09a4482a-a81b-4a69-6fa1-114327490832"
}

softphoneCallEnded

Exemplo de payload:

Code Block
languagejs
{
  agent: {id: 1, name: "Teste", extension: 612},
  answerTime: "2019-04-11T19:38:44.101Z",
  direction: "outbound",
  endTime: "2019-04-11T19:42:40.357Z",
  extra: {cpf: "09536679433"},
  from: {name: "612", number: "612"},
  hangupCause: "NORMAL CLEARING",
  id: "09a4482a-a81b-4a69-6fa1-114327490832",
  originationLegUuid: "09a4482a-a81b-4a69-6fa1-114327490832",
  queue: {slug: "pao2", number: "4002"},
  startTime: "2019-04-11T19:38:41.046Z",
  to: {name: "601", number: "601"},
  uuid: "09a4482a-a81b-4a69-6fa1-114327490832"3651-a8a456064080"
  },
  "agent": {
    "id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    "email": ""
  },
  "extra": {
    "evolux_cc_member_session_uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
    "evolux_cc_queue_number": "4000",
    "evolux_cc_queue_slug": "suporte"
  },
  "queue": {
    "slug": "suporte",
    "number": "4000"
  }
}

Exemplo com uma chamada de campanha:

Code Block
languagejs
{
  "id": "7b684fba-722b-11eb-915c-d185dd1424c7",
  "uuid": "7b685078-722b-11eb-915d-d185dd1424c7",
  "recordingUUID": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "originationLegUuid": "7b685078-722b-11eb-915d-d185dd1424c7",
  "direction": "inbound",
  "hangupCause": null,
  "startTime": "2021-02-18T20:54:30.244Z",
  "answerTime": "2021-02-18T20:54:35.218Z",
  "endTime": null,
  "from": {
    "name": "Campanha de Cobrança Anual",
    "number": "601"
  },
  "to": {
    "name": "Campanha de Cobrança Anual",
    "number": "601"
  },
  "agent": {
    "id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    "email": ""
  },
  "extra": {
    "campaign_id": "1",
    "evolux_cc_agent": "joao",
    "subscriber_id": "1",
    "subscriber_number": "601",
    "subscriber_name": "Maria",
    "campaign_slug": "campanha_de_cobranca_anual",
    "dialer_subscriber_origination_uuid": "7b685078-722b-11eb-915d-d185dd1424c7",
    "subscriber_external_id": "000120"
  },
  "campaign": {
    "id": "1",
    "slug": "campanha_de_cobranca_anual"
  },
  "subscriber": {
    "number": "601",
    "name": "Maria",
    "externalId": "000120"
  }
}


softphoneCallAccepted

Exemplo de payload:

Code Block
languagejs
{
  "id": "8eb4d68e-722a-11eb-914b-d185dd1424c7",
  "uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "recordingUUID": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "originationLegUuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "direction": "inbound",
  "hangupCause": null,
  "startTime": "2021-02-18T20:47:47.476Z",
  "answerTime": "2021-02-18T20:47:56.105Z",
  "endTime": null,
  "from": {
    "name": "Suporte 601",
    "number": "601"
  },
  "to": {
    "name": "700",
    "number": "60916f51-c6f5-a853-3651-a8a456064080"
  },
  "agent": {
    "id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    "email": ""
  },
  "extra": {
    "evolux_cc_member_session_uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
    "evolux_cc_queue_number": "4000",
    "evolux_cc_queue_slug": "nordestao"
  },
  "queue": {
    "slug": "suporte",
    "number": "4000"
  }
}

softphoneCallEnded

Exemplo de payload:

Code Block
languagejs
{
  "id": "8eb4d68e-722a-11eb-914b-d185dd1424c7",
  "uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "recordingUUID": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "originationLegUuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
  "direction": "inbound",
  "hangupCause": "NORMAL CLEARING",
  "startTime": "2021-02-18T20:47:47.476Z",
  "answerTime": "2021-02-18T20:47:56.105Z",
  "endTime": "2021-02-18T20:47:58.470Z",
  "from": {
    "name": "Suporte 601",
    "number": "601"
  },
  "to": {
    "name": "700",
    "number": "60916f51-c6f5-a853-3651-a8a456064080"
  },
  "agent": {
    "id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    "email": ""
  },
  "extra": {
    "evolux_cc_member_session_uuid": "8dc216ba-722a-11eb-911a-d185dd1424c7",
    "evolux_cc_queue_number": "4000",
    "evolux_cc_queue_slug": "nordestao"
  },
  "queue": {
    "slug": "suporte",
    "number": "4000"
  }
}

agentStartPause

Exemplo de payload:

Code Block
languagejs
{
  "agentId": 1,
  pause"agent": {
    maxDuration: null"id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    productive: true,"email": ""
  },
  "pause": {
    "reason": "BackofficeLanche",
    "productive": false,
    "timeStart": "20192021-0402-03T2318T20:4251:0154.096056866913+00:00",
    "timeEnd": null,
    "maxDuration": null
  }
}

agentChangePause

Exemplo de payload:

Code Block
languagejs
{
  "agentId": 1,
  "agent": {
    "id": 1,
    pause"name": "João",
    "extension": {700,
    maxDuration"login": 5"joao",
    productive: true,
"email": ""
  },
  "pause": {
    "reason": "10 minutos/NR17""Reunião",
    "productive": true,
    "timeStart": "20192021-0402-03T2318T20:4252:0435.885629366557+00:00",
    "timeEnd": null,
    "maxDuration": null
  }
}

agentStopPause

Exemplo de payload:

Code Block
languagejs
{
  "agentId": 1,
  "agent": {
    "id": 1,
    "name": "João",
    "extension": 700,
    "login": "joao",
    "email": ""
  },
  "pause": {
    "reason": "Lanche",
    "productive": false,
    "timeStart": "2021-02-18T20:51:54+00:00",
    "timeEnd": "2021-02-18T20:52:09+00:00",
    "maxDuration": null
  }
}

agentLogin

Exemplo de payload:

Code Block
languagejs
{
  "agentId": 1,
  "agent": {
    "id": 1,
    "name": "João",
    "extension": "700",
    "login": "joao",
    "612",
  name: "Teste",
}email": null
  }
}


Criando uma aplicação de exemplo

Nesta sessão vamos criar uma aplicação de exemplo usando a ferramente de linha de commando sfdx-cli.

Execute o comando abaixo para instalar a ferramenta sfdx-cli

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_workspace_setup.htm

Code Block
languagebash
npm install -g sfdx-cli


Após instalar vamos criar uma app usando o comando 

Code Block
sfdx force:project:create -n NomeDaApp


Com a app criada vamos criar um aura componente para registrar o callbacks dos eventos que o EvoluxPhone dispara.

Code Block
languagebash
cd NomeDaApp/force-app/main/default/aurasfdx force:lightning:component:create -n NomeDoComponente


Após criar o componente que vai escutar os eventos disparados pelo EvoluxPhone é necessário registrar os eventos que desejamos na inicialização, para isso precisamos fazer algumas modifacações nos arquivos NomeDoComponente.cmp NomeDoComponenteController.js.

Exemplo de configuração:

force-app/main/default/aura/NomeDoComponente/NomeDoComponente.cmp

Code Block
<aura:component implements="lightning:backgroundUtilityItem">
  <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
</aura:component>


force-app/main/default/aura/NomeDoComponente/NomeDoComponenteController.js

Code Block
({
  doInit: function (component, event, helper) {
    const eventNames = [
      "softphoneCallInvited",
      "softphoneCallAccepted",
      "softphoneCallEnded",
      "agentStartPause",
      "agentChangePause",
      "agentStopPause",
      "agentLogin"
    ];

    const proxyToObject = (proxy) => {
      // TODO: configure the eslint to not raise an error with spread operator
      return JSON.parse(JSON.stringify(proxy));
    };

    addEventListener("message", (event) => {
      const { eventName, payload } = event.data;
      if (eventNames.indexOf(eventName) !== -1) {
        console.log(
          `[EVOLUX_PHONE_EVENT_LISTENER]  eventName: ${eventName}`,
          proxyToObject(payload)
        );
        //  Execute alguma ações de acordo com a sua regra de negócio
      }
    });
  }
});


Após editar estes arquivos você pode fazer upload da app para a sua organização. O sfdx-cli fornece algumas formas de fazer isso, uma delas é:

Code Block
sfdx force:soruce:deploy -p force-app -u <nome_do_usuário>


Com a aplicação instalada na organização o administrador do sistema pode habilita-lá  em Setup > Apps > App Manager > Edit App (ex: Sales Lightning) > Utility Items.

Image Added

Após a app ser adicionada na utility bar é necessário dar reload na página da App (ex: Sales) e ao fazer uma ligação será exibido um log  que inicia com EVOLUX_PHONE_EVENT_LISTENER contendo o nome do evento e o seus dados.


Image Added
 



Evolux Phone - Ambiente de Teste



Para acessar uma página onde é possível utilizar o EvoluxPhone e verificar quais eventos estão sendo disparados em tempo real, basta ir na url 
https://[URL DO CLIENTE]/monitor/agent/evolux_phone_test e fazer o login normalmente:


Image Added