client = new Client([ 'base_uri' => rtrim(config('scheduler.mattermost.server_url'), '/') . '/api/v4/', 'headers' => [ 'Authorization' => 'Bearer ' . config('scheduler.mattermost.access_token'), 'Accept' => 'application/json', 'Content-Type' => 'application/json', ], ]); } public function run(): void { try { $this->client->request( $this->config['method'] ?? 'POST', $this->config['endpoint'], [ 'json' => json_decode($this->config['body'] ?? '', true), ] ); } catch (GuzzleException $e) { Log::error("Call to Mattermost failed. " . $e->getMessage()); } } public static function configSchema(): array { return [ 'endpoint' => [ 'type' => 'string', 'label' => 'API Endpoint', 'rules' => [ 'required', 'string', 'max:255', ] ], 'method' => [ 'type' => 'string', 'label' => 'HTTP Method', 'default' => 'POST', 'rules' => [ 'required', 'in:GET,POST,PUT,DELETE,PATCH', ] ], 'body' => [ 'type' => 'json', 'label' => 'Request Body (JSON)', 'rules' => [ 'nullable', 'string', 'json', ] ], ]; } }