Phase 4: Fix Response status method and implement WhatsApp incoming messages webhook

This commit is contained in:
Hamza-Ayed
2026-05-21 20:45:14 +03:00
parent 1c584174d9
commit a7809bcf60
2 changed files with 7 additions and 0 deletions

View File

@@ -149,6 +149,8 @@ class WhatsAppController extends BaseController
// 1. Find or create the contact in the CRM
$contact = \App\Models\Contact::findByPhone($session['company_id'], $msgData['phone']);
if (!$contact) {
// Determine a fallback name
$contactName = !empty($msgData['name']) ? $msgData['name'] : 'WA-' . substr($msgData['phone'], -4);
\App\Models\Contact::createSecure([

View File

@@ -16,6 +16,11 @@ class Response
return $this;
}
public function status(int $code): self
{
return $this->setStatusCode($code);
}
public function getStatusCode(): int
{
return $this->statusCode;