Webhook doesnt send anything when email/username updated

As far as I understand, when we create a webhook for user events, it should send a webhook when user updated their email or username. I checked and I got nothing in payload when I changed a username. however if I change avatar, I get the webhook.
Am I doing somthing wrong? or its working as intended?

1 Like

Pretty sure no events are planned for name change or email change.

The feature to send webhook when username or email updates would be really helpful. I maintain an external mailing list and whenever a user signs up he/she is automatically added to that mailing list. Also, when the user account is deleted, the email is unsubscribed.

The problem arises when the user updates his/her email address because this doesn’t trigger the webhook. The workaround I have done is check for the username and email every time the user logs in and logs out and if there is any change the email will be updated. Obviously this is a huge wastage of resources and webhook in case of Name and Email update would be great.

1 Like

I dunno, what do you think @sam?

Sure I support adding a webhook for this, @vinothkannans maybe add to your list, low priority.

3 Likes

We have to sync discourse users with Stripe so having a webhook that notifies about email change will be really useful, so we can update the Stripe customer as well.

Hope this gets implemented soon.

2 Likes

Now username changes will trigger the user webhook. Soon I will include the email as well.

https://github.com/discourse/discourse/commit/9426d12c1d968fa1d7b72f9267fbd2701ab652bf

4 Likes

What about the different emails primary/secondary? Hope you include also extra info which one exactly changed.

Also I presume it will trigger after the email verify?

2 Likes

Now user email changes will trigger the webhooks. @gpetrov yes, it will trigger only after the email is verified. And like all other webhooks, it won’t include the details about what part of the data is changed. It will trigger the user_updated webhook event with the user data. If you already have the previous values then you can figure it out by comparing.

https://github.com/discourse/discourse/commit/1460d7957c5d9b9300034e5e36675cf44cc3bc0f

2 Likes

But that seems to essential to me! How should we figure what is changed and take appropriate action?

For example I need to sync the email change, but to do that I have to know the old and the new email. I can’t just keep a copy of all users old emails and do a comparison for each change…! That will be way too much time and resource consuming.

Maybe you should check as example the Stripe webhooks where they clearly provide info of what exactly is changed and what was the old and new value.

Sorry, it’s not in our roadmap yet. We may accept it in a pull request.