Send welcome email to new users of a Flutter app

2,834

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

Share:
2,834
Niladri Paul
Author by

Niladri Paul

Updated on December 15, 2022

Comments

  • Niladri Paul
    Niladri Paul over 1 year

    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?