diff --git a/composer.json b/composer.json index 61760fb1..11482eb8 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "spatie/laravel-query-builder": "^5.5", "spatie/laravel-settings": "^3.2", "spatie/laravel-webhook-server": "^3.8", - "timacdonald/json-api": "^v1.0.0-beta.4", + "timacdonald/json-api": "^1.0.0-beta.4", "twig/twig": "^3.0" }, "require-dev": { diff --git a/src/Cachet.php b/src/Cachet.php index 115ea839..324a2018 100644 --- a/src/Cachet.php +++ b/src/Cachet.php @@ -15,6 +15,11 @@ class Cachet */ public const USER_AGENT = 'Cachet/3.0 (+https://docs.cachethq.io)'; + /** + * The user agent used by Cachet's webhooks. + */ + public const WEBHOOK_USER_AGENT = 'Cachet/3.0 Webhook (+https://docs.cachethq.io)'; + /** * Get the current user using `cachet.guard`. */ diff --git a/src/Models/WebhookSubscription.php b/src/Models/WebhookSubscription.php index 0002f44a..0151780c 100644 --- a/src/Models/WebhookSubscription.php +++ b/src/Models/WebhookSubscription.php @@ -2,6 +2,7 @@ namespace Cachet\Models; +use Cachet\Cachet; use Cachet\Database\Factories\WebhookSubscriptionFactory; use Cachet\Enums\WebhookEventEnum; use Illuminate\Database\Eloquent\Builder; @@ -62,6 +63,9 @@ public function makeCall(WebhookEventEnum $event, array $payload): WebhookCall { return WebhookCall::create() ->url($this->url) + ->withHeaders([ + 'User-Agent' => Cachet::WEBHOOK_USER_AGENT, + ]) ->payload([ 'event' => $event->value, 'body' => $payload,