diff --git a/app/config/locale/templates/email-webhook.phtml b/app/config/locale/templates/email-webhook.phtml index fa58339ab8..14d879fef0 100644 --- a/app/config/locale/templates/email-webhook.phtml +++ b/app/config/locale/templates/email-webhook.phtml @@ -1,21 +1,38 @@ -Hi getParam('user') ?>, -

-Your webhook getParam('webhook') ?> on project getParam('project') ?> has been paused after getParam('attempts') ?> consecutive failures.

-

Webhook URL: getParam('url') ?>

-

Error: getParam('error') ?>


To restore the functionality of your webhook, please take the following steps:

-1. Debug the webhook to identify and resolve the issue: - -2. Re-enable the webhook from the project settings page + - - - - -
- View webhook settings -
\ No newline at end of file + + + + + + Hi getParam('user') ?>, +

+ Your webhook getParam('webhook') ?> on project getParam('project') ?> has been paused after getParam('attempts') ?> consecutive failures.
+

Webhook Endpoint: getParam('url') ?>

+

Error: getParam('error') ?>


To restore your webhook's functionality and reset attempts, we suggest to follow the below steps:
+
    +
  1. Examine the logs of both Appwrite Console and your webhook server to identify the issue.
  2. +
  3. Investigate potential network issues and use webhook testing tools to verify expected behaviour.
  4. +
  5. Ensure the webhook endpoint is reachable and configured to accept incoming POST requests.
  6. +
  7. Confirm that the webhook doesn't return error status codes such as 400 or 500.
  8. +

+ + After the issue is resolved, please make sure to re-enable the webhook directly through the webhook settings. + + + + + +
+ Webhook settings +
+ + + + \ No newline at end of file diff --git a/composer.lock b/composer.lock index 5f8b2360b2..6ebd5c574e 100644 --- a/composer.lock +++ b/composer.lock @@ -5380,16 +5380,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -5399,11 +5399,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -5456,7 +5456,7 @@ "type": "open_collective" } ], - "time": "2023-12-08T12:32:31+00:00" + "time": "2024-01-11T20:47:48+00:00" }, { "name": "swoole/ide-helper", diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 0acdfbdd5c..12cc4519f5 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -158,6 +158,8 @@ class Webhooks extends Action $webhook->setAttribute('logs', $logs); if ($attempts >= self::MAX_FAILED_ATTEMPTS) { + $webhook->setAttribute('enabled', false); + $protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = App::getEnv('_APP_DOMAIN'); $projectId = $project->getId(); @@ -174,12 +176,13 @@ class Webhooks extends Action $template->setParam('redirect', $protocol . '://' . $hostname . "/console/project-$projectId/settings/webhooks/$webhookId"); $template->setParam('attempts', $attempts); - $subject = 'Your webhook has been paused'; - $body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base.tpl'); + $subject = 'Webhook deliveries have been paused'; + $body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base-cloud.tpl'); $body ->setParam('{{subject}}', $subject) - ->setParam('{{body}}', $template->render()); + ->setParam('{{message}}', $template->render()) + ->setParam('{{year}}', date("Y")); $queueForMails ->setSubject($subject)