PHP code example of digitalrisks / hubspot-notification-channel
1. Go to this page and download the library: Download digitalrisks/hubspot-notification-channel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
digitalrisks / hubspot-notification-channel example snippets
'providers' => [
...
DigitalRisks\Notifications\ServiceProvider::class,
],
...
'hubspot' => [
'app_access_token' => env('HUBSPOT_APP_ACCESS_TOKEN', null),
'template_id' => env('TEMPLATE_NAME_ID', null)
],
...
php
namespace App\Notifications;
use DigitalRisks\Notifications\Messages\HubspotMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class SomethingHappened extends Notification
{
use Queueable;
public function __construct()
{
}
public function via($notifiable)
{
return ['hubspot'];
}
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;
public function routeNotificationForHubspot($notification)
{
return $this->email;
}
}