diff --git a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php index 997e8931703ed..962c1a3833788 100644 --- a/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php +++ b/apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php @@ -74,7 +74,8 @@ protected function run($argument): void { } elseif (!$exApp['enabled']) { throw new RuntimeException('ExApp ' . $exAppId . ' is disabled.'); } - $response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $webhookListener->getUserId(), $webhookListener->getHttpMethod(), [], $options); + $userId = ($data['user'] ?? [])['uid'] ?? null; + $response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $userId, $webhookListener->getHttpMethod(), [], $options); if (is_array($response) && isset($response['error'])) { throw new RuntimeException(sprintf('Error during request to ExApp(%s): %s', $exAppId, $response['error'])); } diff --git a/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php b/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php index 6b40af1463ec5..6cd3af983687c 100644 --- a/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php +++ b/apps/webhook_listeners/lib/Listener/WebhooksEventListener.php @@ -41,6 +41,7 @@ public function handle(Event $event): void { // TODO add group membership to be able to filter on it $data = [ 'event' => $this->serializeEvent($event), + /* Do not remove 'user' from here, see BackgroundJobs/WebhookCall.php */ 'user' => (is_null($user) ? null : JsonSerializer::serializeUser($user)), 'time' => time(), ];