@@ -21,7 +21,7 @@ $ composer require wppconnect-team/wppconnect-laravel-client
2121Register the GuzzleApiServiceProvider to the providers array in ` config/app.php ` :
2222
2323``` php
24- WPPConnectTeam\Wppconnect\GuzzleApiServiceProvider ::class
24+ WPPConnectTeam\Wppconnect\WppconnectServiceProvider ::class
2525```
2626
2727Publish vendor files (config file):
@@ -97,9 +97,9 @@ class WppconnectController extends Controller
9797
9898 public function index(){
9999
100- /**
101- * Function: Get Token
102- */
100+ #Function: Generated Token
101+ # /api/:session/generate-token
102+
103103 //Session::flush();
104104 if(!Session::get('token') and !Session::get('session')):
105105 Wppconnect::make($this->url);
@@ -111,9 +111,9 @@ class WppconnectController extends Controller
111111 endif;
112112 endif;
113113
114- /**
115- * Function: Start Session
116- */
114+ #Function: Start Session
115+ # /api/:session/start-session
116+
117117 if(Session::get('token') and Session::get('session') and !Session::get('init')):
118118 Wppconnect::make($this->url);
119119 $response = Wppconnect::to('/api/'.Session::get('session').'/start-session')->withHeaders([
@@ -122,64 +122,67 @@ class WppconnectController extends Controller
122122 $response = json_decode($response->getBody()->getContents(),true);
123123 Session::put('init', true);
124124 endif;
125-
126- /**
127- * Function: Check Connection Session
128- */
129- if(Session::get('token') and Session::get('session') and Session::get('init')):
130- Wppconnect::make($this->url);
131- $response = Wppconnect::to('/api/'. Session::get('session').'/check-connection-session')->withHeaders([
132- 'Authorization' => 'Bearer '.Session::get('token')
133- ])->asJson()->get();
134- $response = json_decode($response->getBody()->getContents(),true);
135- dd($response);
136- endif;
137-
138- /**
139- * Function: Close Session
140- */
141- if(Session::get('token') and Session::get('session') and Session::get('init')):
142- Wppconnect::make($this->url);
143- $response = Wppconnect::to('/api/'. Session::get('session').'/close-session')->withHeaders([
144- 'Authorization' => 'Bearer '.Session::get('token')
145- ])->asJson()->post();
146- $response = json_decode($response->getBody()->getContents(),true);
147- dd($response);
148- endif;
149-
150- /**
151- * Function: Send Message
152- */
153- if(Session::get('token') and Session::get('session') and Session::get('init')):
154- Wppconnect::make($this->url);
155- $response = Wppconnect::to('/api/'. Session::get('session').'/send-message')->withBody([
156- 'phone' => '0000000000000',
157- 'message' => 'Opa, funciona mesmo!'
158- ])->withHeaders([
159- 'Authorization' => 'Bearer '.Session::get('token')
160- ])->asJson()->post();
161- $response = json_decode($response->getBody()->getContents(),true);
162- dd($response);
163- endif;
164-
165125
166- /**
167- * Function: Send File Base64
168- */
169- if(Session::get('token') and Session::get('session') and Session::get('init')):
170- Wppconnect::make($this->url);
171- $response = Wppconnect::to('/api/'. Session::get('session').'/send-file-base64')->withBody([
172- 'phone' => '0000000000000',
173- 'base64' => 'data:image/jpg;base64,' . base64_encode(file_get_contents(resource_path('/img/xpto.jpg')))
174- ])->withHeaders([
175- 'Authorization' => 'Bearer '.Session::get('token')
176- ])->asJson()->post();
177- $response = json_decode($response->getBody()->getContents(),true);
178- dd($response);
179- endif;
180-
181126 }
182- }
127+ }
128+ ```
129+ ``` php
130+ #Function: Check Connection Session
131+ # /api/:session/check-connection-session
132+
133+ if(Session::get('token') and Session::get('session') and Session::get('init')):
134+ Wppconnect::make($this->url);
135+ $response = Wppconnect::to('/api/'. Session::get('session').'/check-connection-session')->withHeaders([
136+ 'Authorization' => 'Bearer '.Session::get('token')
137+ ])->asJson()->get();
138+ $response = json_decode($response->getBody()->getContents(),true);
139+ dd($response);
140+ endif;
141+ ```
142+ ``` php
143+ #Function: Close Session
144+ # /api/:session/close-session
145+
146+ if(Session::get('token') and Session::get('session') and Session::get('init')):
147+ Wppconnect::make($this->url);
148+ $response = Wppconnect::to('/api/'. Session::get('session').'/close-session')->withHeaders([
149+ 'Authorization' => 'Bearer '.Session::get('token')
150+ ])->asJson()->post();
151+ $response = json_decode($response->getBody()->getContents(),true);
152+ dd($response);
153+ endif;
154+ ```
155+ ``` php
156+ #Function: Send Message
157+ # /api/:session/send-message
158+
159+ if(Session::get('token') and Session::get('session') and Session::get('init')):
160+ Wppconnect::make($this->url);
161+ $response = Wppconnect::to('/api/'. Session::get('session').'/send-message')->withBody([
162+ 'phone' => '0000000000000',
163+ 'message' => 'Opa, funciona mesmo!'
164+ ])->withHeaders([
165+ 'Authorization' => 'Bearer '.Session::get('token')
166+ ])->asJson()->post();
167+ $response = json_decode($response->getBody()->getContents(),true);
168+ dd($response);
169+ endif;
170+ ```
171+ ``` php
172+ #Function: Send File Base64
173+ # /api/:session/send-file-base64
174+
175+ if(Session::get('token') and Session::get('session') and Session::get('init')):
176+ Wppconnect::make($this->url);
177+ $response = Wppconnect::to('/api/'. Session::get('session').'/send-file-base64')->withBody([
178+ 'phone' => '0000000000000',
179+ 'base64' => 'data:image/jpg;base64,' . base64_encode(file_get_contents(resource_path('/img/xpto.jpg')))
180+ ])->withHeaders([
181+ 'Authorization' => 'Bearer '.Session::get('token')
182+ ])->asJson()->post();
183+ $response = json_decode($response->getBody()->getContents(),true);
184+ dd($response);
185+ endif;
183186```
184187
185188# Debugging
0 commit comments