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

Postmark webhook error: Setting unknown property ContactElement::unsubscribed #339

Closed
joepagan opened this issue Oct 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@joepagan
Copy link

joepagan commented Oct 28, 2022

Hey, I'm working on an app which has an issue where a postmark user unsubscribes (via the email link postmark append to their emails) but the campaign webhook action will throw a 500 error when this is reported.

I believe as a consequence to this, this is causing sendouts to end prematurely because users who click postmark's "unsubscribe" go onto a postmark "suppressions" list meaning that a sendout will fail because it's attempting to send an email to a suppressed user, it fails & hits the maxSendFailuresAllowed limit which kills the sendout.

It looks like this is because unsubscribed is not a property of ContactElement.

It looks like you've discussed this event on other closed issues and it appears you intended to support this event at one point, so I hope that this is a bug you could look at fixing? (and I'm not just doing something wrong somehow).

using:

"craftcms/cms": "4.2.2",
"putyourlightson/craft-campaign": "2.1.4",

Thanks as always!

Logs:

2022-10-28 06:27:42 [web.WARNING] [campaign] Webhook request: {"RecordType":"SubscriptionChange","MessageID":"f5eb49a1-ea0f-46ff-8e10-748ae0fa979f","ServerID":9151209,"MessageStream":"broadcast","ChangedAt":"2022-10-28T06:26:37.2025801Z","Recipient":"user@domain.com","Origin":"Recipient","SuppressSending":true,"SuppressionReason":"ManualSuppression","Tag":null,"Metadata":{}} {"memory":2445416}
2022-10-28 06:27:42 [web.ERROR] [yii\base\UnknownPropertyException] Setting unknown property: putyourlightson\campaign\elements\ContactElement::unsubscribed {"trace":["#0 /var/www/html/craft/vendor/craftcms/cms/src/base/Element.php(2006): yii\\base\\Component->__set()","#1 /var/www/html/craft/vendor/putyourlightson/craft-campaign/src/services/WebhookService.php(77): craft\\base\\Element->__set()","#2 /var/www/html/craft/vendor/putyourlightson/craft-campaign/src/services/WebhookService.php(45): putyourlightson\\campaign\\services\\WebhookService->_addInteraction()","#3 /var/www/html/craft/vendor/putyourlightson/craft-campaign/src/controllers/WebhookController.php(303): putyourlightson\\campaign\\services\\WebhookService->unsubscribe()","#4 /var/www/html/craft/vendor/putyourlightson/craft-campaign/src/controllers/WebhookController.php(240): putyourlightson\\campaign\\controllers\\WebhookController->_callWebhook()","#5 [internal function]: putyourlightson\\campaign\\controllers\\WebhookController->actionPostmark()","#6 /var/www/html/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#7 /var/www/html/craft/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","#8 /var/www/html/craft/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()","#9 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(301): yii\\base\\Module->runAction()","#10 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(625): craft\\web\\Application->runAction()","#11 /var/www/html/craft/vendor/craftcms/cms/src/web/Application.php(280): craft\\web\\Application->_processActionRequest()","#12 /var/www/html/craft/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()","#13 /var/www/html/dist/index.php(23): yii\\base\\Application->run()","#14 {main}"],"memory":4454808,"exception":"[object] (yii\\base\\UnknownPropertyException(code: 0): Setting unknown property: putyourlightson\\campaign\\elements\\ContactElement::unsubscribed at /var/www/html/craft/vendor/yiisoft/yii2/base/Component.php:209)"} 
@joepagan joepagan added the bug Something isn't working label Oct 28, 2022
@bencroker
Copy link
Collaborator

Thanks for reporting this! I've fixed the exception in dbd2f78 and released in version 2.1.17, which should hopefully resolve this for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants