fixed nextcloud and wa api

This commit is contained in:
Jagad R R
2025-02-16 20:18:36 +07:00
parent 838e170c6f
commit b3ce444c97
6 changed files with 175 additions and 83 deletions
+91 -61
View File
@@ -37,19 +37,24 @@ class WhatsappHelper
];
}
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
try {
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
return $response->getBody()->getContents();
return $response->getBody()->getContents();
} catch (\Exception $e) {
AuditTrailHelper::AddAuditTrail('Error', 'Failed to send WhatsApp message at Form (' . $expense_number . ')');
return null;
}
}
public static function approve2Expense($phones, $expense_number, $url = null, $tanggal, $total, $name)
@@ -81,19 +86,24 @@ class WhatsappHelper
];
}
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
try {
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
return $response->getBody()->getContents();
return $response->getBody()->getContents();
} catch (\Exception $e) {
AuditTrailHelper::AddAuditTrail('Error', 'Failed to send WhatsApp message at Form (' . $expense_number . ')');
return null;
}
}
public static function rejectExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
@@ -125,19 +135,24 @@ class WhatsappHelper
];
}
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
try {
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
return $response->getBody()->getContents();
return $response->getBody()->getContents();
} catch (\Exception $e) {
AuditTrailHelper::AddAuditTrail('Error', 'Failed to send WhatsApp message at Form (' . $expense_number . ')');
return null;
}
}
public static function finalApprove($phones, $expense_number, $url = null, $tanggal, $total, $name)
@@ -169,19 +184,24 @@ class WhatsappHelper
];
}
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
try {
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
return $response->getBody()->getContents();
return $response->getBody()->getContents();
} catch (\Exception $e) {
AuditTrailHelper::AddAuditTrail('Error', 'Failed to send WhatsApp message at Form (' . $expense_number . ')');
return null;
}
}
public static function newExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
@@ -213,18 +233,28 @@ class WhatsappHelper
];
}
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
dd(env('WABLAS_HOST'), env('WABLAS_TOKEN'), $data);
return $response->getBody()->getContents();
try {
// Send the request to the WABLAS API
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
'headers' => [
'Authorization' => env('WABLAS_TOKEN'),
'Content-Type' => 'application/json'
],
'json' => [
'data' => $data
],
'verify' => false,
]);
dd($response->getBody()->getContents());
return $response->getBody()->getContents();
} catch (\Exception $e) {
dd($e->getMessage());
AuditTrailHelper::AddAuditTrail('Error', 'Failed to send WhatsApp message at Form (' . $expense_number . ')');
return null;
}
}
}
}