zhuk / laravel-intercom
Intercom client and notifications in Laravel
Installs: 215
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/zhuk/laravel-intercom
Requires
- php: ^7.4|^8.0
- illuminate/notifications: ~6.0 || ~7.0 || ~8.0
- illuminate/support: ~6.0 || ~7.0 || ~8.0
- intercom/intercom-php: ^4.4
- php-http/guzzle7-adapter: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- phpro/grumphp: ^1.5
- vimeo/psalm: ^4.10
This package is auto-updated.
Last update: 2025-09-13 17:00:51 UTC
README
Laravel notification driver and bindings of PHP Intercom API
Installation
Via composer:
composer require zhuk/laravel-intercom
API usage
Add service config in config/services.php
and setup envs like
<?php return [ // ... 'intercom' => [ 'token' => \env('INTERCOM_API_KEY'), 'password' => \env('INTERCOM_PASSWORD'), 'admin_user_id' => \env('INTERCOM_ADMIN_USER_ID'), 'headers' => [ 'Intercom-Version' => '2.3', ], ], // ... ];
Than use dependency injection for IntercomClient::class
Refer to Intercom PHP for usage information.
Notification usage
Define class like
final class CommonIntercomNotification extends Notification implements NotificationInterface { use Queueable; /** * @var string */ private string $messageText; /** * @param string $message * * @return void */ public function __construct(string $message) { $this->messageText = $message; } /** * @param mixed $notifiable * * @return array */ public function via($notifiable) { return ['intercom']; } /** * @param mixed $notifiable * * @return IntercomMessage */ public function toIntercom($notifiable): MessageInterface { return new InappMessage($this->messageText); } }
and for example in User
class define method returning ContactInterface
. Don`t forget use Notifiable
final class User { use Notifiable; // ... public function routeNotificationForIntercom($notification): ContactInterface { return new GenericMessageContact($this->intercom_contact_id); } }