diff --git a/app/config/locale/templates/email-webhook.tpl b/app/config/locale/templates/email-webhook.tpl index be877e3577..c4104fb009 100644 --- a/app/config/locale/templates/email-webhook.tpl +++ b/app/config/locale/templates/email-webhook.tpl @@ -175,6 +175,17 @@ + + + + +
+ {{buttonText}} +
+ +

{{optionUrl}}

+ {{redirect}} + {{user}},

Your webhook {{webhook}} on project {{project}} has been stopped after {{attempts}} consecutive failures.

Webhook URL: {{url}}
Error: {{error}}

For more details, view logs of your webhook in Appwrite Console.

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.

If you need any assistance, please reach out to our team on Discord or using email support.", + "emails.webhook.subject": "Your webhook has been paused", + "emails.webhook.body": "Hello {{user}},

Your webhook {{webhook}} on project {{project}} has been paused after {{attempts}} consecutive failures.

Webhook URL: {{url}}
Error: {{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.

If you need any assistance, please reach out to our team on Discord or using email support.", + "emails.webhook.buttonText": "View webhook settings", + "emails.webhook.optionUrl": "If the button above doesn't show, use the following link:", "locale.country.unknown": "Unknown", "countries.af": "Afghanistan", "countries.ao": "Angola", diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 9025025241..6180032266 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -163,17 +163,20 @@ class Webhooks extends Action $subject = $locale->getText("emails.webhook.subject"); - $message = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-webhook.tpl'); - $message - ->setParam('{{subject}}', $subject) - ->setParam('{{message}}', $locale->getText("emails.webhook.body")); - $body = $message->render(); - $protocol = App::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = App::getEnv('_APP_DOMAIN'); $projectId = $project->getId(); $webhookId = $webhook->getId(); + $message = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-webhook.tpl'); + $message + ->setParam('{{subject}}', $subject) + ->setParam('{{message}}', $locale->getText("emails.webhook.body")) + ->setParam('{{redirect}}', $protocol . '://' . $hostname . "/console/project-$projectId/settings/webhooks/$webhookId") + ->setParam('{{buttonText}}', $locale->getText("emails.webhook.buttonText")) + ->setParam('{{optionUrl}}', $locale->getText("emails.webhook.optionUrl")); + $body = $message->render(); + $emailVariables = [ 'subject' => $subject, 'user' => $user->getAttribute('name'),