Reputation: 101
I have a flutter app with firebase authentication of Google SignIn and Facebook SignIn. I want to send an email to the new users of my app. How to implement that? What are the services I need to use for it?
Upvotes: 2
Views: 3835
Reputation: 3159
You can create a cloud function trigger that creates a user document in a "users collection" when the account is created.
export const createUserDoc = functions.auth.user().onCreate(event => {
const firebaseUser = event.data;
const user = {
name: firebaseUser.displayName || "No Name",
email: firebaseUser.email
};
return firebase.firestore()
.collection("users")
.doc(firebaseUser.uid)
.set(user);
});
After that, the easiest way you could get it setup is to use the Firebase Extension to send email: https://firebase.google.com/products/extensions/firestore-send-email
Upvotes: 4