|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | namespace Api\Wame;
|
3 | 4 |
|
4 | 5 | use stdClass;
|
@@ -420,23 +421,65 @@ public function sendTextWithMentions(string $groupId, string $text, array $menti
|
420 | 421 | public function sendMedia(string $to, string $url, string $type, string $caption, string $mimeType = '', bool $ptt = false)
|
421 | 422 | {
|
422 | 423 | // Define o corpo da requisição para enviar uma mensagem de mídia.
|
423 |
| - $this->parth = "/message/media?key={$this->key}"; |
| 424 | + // $this->parth = "/message/media?key={$this->key}"; |
| 425 | + // $this->method = "POST"; |
| 426 | + // $this->body = json_encode([ |
| 427 | + // "data" => [ |
| 428 | + // "to" => $to, |
| 429 | + // "url" => $url, |
| 430 | + // "type" => $type, |
| 431 | + // "caption" => $caption, |
| 432 | + // "mimeType" => $mimeType, |
| 433 | + // "ptt" => $ptt |
| 434 | + // ] |
| 435 | + // ]); |
| 436 | + // Executa a requisição e retorna o resultado. |
| 437 | + //return $this->request(); |
| 438 | + } |
| 439 | + |
| 440 | + |
| 441 | + public function sendImage(string $to, string $url, string $caption) |
| 442 | + { |
| 443 | + // Define o corpo da requisição para enviar uma mensagem de mídia. |
| 444 | + $this->parth = "/{$this->key}/message/image"; |
424 | 445 | $this->method = "POST";
|
425 | 446 | $this->body = json_encode([
|
426 |
| - "data" => [ |
427 |
| - "to" => $to, |
428 |
| - "url" => $url, |
429 |
| - "type" => $type, |
430 |
| - "caption" => $caption, |
431 |
| - "mimeType" => $mimeType, |
432 |
| - "ptt" => $ptt |
433 |
| - ] |
| 447 | + "to" => $to, |
| 448 | + "url" => $url, |
| 449 | + "caption" => $caption, |
| 450 | + ]); |
| 451 | + return $this->request(); |
| 452 | + } |
| 453 | + |
| 454 | + public function sendVideo(string $to, string $url, string $caption) |
| 455 | + { |
| 456 | + // Define o corpo da requisição para enviar uma mensagem de mídia. |
| 457 | + $this->parth = "/{$this->key}/message/video"; |
| 458 | + $this->method = "POST"; |
| 459 | + $this->body = json_encode([ |
| 460 | + "to" => $to, |
| 461 | + "url" => $url, |
| 462 | + "caption" => $caption, |
434 | 463 | ]);
|
| 464 | + return $this->request(); |
| 465 | + } |
435 | 466 |
|
436 |
| - // Executa a requisição e retorna o resultado. |
| 467 | + public function sendDocument(string $to, string $url, string $caption, string $mimetype, $fileName) |
| 468 | + { |
| 469 | + // Define o corpo da requisição para enviar uma mensagem de mídia. |
| 470 | + $this->parth = "/{$this->key}/message/document"; |
| 471 | + $this->method = "POST"; |
| 472 | + $this->body = json_encode([ |
| 473 | + "to" => $to, |
| 474 | + "url" => $url, |
| 475 | + "caption" => $caption, |
| 476 | + "mimetype" => $mimetype, |
| 477 | + "fileName" => $fileName, |
| 478 | + ]); |
437 | 479 | return $this->request();
|
438 | 480 | }
|
439 | 481 |
|
| 482 | + |
440 | 483 | /**
|
441 | 484 | * Envia uma mensagem com botões para um destinatário.
|
442 | 485 | *
|
@@ -926,5 +969,4 @@ public function constructWebhook()
|
926 | 969 | }
|
927 | 970 | }
|
928 | 971 | }
|
929 |
| - |
930 | 972 | }
|
0 commit comments