Hubspot Notification Channel for laravel.
digitalrisks/hubspot-notification-channel is a Laravel package for hubspot notification channel for laravel..
It currently has 1 GitHub stars and 9.028 downloads on Packagist (latest version v2.0).
Install it with composer require digitalrisks/hubspot-notification-channel.
Discover more Laravel packages by digitalrisks
or browse all Laravel packages to compare alternatives.
Last updated
This package makes it easy to send Hubspot (Single Send Email) notifications with Laravel.
You can install the package via composer:
composer require digitalrisks/hubspot-notification-channel
Add the service provider (only required on Laravel 5.4 or lower):
// config/app.php
'providers' => [
...
DigitalRisks\Notifications\ServiceProvider::class,
],
Add your Hubspot key to your config/services.php:
// config/services.php
...
'hubspot' => [
'app_access_token' => env('HUBSPOT_APP_ACCESS_TOKEN', null),
'template_id' => env('TEMPLATE_NAME_ID', null)
],
...
Now you can use the channel in your via() method inside the notification:
<?php
namespace App\Notifications;
use DigitalRisks\Notifications\Messages\HubspotMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class SomethingHappened extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['hubspot'];
}
/**
* Get the hubspot representation of the notification.
*
* @param mixed $notifiable
* @return \DigitalRisks\Notifications\Messages\HubspotMessage
*/
public function toMail($notifiable)
{
return (new HubspotMessage)
->templateId(config('services.hubspot.template_id'))
->contactProperties([])
->customProperties([]);
}
}
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Route notifications for the Hubspot channel.
*
* @param \Illuminate\Notifications\Notification $notification
* @return string
*/
public function routeNotificationForHubspot($notification)
{
return $this->email;
}
}
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.