restApiKey = env('KAKAO_REST_API_KEY'); } public function sendMessage($channelId, $args) { Log::debug('channelId: ' . $channelId); // Log::debug('args: ' . json_decode($args)); $client = new Client([ 'base_uri' => $this->apiUrl, 'headers' => [ 'Authorization' => 'KakaoAK ' . $this->restApiKey, 'Content-Type' => 'application/json', ], ]); // Log::debug('결과: ' . $response); // $response = $client->post('/v1/api/talk/channel/' . $channelId . '/message', [ $response = $client->post('/v1/api/talk/channels/' . $channelId . '/message', [ 'json' => [ 'template_object' => [ 'object_type' => 'text', 'message' => $args['message'], 'link' => [ 'web_url' => $args['link_url'], ], ], ], ]); dd($response); return $response->getBody()->getContents(); } }