src/Model/Email/Webhook/Webhook.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Model\Email\Webhook;
  3. use App\Enum\EmailMessageStatusEnum;
  4. use DateTime;
  5. use DateTimeInterface;
  6. use Symfony\Component\Serializer\Annotation\SerializedName;
  7. /**
  8.  *
  9.  * @see https://developers.brevo.com/docs/getting-started
  10.  * @see https://developers.brevo.com/docs/transactional-webhooks
  11.  * @see https://developers.brevo.com/docs/send-a-transactional-email
  12.  * @see https://developers.brevo.com/docs/send-a-transactional-email#tracking-your-transactional-activity-through-webhooks
  13.  * @see https://developers.brevo.com/reference/sendtransacemail
  14.  */
  15. class Webhook
  16. {
  17.     private string $event// type of event (status synonym) from EmailMessageStatusEnum
  18.     /**
  19.      * @SerializedName("id")
  20.      */
  21.     private string $webhookId// webhook id at the third party mail provider (Brevo e.g.)
  22.     private string $email// TO (the recipient of the email)
  23.     /**
  24.      * @SerializedName("ts")
  25.      */
  26.     private string $timestamp;
  27.     /**
  28.      * @SerializedName("message-id")
  29.      */
  30.     private string $messageId// message-id at the third party mail provider (Brevo e.g.)
  31.     private string $subject;
  32.     private ?string $link null// URL accessed by recipient
  33.     private ?string $deviceUsed null// Details about the device from which the action originated (DESKTOP, MOBILE, ...)
  34.     private ?string $reason null// The reason the message has been deferred, soft_bounced or hard_bounce
  35.     public function __construct()
  36.     {
  37.     }
  38.     public function getEvent(): string
  39.     {
  40.         return $this->event;
  41.     }
  42.     public function setEvent(string $event): self
  43.     {
  44.         $this->event $event;
  45.         return $this;
  46.     }
  47.     public function getWebhookId(): string
  48.     {
  49.         return $this->webhookId;
  50.     }
  51.     public function setWebhookId(string $webhookId): self
  52.     {
  53.         $this->webhookId $webhookId;
  54.         return $this;
  55.     }
  56.     public function getEmail(): string
  57.     {
  58.         return $this->email;
  59.     }
  60.     public function setEmail(string $email): self
  61.     {
  62.         $this->email $email;
  63.         return $this;
  64.     }
  65.     public function getTimestamp(): string
  66.     {
  67.         return $this->timestamp;
  68.     }
  69.     public function setTimestamp(string $timestamp): self
  70.     {
  71.         $this->timestamp $timestamp;
  72.         return $this;
  73.     }
  74.     public function getEventDatetime(): DateTimeInterface
  75.     {
  76.         $datetime = new DateTime();
  77.         return $datetime->setTimestamp($this->timestamp);
  78.     }
  79.     public function getMessageId(): string
  80.     {
  81.         return $this->messageId;
  82.     }
  83.     public function setMessageId(string $messageId): self
  84.     {
  85.         $this->messageId $messageId;
  86.         return $this;
  87.     }
  88.     public function getSubject(): string
  89.     {
  90.         return $this->subject;
  91.     }
  92.     public function setSubject(string $subject): self
  93.     {
  94.         $this->subject $subject;
  95.         return $this;
  96.     }
  97.     public function getLink(): ?string
  98.     {
  99.         return $this->link;
  100.     }
  101.     public function setLink(?string $link): self
  102.     {
  103.         $this->link $link;
  104.         return $this;
  105.     }
  106.     public function getDeviceUsed(): ?string
  107.     {
  108.         return $this->deviceUsed;
  109.     }
  110.     public function setDeviceUsed(?string $deviceUsed): self
  111.     {
  112.         $this->deviceUsed $deviceUsed;
  113.         return $this;
  114.     }
  115.     public function getReason(): ?string
  116.     {
  117.         return $this->reason;
  118.     }
  119.     public function setReason(?string $reason): self
  120.     {
  121.         $this->reason $reason;
  122.         return $this;
  123.     }
  124. }