New User SignUp with Welcome Email using Firebase FireStore, Cloud Functions and Mailgun

Share
cloud-firestore

Cloud FireStore and Cloud Functions can be easily used to save user details when a new user creates an account. An email can also be sent easily using an external service like Mailgun.




The basic idea is as follows:



1. User Signup and entry in Cloud FireStore


The above code is triggered when a new user signs up for the first time. It should be triggered only when the Firebase Auth is successful.

In the above code snippet, id is nothing but the unique id returned by Firebase Auth. The field "name" is entered by the user during signup.


2. Cloud Function to trigger Email




It is important to note that we need to have proper Mailgun API credentials. Also mailgun.js should also be installed in the directory of the cloud functions.

The above code works for all types of login, but the user should have a valid email id in the Cloud FireStore.



0 comments:

Post a Comment

What do you think?.

© 2007 - DMCA.com Protection Status
The content is copyrighted to Sundeep Machado


Note: The author is not responsible for damages related to improper use of software, techniques, tips and copyright claims.