PHPackages                             trucky/webhook - 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. trucky/webhook

ActiveLibrary

trucky/webhook
==============

Trucky Webhook for Custom Drivers' Hub

111PHP

Since Jul 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Trucky/trucky-webhook)[ Packagist](https://packagist.org/packages/trucky/webhook)[ RSS](/packages/trucky-webhook/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Trucky Webhook for Laravel &gt;8.x
==================================

[](#trucky-webhook-for-laravel-8x)

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

[](#installation)

`composer require trucky/webhook`

Configuration
-------------

[](#configuration)

If you want to configure the Webhook listen URL, eject the config file with

`php artisan vendor:publish --provider=Trucky\Webhook\TruckyWebhookServiceProvider --tag=config`

HTTP
----

[](#http)

The Webhook listens by default on `/trucky/webhook` for POST requests

Webhook format
--------------

[](#webhook-format)

Every Webhook request has a `type` property denoting what is you receveiving in the `data` property

```
{
    "type": "job_created"
    "data": {
        ....
    }
}
```

### Raw Event Types

[](#raw-event-types)

- application\_accepted
- application\_created
- application\_rejected
- application\_retired
- garage\_created
- garage\_deleted
- garage\_updgraded
- job\_created
- job\_cancelled
- job\_completed
- job\_deleted
- job\_event\_created
- member\_kicked
- member\_left
- user\_joined\_company
- member\_role\_assigned
- role\_created
- role\_updated
- role\_deleted
- vehicle\_created
- vehicle\_updated
- vehicle\_deleted
- vehicle\_need\_maintenance
- vehicle\_maintenance\_complete

Events
------

[](#events)

When a Webhook call is received, the Controller relaunch two Events: a `Trucky\Webhook\TruckyGenericEvent` and a specific event typized for each `event` type

You can choose if listen to the Generic Event or listen to each specific event you want to handle

Under the namespace `Trucky\Webhook\Events` you will find the specific events relaunched from the Webhook call.

Each Event class contains a `data` property containing the Event Body.

### Available Events under \\Trucky\\Webhooks namespace

[](#available-events-under-truckywebhooks-namespace)

- TruckyGenericEvent
- ApplicationAccepted
- ApplicationCreated
- ApplicationRejected
- ApplicationRetired
- GarageCreated
- GarageDeleted
- GarageUpgraded
- JobCreated
- JobCancelled
- JobCompleted
- JobDeleted
- JobEventCreated
- MemberKicked
- MemberLeft
- UserJoinedCompany
- MemberRoleAssigned
- RoleCreated
- RoleUpdated
- RoleDeleted
- VehicleCreated
- VehicleUpdated
- VehicleDeleted
- VehicleAssigned
- VehicleNeedMaintenance
- VehicleMaintenanceComplete

Create your Event Listeners and register them
---------------------------------------------

[](#create-your-event-listeners-and-register-them)

Listener:

```
