I need help with people watching a topic but doesn't receive email notifications

Hello everyone,

I need some guidance in the following matter: once a customer is registering an account on our WordPress website, it gets automatically created on our Discourse instance. We’ve developed a custom feature that allows our customers to ‘watch’ a post; which means that they will press a button on our WordPress post and it automatically subscribes/watch them to the linked Discourse topic.

This feature is working well when the customer has logged in once on the Discourse instance; but when he is ‘watching’ the topic on Discourse, but hasn’t logged in on Discourse, it will not send the user account any emails of the watched topic.

Does someone have an idea how to fix this issue? =)

Thanks in advance.

The quick answer is to make visiting the Discourse once part of your customer onboarding somehow. Perhaps there’s some info for new customers that you can put on your Discourse that they’ll be directed to upon signing up Wordpress side?

Thanks a lot for your comment @Ellibereth.

So if I understood you correctly, it’s mandatory that the registered user is required to visit the forum before he/she is able to receive any email confirmations?

Could you send the code for the feature that makes the customer watch the post?

I am assuming you are using the WP Discourse plugin to authenticate users on your Discourse site. What you are trying to do should work. Since it’s working for users who have logged into Discourse once, the cause of the issue might be that user’s emails are not being marked as “verified” by the WP Discourse plugin when they register on your WordPress site. If that is the case, users will have to respond to an activation email that’s sent to them by Discourse the first time they login to Discourse via your WordPress site. Discourse will not activate the user until they have clicked the link in that activation email.

To confirm that’s the case, have a look at the “DiscourseConnect Single Sign On” section of the Discourse user page for a user who has recently created an account. Click the “Show” button for the Last Payload field and check to see if the require_activation parameter is set to true.

If this is the cause of the issue, there may be a way of working around it.

4 Likes

Thank you for your comprehensive answer @simon – really appreciated.

When I check the require_activation it’s set to ‘false’ → please check the screenshot below.

1 Like

Just in case, one other thing to check would be to make sure that Discourse users are actually being created when they first register on your WordPress site. The most likely way that is being done would be by having the “Create or Sync Discourse Users on Login” WP Discourse option enabled:

Can you check to see if that option is enabled, and that users are successfully being created on Discourse when they register on your WordPress site?

I can look into this some more if that doesn’t solve the issue. Unfortunately, the connection between my local Discourse and WordPress sites is currently not working. Any responses the WordPress site gets from Discourse are returning the error: cURL error 61: Unrecognized content encoding type. libcurl understands deflate, gzip, br content encodings. I’m fairly sure this is just related to my local server’s configuration. I’ve been meaning to sort this out for a while. I’ll look into what’s going on with that later today.

Edit: I found a temporary workaround for getting my local WordPress and Discourse sites to connect. With the “Create or Sync Discourse Users on Login” WP Discourse option enabled, I am now able to register a user on my WP site, have a Discourse account automatically created for them, and set the user to receive email notifications for a topic via the API. I’m not sure what could be causing the issue on your site. For reference, here’s an example API call that I’m making. The Api-Username in the request is set to the Discourse username of the user who wants to receive notifications:

curl -X POST "http://localhost:4200/t/9969/notifications" -H "Api-Key: $api_key" -H "Api-Username: notifyme" -F "notification_level=3"

Thanks everyone for helping us to fix this issue.

We were able to track it down to some issues with the cronjobs and sent emails.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.