@@ -10,9 +10,9 @@ class Fonnte
1010
1111 // Konstanta endpoint API Fonnte
1212 const ENDPOINTS = [
13- 'send_message ' => 'https://api.fonnte.com/send ' ,
14- 'update_group ' =>'https://api.fonnte.com/fetch-group ' ,
15- 'list_group ' =>'https://api.fonnte.com/get-whatsapp-group ' ,
13+ 'send_message ' => 'https://api.fonnte.com/send ' ,
14+ 'update_group ' => 'https://api.fonnte.com/fetch-group ' ,
15+ 'list_group ' => 'https://api.fonnte.com/get-whatsapp-group ' ,
1616
1717 ];
1818
@@ -28,35 +28,35 @@ public function __construct()
2828
2929 protected function makeRequest ($ endpoint , $ params = [])
3030 {
31- $ token = $ this ->account_token ;
31+ $ token = $ this ->account_token ;
3232
33- if (!$ token ) {
33+ if (! $ token ) {
3434 return ['status ' => false , 'error ' => 'API token or device token is required. ' ];
3535 }
3636
3737 // Gunakan JSON format dan pastikan Content-Type header benar
3838 $ response = Http::withHeaders ([
3939 'Authorization ' => $ token ,
40- 'Content-Type ' => 'application/json ' , // Tambahkan header
40+ 'Content-Type ' => 'application/json ' , // Tambahkan header
4141 ])->post ($ endpoint , $ params );
4242
4343 if ($ response ->failed ()) {
4444 return [
4545 'status ' => false ,
46- 'error ' => $ response ->json ()['reason ' ] ?? 'Unknown error occurred ' ,
46+ 'error ' => $ response ->json ()['reason ' ] ?? 'Unknown error occurred ' ,
4747 ];
4848 }
4949
5050 return [
5151 'status ' => true ,
52- 'data ' => $ response ->json (),
52+ 'data ' => $ response ->json (),
5353 ];
5454 }
5555
5656 public function sendWhatsAppMessage ($ phoneNumber , $ message )
5757 {
5858 return $ this ->makeRequest (self ::ENDPOINTS ['send_message ' ], [
59- 'target ' => $ phoneNumber ,
59+ 'target ' => $ phoneNumber ,
6060 'message ' => $ message ,
6161 ]);
6262 }
@@ -70,5 +70,4 @@ public function getWhatsappGroupList()
7070 {
7171 return $ this ->makeRequest (self ::ENDPOINTS ['list_group ' ]);
7272 }
73-
74- }
73+ }
0 commit comments