File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,37 @@ curl -X POST "https://example.com/webhooks/signal/order-workflow/1/mark-as-shipp
8181 -H " Content-Type: application/json"
8282```
8383
84+ ## Webhook URL Helper
85+ The ` $this->webhookUrl() ` helper generates webhook URLs for starting workflows or sending signals.
86+
87+ ```
88+ $activity->webhookUrl();
89+ $activity->webhookUrl('signalMethod');
90+ ```
91+
92+ Parameters
93+ - string $signalMethod = '' (optional)
94+
95+ If empty, returns the URL for starting the workflow.
96+
97+ If provided, returns the URL for sending a signal to an active workflow instance.
98+
99+ ```
100+ use Workflow\Activity;
101+
102+ class ShipOrderActivity extends Activity
103+ {
104+ public function execute(string $email, StoredWorkflow $storedWorkflow): void
105+ {
106+ $startUrl = $this->webhookUrl();
107+ // $startUrl = '/webhooks/start/order-workflow';
108+
109+ $signalUrl = $this->webhookUrl('markAsShipped');
110+ // $signalUrl = '/webhooks/signal/order-workflow/{workflowId}/mark-as-shipped';
111+ }
112+ }
113+ ```
114+
84115## Webhook Authentication
85116By default, webhooks don't require authentication but this can be configured in ` config/workflows.php ` .
86117
You can’t perform that action at this time.
0 commit comments