Browse Source

ajuste do padrão de msg simples chat

websocket
lucascardo12 3 years ago
parent
commit
946d0fa94e
  1. 2
      app/Core/CoreMedia.php
  2. 2
      app/Interfaces/IApiMedia.php
  3. 15
      app/Providers/Positus.php
  4. 17
      database/msg-text-positus.json

2
app/Core/CoreMedia.php

@ -65,7 +65,7 @@ class CoreMedia
$file = $this->api->baixarMidia($this->file);
return $file;
}
$this->ws->enviaMsg($api->convertToWebsocket($this->request));
$this->ws->enviaMsg($api->convertToWebsocket($this->request, '1022', time()));
/**
* VERIFICA SE N?O MENSAGEM DO POSITUS DE CONFIRMA??O
*/

2
app/Interfaces/IApiMedia.php

@ -36,5 +36,5 @@ interface IApiMedia
function response($result);
public function getLinkDownload($host);
public function retornaTituloDocument($msg);
public function convertToWebsocket($msg);
public function convertToWebsocket($msg, $matricula, $atendimento);
}

15
app/Providers/Positus.php

@ -27,7 +27,7 @@ class Positus implements IApiMedia
########################################################################
## RECURSOS DA API ##
########################################################################
public function convertToWebsocket($msg)
public function convertToWebsocket($msg, $matricula = '', $atendimento)
{
if ($msg['contacts']) {
$mensagem = [];
@ -35,17 +35,26 @@ class Positus implements IApiMedia
"type" => "mensagem",
"contact" => [
"name" => $msg['contacts'][0]['profile']['name'],
"number" => $msg['contacts'][0]['wa_id']
"number" => $msg['contacts'][0]['wa_id'],
"matricula" => ''
],
"mensagem" => [
"type" => $msg['messages'][0]['type'],
"content" => $msg['messages'][0]['text']['body']
"content" => $msg['messages'][0]['text']['body'],
"id" => "425435243",
"dst" => $matricula,
"idAtendimento" => $atendimento,
"media" => $this->channel,
"datetime" => $msg['messages'][0]['timestamp'],
"status" => "sent"
]
];
return json_encode($mensagem);
}
return "";
}
function enviarMsg($whatsapp, $mensagem)
{
$this->debug = debug_backtrace();

17
database/msg-text-positus.json

@ -0,0 +1,17 @@
{
"contacts": [{
"profile": {
"name": "Lucas"
},
"wa_id": "556596107663"
}],
"messages": [{
"from": "556596107663",
"id": "ABEGVWWWEHZjAhBQHfcZqjRX4rWUHoW5CZul",
"text": {
"body": "Test"
},
"timestamp": "1637696166",
"type": "text"
}]
}
Loading…
Cancel
Save