diff --git a/CHANGELOG.md b/CHANGELOG.md index f26633b5..88205bb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Release Notes for Campaign -## 2.7.1 - Unreleased +## 2.7.1 - 2023-05-24 ### Changed - Sendout previews now include template variables for the current sendout as well as a dummy contact ([#386](https://github.com/putyourlightson/craft-campaign/issues/386)). +- Webhooks now return a successful response when receiving the email address of a contact that does not exist ([#388](https://github.com/putyourlightson/craft-campaign/issues/388)). ## 2.7.0 - 2023-05-13 ### Added diff --git a/src/controllers/WebhookController.php b/src/controllers/WebhookController.php index ce30fea1..e4d78a20 100755 --- a/src/controllers/WebhookController.php +++ b/src/controllers/WebhookController.php @@ -298,7 +298,7 @@ private function _callWebhook(string $event, string $email = null): Response $contact = Campaign::$plugin->contacts->getContactByEmail($email); if ($contact === null) { - return $this->_asRawFailure('Contact not found.'); + return $this->_asRawSuccess(); } if ($event == 'complained') { @@ -325,6 +325,8 @@ private function _asRawSuccess(string $message = ''): Response */ private function _asRawFailure(string $message = ''): Response { + Campaign::$plugin->log($message, [], Logger::LEVEL_WARNING); + return $this->asRaw(Craft::t('campaign', $message)) ->setStatusCode(400); } diff --git a/src/models/SettingsModel.php b/src/models/SettingsModel.php index 36a2d51d..0cf12610 100644 --- a/src/models/SettingsModel.php +++ b/src/models/SettingsModel.php @@ -49,6 +49,7 @@ class SettingsModel extends Model /** * @var array|null The allowed IP addresses for incoming webhook requests from Postmark + * @link https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks * @since 1.19.0 */ public ?array $postmarkAllowedIpAddresses = [