How to send alerts to users after user creation?
-
@bentael hey I am trying to use app.alert inside my plugins function but it throws an error "ReferenceError: app is not defined". Whereas it working perfectly fine inside my plugins template file. I am trying to add a notification to the user when he has created his account. I am using plugin hook available action:user.create. The plugin is getting fired when new user is registered but the app.alert is not working.
Is there a way to use global app object inside my plugins file? -
Hi @vatsal, I just forked your post
The
app
object is only available client-side, so when you are on the server side listening for theaction:user.create
hook, you'll have to use the socket library to emit a message to a user instead:websockets.server.sockets.in('user/' + uid).emit('event:alert', { title: 'test', message: 'something' ... });
^ Untested, by the way
-
@julian I want to know how we can use client side hooks. I want to check some condition from user data and show a notification when every time he is logged in. The hook "action:connected" is not triggering if used like other "non" client side hooks.
-
@julian it's just that I want to show the logged in users a notification about confirming their email. For which I am using "email:confirmed" hash key . Not able to show the notification to the user after logged in state as there is no hook currently which can be executed just after someone is logged in.
Any help with this regard would be highly appreciated, thanks.
P.S.: I think this could be also a feature for upcoming release of NodeBB.