https://github.com/laravel-notification-channels/intercom
Intercom notifications channel for Laravel
https://github.com/laravel-notification-channels/intercom
Last synced: 4 months ago
JSON representation
Intercom notifications channel for Laravel
- Host: GitHub
- URL: https://github.com/laravel-notification-channels/intercom
- Owner: laravel-notification-channels
- License: mit
- Created: 2019-09-27T07:20:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-27T22:44:15.000Z (almost 3 years ago)
- Last Synced: 2025-07-29T12:37:13.139Z (5 months ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 5
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Intercom notifications channel for Laravel
[](https://packagist.org/packages/laravel-notification-channels/intercom)
[](LICENSE.md)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/intercom/build-status/master)
[](https://styleci.io/repos/211259850)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/intercom)
[](https://scrutinizer-ci.com/g/laravel-notification-channels/intercom/?branch=master)
[](https://packagist.org/packages/laravel-notification-channels/intercom)
This package makes it easy to send notifications using [Intercom](https://app.intercom.com) with Laravel.
## Contents
- [Installation](#installation)
- [Setting up the Intercom service](#setting-up-the-intercom-service)
- [Usage](#usage)
- [Available Message methods](#available-message-methods)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
## Installation
You can install the package via composer:
``` bash
composer require laravel-notification-channels/intercom
```
### Setting up the Intercom service
Add the followings to your `config/services.php`
``` php
'intercom' => [
'token' => env('INTERCOM_API_KEY')
]
```
Add your Intercom Token to `.env`
```
INTERCOM_API_KEY=xxx
```
## Usage
Now you can use the channel in your `via()` method inside the notification:
``` php
use NotificationChannels\Intercom\IntercomChannel;
use NotificationChannels\Intercom\IntercomMessage;
use Illuminate\Notifications\Notification;
class TestNotification extends Notification
{
public function via($notifiable)
{
return ["intercom"];
}
public function toIntercom($notifiable): IntercomMessage
{
return IntercomMessage::create("Hey User!")
->from(123)
->toUserId(321);
}
}
```
### Available methods
- `body('')`: Accepts a string value for the Intercom message body
- `email()`: Accepts a string value for the Intercom message type `email`
- `inapp()`: Accepts a string value for the Intercom message type `inapp` (default)
- `subject('')`: Accepts a string value for the Intercom message body (using with `email` type)
- `plain()`: Accepts a string value for the Intercom message plain template
- `personal()`: Accepts a string value for the Intercom message personal template
- `from('123')`: Accepts a string value of the admin's id (sender)
- `to(['type' => 'user', 'id' => '321'])`: Accepts an array value for the recipient data
- `toUserId('')`: Accepts a string value for the Intercom message user by id recipient
- `toUserEmail('')`: Accepts a string value for the Intercom message user by email recipient
- `toContactId('')`: Accepts a string value for the Intercom message contact by id recipient
More info about fields read in [Intercom API Reference](https://developers.intercom.com/intercom-api-reference/reference#admin-initiated-conversation)
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Security
If you discover any security related issues, please email android991@gmail.com instead of using the issue tracker.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Andrey Telesh](https://github.com/ftw-soft)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.