This package makes it easy to send notifications using Intercom with Laravel 5.6.
You can install the package via composer:
composer require ftw-soft/intercom-notification-channelOnce installed you need to register the service provider with the application. Open up config/app.php and find the providers key.
'providers' => [
\FtwSoft\NotificationChannels\Intercom\IntercomServiceProvider::class,
]Put the followings to your config/services
'intercom' => [
'token' => env('INTERCOM_API_KEY')
]Add your Intercom Token to .env
INTERCOM_API_KEY=xxx
Now you can use the channel in your via() method inside the notification:
use FtwSoft\NotificationChannels\Intercom\Contracts\IntercomNotification;
use FtwSoft\NotificationChannels\Intercom\IntercomChannel;
use FtwSoft\NotificationChannels\Intercom\IntercomMessage;
use Illuminate\Notifications\Notification;
class TestNotification extends Notification implements IntercomNotification
{
public function via($notifiable)
{
return ["intercom"];
}
public function toIntercom($notifiable): IntercomMessage
{
return IntercomMessage::create("Hey User!")
->from(123)
->toUserId(321);
}
}body(''): Accepts a string value for the Intercom message bodyemail(): Accepts a string value for the Intercom message typeemailinapp(): Accepts a string value for the Intercom message typeinapp(default)subject(''): Accepts a string value for the Intercom message body (using withemailtype)plain(): Accepts a string value for the Intercom message plain templatepersonal(): Accepts a string value for the Intercom message personal templatefrom('123'): Accepts a string value of the admin's id (sender)to(['type' => 'user', 'id' => '321']): Accepts an array value for the recipient datatoUserId(''): Accepts a string value for the Intercom message user by id recipienttoUserEmail(''): Accepts a string value for the Intercom message user by email recipienttoContactId(''): Accepts a string value for the Intercom message contact by id recipient
More info about fields read in Intercom API Reference
Please see CHANGELOG for more information what has changed recently.
$ composer testIf you discover any security related issues, please email android991@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.

