Skip to main content

Webhooks

There are webhooks that are fired at key customer life-cycle events so that TrustedLogin can integrate with Mailchimp and other sorts of marketing automation or reporting tools without modifying the codebase.

Editing Webhook Settings

There is a nova page called "Settings". It has settings pages

Getting Webhook Settings

The class App\Contracts\GetSettingsContract is a wrapper for the settings these webhooks use.

use App\Contracts\GetSettingsContract;
use App\Interactions\GetSettings;
$settings = app()->get(GetSettingsContract::class);
$webhookUrl = $settings->getWebhook( 'webhook_site_created' );

Technical Details

The webhook server is built with spatie/laravel-webhook-server

The site events are triggered inside the SiteObserver.

The account webhooks are triggered using listeners attached to Spark events.

The payload for these webhooks looks like this:

{
"id" : "7",
"account" : "901",
"url": "https://industry.io"
}

Site Created

This event fires after a new site is created.

Site Deleted

This event fires after a site is deleted.

Account Created

This event fires after an account is created.

The payload for these webhooks looks like this:

{
"id" : 7,
"name" : "Thunder Bubble",
"publicKey" : "1234-7890-12345",
"namespace" : "thunder-bubble",
"ownerName" : "Trover DuChamps",
"ownerEmail" : "trover@industry.io",
"trial" : false,
"hasCard" : true,
"isSubscribed" : true
}

Account Cancelled

This event fires after an account is updated.

Account Renewed

This event fires after an account subscription is renewed.

User-Realted Webhook

The payload for these webhooks looks like this:

User Created

{
"id" : 7,
"name" : "Duke Corknelius Von Canadia",
"email" : "hiroy@electronic-email-service.com"
}

User Deleted

{
"id" : 7,
"name" : "Duke Corknelius Von Canadia",
"email" : "hiroy@electronic-email-service.com"
}