PHP code example of evanskim / naverworks-api

1. Go to this page and download the library: Download evanskim/naverworks-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

evanskim / naverworks-api example snippets


    // 인증을 받아 엑세스토큰을 받아온 클라이언트를 생성합니다.
    $auth = new NaverWorksAuthorization(
        $_ENV['NAVERWORKS_CLIENT_ID'],
        $_ENV['NAVERWORKS_CLIENT_SECRET'],
        $_ENV['NAVERWORKS_SERVICE_ACCOUNT'],
        $path.$_ENV['NAVERWORKS_PRIVATE_KEY_PATH']
    );
    
    $bot = new ChatBot($_ENV['NAVERWORKS_BOT_ID'], $auth->createApiClient());
    $bot->to($_ENV['NAVERWORKS_TEST_USER_ID']);
    $bot->sendMessageToUser('test message');