$phone, 'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah disetujui. Silahkan buka link berikut untuk melihat detailnya: ' . $url, 'source' => 'web' ]; } $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [ 'headers' => [ 'Authorization' => env('WABLAS_TOKEN'), 'Content-Type' => 'application/json' ], 'json' => [ 'data' => $data ] ]); return $response->getBody()->getContents(); } public static function rejectExpense($phones, $expense_number, $url = null) { $client = new Client(); if ($url && !preg_match('/^https?:\/\//', $url)) { $url = 'https://' . $url; } $data = []; foreach ($phones as $phone) { $data[] = [ 'phone' => $phone, 'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah ditolak. Silahkan buka link berikut untuk melihat detailnya: ' . $url, 'source' => 'web' ]; } $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [ 'headers' => [ 'Authorization' => env('WABLAS_TOKEN'), 'Content-Type' => 'application/json' ], 'json' => [ 'data' => $data ] ]); return $response->getBody()->getContents(); } public static function finalApprove($phones, $expense_number, $url = null) { $client = new Client(); if ($url && !preg_match('/^https?:\/\//', $url)) { $url = 'https://' . $url; } $data = []; foreach ($phones as $phone) { $data[] = [ 'phone' => $phone, 'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah ditutup karena telah selesai diproses. Silahkan buka link berikut untuk melihat detailnya: ' . $url, 'source' => 'web' ]; } $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [ 'headers' => [ 'Authorization' => env('WABLAS_TOKEN'), 'Content-Type' => 'application/json' ], 'json' => [ 'data' => $data ] ]); return $response->getBody()->getContents(); } public static function newExpense($phones, $expense_number, $url = null) { $client = new Client(); if ($url && !preg_match('/^https?:\/\//', $url)) { $url = 'https://' . $url; } $data = []; foreach ($phones as $phone) { $data[] = [ 'phone' => $phone, 'message' => 'Pengajuan pengeluaran baru dengan nomor *' . $expense_number . '* telah dibuat. Silahkan buka link berikut untuk melihat detailnya: ' . $url, 'source' => 'web' ]; } $response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [ 'headers' => [ 'Authorization' => env('WABLAS_TOKEN'), 'Content-Type' => 'application/json' ], 'json' => [ 'data' => $data ] ]); return $response->getBody()->getContents(); } }