Skip to content

Commit

Permalink
Added react to message feature
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickobedgiu1 committed Mar 11, 2024
1 parent 2a8fafc commit b162fbd
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Message/ReactionMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Netflie\WhatsAppCloudApi\Message;

final class ReactionMessage extends Message
{
/**
* {@inheritdoc}
*/
protected string $type = 'reaction';

private $emoji;

private $message_id;

/**
* {@inheritdoc}
*/
public function __construct(string $to, string $emoji, string $message_id)
{
$this->emoji = $emoji;
$this->message_id = $message_id;

parent::__construct($to, null);
}

public function emoji(): string
{
return $this->emoji;
}

public function message_id(): string
{
return $this->message_id;
}
}
27 changes: 27 additions & 0 deletions src/Request/MessageRequest/RequestReactionMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Netflie\WhatsAppCloudApi\Request\MessageRequest;

use Netflie\WhatsAppCloudApi\Request\MessageRequest;

final class RequestReactionMessage extends MessageRequest
{
/**
* {@inheritdoc}
*/
public function body(): array
{
$body = [
'messaging_product' => $this->message->messagingProduct(),
'recipient_type' => $this->message->recipientType(),
'to' => $this->message->to(),
'type' => $this->message->type(),
$this->message->type() => [
'message_id' => $this->message->message_id(),
'emoji' => $this->message->emoji(),
],
];

return $body;
}
}

0 comments on commit b162fbd

Please sign in to comment.