PHP code example of sun-asterisk / chatwork-php

1. Go to this page and download the library: Download sun-asterisk/chatwork-php 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/ */

    

sun-asterisk / chatwork-php example snippets



use SunAsterisk\Chatwork\Chatwork;

$chatwork = Chatwork::withAPIToken('your-api-token');

// $chatwork = Chatwork::withAccessToken('your-access-token');


// Get your personal information.
$me = $chatwork->me();

// Get your personal tasks.
$tasks = $chatwork->my()->tasks();

// Get members in a room.
$members = $chatwork->room($roomId)->members();

use SunAsterisk\Chatwork\Helpers\Message;

$message = new Message('Hi there')
    ->info('Cloudy', 'Weather today');

$chatwork->room($roomId)->messages()->create((string) $message);

$message = Chatwork::message('Hi there');

use SunAsterisk\Chatwork\Helpers\Webhook;

$isValid = Webhook::verifySignature($yourWebhookToken, $requestBody, $signature);