arimolzer/ifttt-webhook

dev-master 2019-08-16 01:18 UTC

This package is auto-updated.

Last update: 2024-04-10 11:49:25 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

This package is designed to provide a custom Laravel notification channel and facade for webhooks to IFTTT.

Installation

You can install the package via composer:

composer require arimolzer/ifttt-webhook

Usage

A complete example of how to add the IFTTT webhook channel to a notification is below:

use Arimolzer\IftttWebhook\Channels\IftttWebhookChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class ContactRequestSubmitted extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return [IftttWebhookChannel::class];
    }
    
    public function toIftttWebhookChannel($notifiable) : IftttWebhookChannel
    {
        return (new IftttWebhookChannel)
            ->setKey(env('IFTTT_VOIP_WEBHOOK_KEY'))
            ->setEvent(env('IFTTT_VOIP_WEBHOOK_EVENT'))
            ->setParams(
                $notifiable->param1,
                $notifiable->param2
                $notifiable->param3
            );
    }
}

You can also make an asynchronous webhook call via the IftttWebhook::get() facade. eg.

IftttWebhook::get($message->param1, $message->param2, $message->param3, $message->event, $message->key);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ari.molzer@molzertech.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.