Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: webhooks_listeners app: send direct requests to ExApps using AppAPI #46477

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

bigcat88
Copy link
Member

@bigcat88 bigcat88 commented Jul 12, 2024

Summary

Discussed at the last brainstorm on the WorkflowEngine project:

To improve performance, WebhookApp should directly call ExApp through the AppAPI function.

I made it happen if the webhook URL starts with "/" and the appId field is filled(this field is only filled if webhook is registered by the ExApp).

Checklist

@bigcat88 bigcat88 added the 3. to review Waiting for reviews label Jul 12, 2024
$statusCode = $response->getStatusCode();
if ($statusCode >= 200 && $statusCode < 300) {
$this->logger->debug('Webhook returned status code '.$statusCode, ['body' => $response->getBody()]);
} else {
$this->logger->warning('Webhook returned unexpected status code '.$statusCode, ['body' => $response->getBody()]);
$this->logger->warning('Webhook(' . $webhookId . ') returned unexpected status code '.$statusCode, ['body' => $response->getBody()]);

Check notice

Code scanning / Psalm

PossiblyInvalidMethodCall Note

Cannot call method on possible array<array-key, mixed> variable $response
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean and simple 👍

apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php Outdated Show resolved Hide resolved
…xApps using AppAPI.

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
@bigcat88 bigcat88 force-pushed the support-direct-appapi-requests branch from 460723d to 696ece2 Compare July 16, 2024 16:37
@bigcat88 bigcat88 marked this pull request as ready for review July 16, 2024 16:50
@bigcat88 bigcat88 added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 16, 2024
@bigcat88 bigcat88 enabled auto-merge July 16, 2024 18:04
@bigcat88 bigcat88 merged commit 1f8999e into master Jul 16, 2024
166 checks passed
@bigcat88 bigcat88 deleted the support-direct-appapi-requests branch July 16, 2024 18:15
bigcat88 added a commit to cloud-py-api/nc_py_api that referenced this pull request Jul 19, 2024
Not finished yet, because... I'm waiting for this to be finalized on the
server.

The technology is very powerful, probably better than what happened with
ExApp.

It can also be used as a Nextcloud client, but the client must have
administrator access.

Some docs(and maybe article?) will come before NC30 release.

Reference: nextcloud/server#46477

---------

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
@blizzz blizzz mentioned this pull request Jul 24, 2024
Comment on lines +143 to +146

public function getAppId(): ?string {
return $this->appId;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need to add the method, it’s a DB entity there is a magic method for this already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants