diff --git a/src/Activity.php b/src/Activity.php index 7c966b0b..c1cb017c 100644 --- a/src/Activity.php +++ b/src/Activity.php @@ -77,12 +77,14 @@ public function workflowId() public function webhookUrl(string $signalMethod = ''): string { $basePath = config('workflows.webhooks_route', '/webhooks'); + $workflow = Str::kebab(class_basename($this->storedWorkflow->class)); + if ($signalMethod === '') { - $workflow = Str::kebab(class_basename($this->storedWorkflow->class)); return url("{$basePath}/{$workflow}"); } + $signal = Str::kebab($signalMethod); - return url("{$basePath}/signal/{$this->storedWorkflow->id}/{$signal}"); + return url("{$basePath}/signal/{$workflow}/{$this->storedWorkflow->id}/{$signal}"); } public function handle() diff --git a/tests/Unit/ActivityTest.php b/tests/Unit/ActivityTest.php index 7e1b8ff8..42609927 100644 --- a/tests/Unit/ActivityTest.php +++ b/tests/Unit/ActivityTest.php @@ -131,6 +131,6 @@ public function testWebhookUrl(): void ]); $this->assertSame('http://localhost/webhooks/test-workflow', $activity->webhookUrl()); - $this->assertSame('http://localhost/webhooks/signal/1/other', $activity->webhookUrl('other')); + $this->assertSame('http://localhost/webhooks/signal/test-workflow/1/other', $activity->webhookUrl('other')); } }