Ronnie Smith
Ronnie Smith

Reputation: 18575

Firebase Cloud Functions: Send Email via Authentication System

Firebase Authentication has a built in email service. Is it possible to fire an auth based email via Cloud Functions (admin js sdk)?

Seems like I should be able to trigger an email from [email protected] with a custom oob code which I could then use to drive my (client-side) application.

My use case would be, when a new order .collection("orders").doc(uid) has its stage field updated/changed to 'submitted' I would like to notify a user via email that a new order is submitted. Maybe even use the oob code to mark as 'processed'?

...just trying to avoid using a 3rd party email service altogether.

enter image description here

Upvotes: 1

Views: 1747

Answers (2)

Gastón Saillén
Gastón Saillén

Reputation: 13129

you can use MailChimp to do what you are asking, since like Miles says, you will need to do a workaround in order to fix this.

I have been using MailChimp my self to send emails to each user registered in my app , i have setup a couple of emails in mailchimp and i just add to the list all the users that register to my app, so the first message will be the welcome message, then after 2 days another email and so on, you can trigger an email whenever you want, since the doc is not that clear i have made a tutorial on how to integrate it with Android.

you can find that tutorial HERE , the only thing is that is in spanish, sorry.

The idea is simple, just get your users email throught FirebaseAuth , pass that email to the mailchimp query , and then setup an email from the mailchimp website

Upvotes: 2

Miles Zimmerman
Miles Zimmerman

Reputation: 374

Unfortunately, their API does not appear to support emailing users in your project. However, they have sample code for cloudfunctions to email users you can easily tweak for your needs: https://github.com/firebase/functions-samples/tree/master/quickstarts/email-users

Upvotes: 1

Related Questions