Phase 4: Fix Response status method and implement WhatsApp incoming messages webhook
This commit is contained in:
@@ -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([
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user