PHPackages                             ankurk91/laravel-ses-webhooks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ankurk91/laravel-ses-webhooks

ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

ankurk91/laravel-ses-webhooks
=============================

Handle AWS SES webhooks in Laravel php framework

4.5.0(2mo ago)2534.2k—4.7%1MITPHPPHP ^8.3CI passing

Since Mar 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/ankurk91/laravel-ses-webhooks)[ Packagist](https://packagist.org/packages/ankurk91/laravel-ses-webhooks)[ Docs](https://github.com/ankurk91/laravel-ses-webhooks)[ RSS](/packages/ankurk91-laravel-ses-webhooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (17)Used By (0)

AWS SES Webhooks Client for Laravel
===================================

[](#aws-ses-webhooks-client-for-laravel)

[![Packagist](https://camo.githubusercontent.com/0863f59564e4efadc9cfaecdcf631b160b1b42c92a595c7d90bc126f01cffc72/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f616e6b75726b39312f6c61726176656c2d7365732d776562686f6f6b73)](https://packagist.org/packages/ankurk91/laravel-ses-webhooks)[![GitHub-tag](https://camo.githubusercontent.com/b9cd4430503830044bf8717cd96dc0cdb1e59acceb04d29995bfa21dd33c6397/68747470733a2f2f62616467656e2e6e65742f6769746875622f7461672f616e6b75726b39312f6c61726176656c2d7365732d776562686f6f6b73)](https://github.com/ankurk91/laravel-ses-webhooks/tags)[![License](https://camo.githubusercontent.com/83827950f128d06bafebb55c738f427b4eacb8eaf914d5397e7cd96c8f60cb12/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f6c6963656e73652f616e6b75726b39312f6c61726176656c2d7365732d776562686f6f6b73)](LICENSE.txt)[![Downloads](https://camo.githubusercontent.com/94234484ad1480011c961a6471e6f961af8ca728c503d2f5c0c6f5608b51d1f5/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f616e6b75726b39312f6c61726176656c2d7365732d776562686f6f6b73)](https://packagist.org/packages/ankurk91/laravel-ses-webhooks/stats)[![GH-Actions](https://github.com/ankurk91/laravel-ses-webhooks/workflows/tests/badge.svg)](https://github.com/ankurk91/laravel-ses-webhooks/actions)[![codecov](https://camo.githubusercontent.com/19443a5ea943c06e476f4179357a0669e3141714f592d2cf1c210b3a8a6e9d63/68747470733a2f2f636f6465636f762e696f2f67682f616e6b75726b39312f6c61726176656c2d7365732d776562686f6f6b732f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/ankurk91/laravel-ses-webhooks)

Handle AWS [SES](https://aws.amazon.com/ses/) webhooks in Laravel php framework.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require "ankurk91/laravel-ses-webhooks"
```

The service provider will automatically register itself.

You must publish the config file with:

```
php artisan vendor:publish --provider="Ankurk91\SesWebhooks\SesWebhooksServiceProvider"
```

Next, you must publish the migration with:

```
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations"
```

After the migration has been published you can create the `webhook_calls` table by running the migrations:

```
php artisan migrate
```

Next, for routing, add this route (guest) to your `routes/web.php`

```
Route::sesWebhooks('/webhooks/ses');
```

Behind the scenes this will register a `POST` route to a controller provided by this package. Next, you must add that route to the `except` array of your `VerifyCsrfToken` middleware:

```
protected $except = [
    '/webhooks/*',
];
```

It is recommended to set up a queue worker to precess the incoming webhooks.

### Prepare your AWS console for SES webhooks

[](#prepare-your-aws-console-for-ses-webhooks)

- Assuming that you have SES service up and running in your app already
- Create a [configuration set](https://docs.aws.amazon.com/ses/latest/dg/using-configuration-sets.html)
- Choose [SNS](https://docs.aws.amazon.com/ses/latest/dg/configure-sns-notifications.html) as event destination
- Choose `HTTP` as delivery method for that newly created SNS topic
- Specify the webhook URL as `${APP_URL}/webhooks/ses`
- This package should auto confirm the subscription
- You need to specify the configuration set name in your `config/services.php`

```
 'ses' => [
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
        'options' => [
            'ConfigurationSetName' => env('AWS_SES_CONFIGURATION_SET'),
        ],
    ],
```

Usage
-----

[](#usage)

There are 2 ways to handle incoming webhooks via this package.

### 1 - Handling webhook requests using jobs

[](#1---handling-webhook-requests-using-jobs)

If you want to do something when a specific event type comes in; you can define a job for that event. Here's an example of such job:

```
