a-yasui / laravel-chatwork
Laravel notification driver for Chatwork.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
Open Issues: 0
pkg:composer/a-yasui/laravel-chatwork
Requires
- php: ^8.0
- ext-curl: *
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-mbstring: *
- ext-zip: *
- guzzlehttp/guzzle: ^6.0|^7.0
- illuminate/notifications: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^3.8|^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2025-11-12 09:14:20 UTC
README
Laravel Notification driver for Chatwork.
Installation
With Composer:
composer require a-yasui/laravel-chatwork
After installing the package, please publish the configuration file.
php artisan vendor:publish --provider="ATYasu\Chatwork\ServiceProvider"
Usage
1. Set the Chatwork API Token
Open .env and set your Chatwork API Token like as below.
CHATWORK_API_TOKEN=XXXXXXXXXXXXXXXXXX
2. Create an notification class
Create a notification class like as below.
class SampleNotification extends ChatworkNotification
{
function toChatwork($notifiable): ChatworkMessage
{
return (new ChatworkMessage())
->text('This is sample notification');
}
}
3. Sending notification
Here are some examples of notification methods.
Please refer to the following page if you want to know more about Laravel Notification.
https://laravel.com/docs/notifications
Example of On-Demand Notifications
Notification::route('chatwork', '{ROOM_ID}')
->notify(new SampleNotification());
Example of using Notifiable trait
Add the method routeNotificationForChatwork to your model using Notifiable.
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForChatwork()
{
return '{ROOM_ID}';
}
}
Next, just notify when you want.
$user->notify(new SampleNotification());
Building message
You can create a chat message as below.
$message = new SampleNotification();
$message->to('999999')
->info("Please confirm this.\nhttp://example.com/", 'New Order #7489393')
->toAll()
->text('FYI');
Mention specific user
$message->to('999999');
Mention all users in the room
$message->toAll();
Simple text
$message->text('This is simple text message.');
Information
$message->info('This is information.');
With title
$message->info('This is information.', 'Information title');
License
MIT





