fix: usar phone_number_id real del webhook + actualizado en BD
This commit is contained in:
@@ -21,7 +21,8 @@ class BotRouter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::enqueueResponse($response, $company);
|
$metaPhoneNumberId = $context['phone_number_id'] ?? '';
|
||||||
|
self::enqueueResponse($response, $company, $metaPhoneNumberId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function saveForApproval(array $company, array $context, string $input, array $response): void
|
private static function saveForApproval(array $company, array $context, string $input, array $response): void
|
||||||
@@ -129,7 +130,7 @@ class BotRouter
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function enqueueResponse(array $response, array $company): void
|
private static function enqueueResponse(array $response, array $company, string $metaPhoneNumberId = ''): void
|
||||||
{
|
{
|
||||||
$to = $response['to'] ?? '';
|
$to = $response['to'] ?? '';
|
||||||
$type = $response['type'] ?? 'text';
|
$type = $response['type'] ?? 'text';
|
||||||
@@ -165,7 +166,7 @@ class BotRouter
|
|||||||
time(),
|
time(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$phoneNumberId = $company['phone_number_id'] ?: env('WHATSAPP_PHONE_NUMBER_ID', '');
|
$phoneNumberId = $metaPhoneNumberId ?: ($company['phone_number_id'] ?: env('WHATSAPP_PHONE_NUMBER_ID', ''));
|
||||||
if ($phoneNumberId === '') {
|
if ($phoneNumberId === '') {
|
||||||
self::log("ERROR: phone_number_id no configurado para company {$company['id']}");
|
self::log("ERROR: phone_number_id no configurado para company {$company['id']}");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user