Deploy: 2026-05-22 00:22:23
This commit is contained in:
@@ -145,8 +145,12 @@ class CampaignController extends BaseController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gatewayUrl = getenv('WHATSAPP_GATEWAY_URL') ?: 'http://localhost:3722';
|
$gatewayUrl = rtrim(getenv('WHATSAPP_GATEWAY_URL') ?: 'http://localhost:3722', '/');
|
||||||
|
if (substr($gatewayUrl, -4) === '/api') {
|
||||||
|
$sendUrl = $gatewayUrl . '/messages/send';
|
||||||
|
} else {
|
||||||
$sendUrl = $gatewayUrl . '/api/messages/send';
|
$sendUrl = $gatewayUrl . '/api/messages/send';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($contacts as $rawContact) {
|
foreach ($contacts as $rawContact) {
|
||||||
// Decrypt contact data
|
// Decrypt contact data
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ class GroupController extends BaseController
|
|||||||
public function index(Request $request, Response $response)
|
public function index(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
$groupModel = new ContactGroup();
|
$groupModel = new ContactGroup();
|
||||||
// Since ContactGroup extends BaseModel we can access the DB connection
|
$groups = \App\Core\Database::select(
|
||||||
$groups = $groupModel->db->query(
|
|
||||||
"SELECT * FROM contact_groups WHERE company_id = ? ORDER BY id DESC",
|
"SELECT * FROM contact_groups WHERE company_id = ? ORDER BY id DESC",
|
||||||
[$request->company_id]
|
[$request->company_id]
|
||||||
)->fetchAll();
|
);
|
||||||
|
|
||||||
$response->json([
|
$response->json([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
|
|||||||
@@ -244,8 +244,12 @@ class WhatsAppController extends BaseController
|
|||||||
|
|
||||||
if (!empty($replyText)) {
|
if (!empty($replyText)) {
|
||||||
// Send reply back to the contact via Node.js Gateway
|
// Send reply back to the contact via Node.js Gateway
|
||||||
$gatewayUrl = getenv('WHATSAPP_GATEWAY_URL') ?: 'http://localhost:3722';
|
$gatewayUrl = rtrim(getenv('WHATSAPP_GATEWAY_URL') ?: 'http://localhost:3722', '/');
|
||||||
|
if (substr($gatewayUrl, -4) === '/api') {
|
||||||
|
$sendUrl = $gatewayUrl . '/messages/send';
|
||||||
|
} else {
|
||||||
$sendUrl = $gatewayUrl . '/api/messages/send';
|
$sendUrl = $gatewayUrl . '/api/messages/send';
|
||||||
|
}
|
||||||
|
|
||||||
$payload = json_encode([
|
$payload = json_encode([
|
||||||
'session_key' => $session['session_key'],
|
'session_key' => $session['session_key'],
|
||||||
|
|||||||
24
backend/public/debug-chatbot.php
Normal file
24
backend/public/debug-chatbot.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__) . '/app/bootstrap.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$rules = \App\Core\Database::select("SELECT * FROM chatbot_rules");
|
||||||
|
foreach ($rules as &$rule) {
|
||||||
|
if (!empty($rule['gemini_api_key'])) {
|
||||||
|
$rule['gemini_api_key_set'] = true;
|
||||||
|
unset($rule['gemini_api_key']);
|
||||||
|
} else {
|
||||||
|
$rule['gemini_api_key_set'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$logs = \App\Core\Database::select("SELECT * FROM messages_log ORDER BY id DESC LIMIT 20");
|
||||||
|
|
||||||
|
$sessions = \App\Core\Database::select("SELECT * FROM whatsapp_sessions");
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
'chatbot_rules' => $rules,
|
||||||
|
'messages_log' => $logs,
|
||||||
|
'whatsapp_sessions' => $sessions
|
||||||
|
], JSON_PRETTY_PRINT);
|
||||||
Reference in New Issue
Block a user