Package Data | |
---|---|
Maintainer Username: | e2kaneko |
Maintainer Contact: | kaneko@e2info.com (Tomohiro Kaneko) |
Package Create Date: | 2017-01-04 |
Package Last Update: | 2019-03-21 |
Home Page: | https://github.com/e2kaneko/laravel-chatwork-notification/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-06-17 03:15:06 |
Package Statistics | |
---|---|
Total Downloads: | 2,949 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 1 |
Total Forks: | 6 |
Total Open Issues: | 1 |
This package makes it easy to send Chatwork messages using Chatwork API with Laravel 5.3.
You can install the package via composer:
composer require e2kaneko/laravel-chatwork-notifications
You must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\Chatwork\ChatworkServiceProvider::class,
],
Configure your credentials:
// config/services.php
...
'chatwork' => [
'api_token' => env('CHATWORK_API_TOKEN'),
],
...
You can now use the channel in your via()
method inside the Notification class.
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use NotificationChannels\Chatwork\ChatworkMessage;
use NotificationChannels\Chatwork\ChatworkChannel;
class ChatworkPosted extends Notification
{
use Queueable;
public function __construct()
{
}
public function via($notifiable)
{
return [ChatworkChannel::class];
}
public function toChatwork($notifiable)
{
return (new ChatworkMessage())
->message('message');
}
}
or
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use NotificationChannels\Chatwork\ChatworkInformation;
use NotificationChannels\Chatwork\ChatworkChannel;
class ChatworkPosted extends Notification
{
use Queueable;
public function __construct()
{
}
public function via($notifiable)
{
return [ChatworkChannel::class];
}
public function toChatwork($notifiable)
{
return (new ChatworkInformation())
->informationTitle('InformationTitle')
->informationMessage('InformationMessage');
}
}
You can either send the notification by providing with the room_id of the recipient to the roomId($roomId) method like shown in the above example or add a routeNotificationForChatwork() method in your notifiable model:
...
/**
* Route notifications for the Chatwork channel.
*
* @return int
*/
public function routeNotificationForChatwork()
{
return '99999999'; // Chatwork Room ID
}
...
roomId('roomId')
: (integer|string) Chatwork Room ID.to('accountId')
: (integer|string) .message('message')
: (string) Chat message.roomId('roomId')
: (integer|string) Chatwork Room ID.informationTitle('title')
: (string) Information Box Title.informationMessage('message')
: (string) Information Box Message.Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email kaneko@e2info.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.