From 7cd0dbbd175f0808e9c649f676fdc564577a00ce Mon Sep 17 00:00:00 2001 From: Yechiel Date: Mon, 25 Nov 2024 17:20:08 -0500 Subject: [PATCH] webhook fixes --- src/RingCentral.php | 4 +++- src/RingCentralServiceProvider.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/RingCentral.php b/src/RingCentral.php index 3823925..26de295 100644 --- a/src/RingCentral.php +++ b/src/RingCentral.php @@ -261,9 +261,11 @@ public function createWebhook(array $filters, int $expiresIn, string $address): 'deliveryMode' => [ 'transportType' => 'WebHook', 'address' => $address, - 'verificationToken' => $this->verification_token, ], ]; + if ($this->verification_token) { + $data['deliveryMode']['verificationToken'] = $this->verification_token; + } return $this->post('/subscription', $data); } diff --git a/src/RingCentralServiceProvider.php b/src/RingCentralServiceProvider.php index 25a0cd3..096acfe 100644 --- a/src/RingCentralServiceProvider.php +++ b/src/RingCentralServiceProvider.php @@ -57,6 +57,10 @@ protected function createRingCentralClient(): RingCentral { $ringCentral->setJwt(config('ringcentral.jwt')); } + if ($this->ringCentralConfigHas('verification_token')) { + $ringCentral->setVerificationToken(config('ringcentral.verification_token')); + } + return $ringCentral; }