I'd like to build an email drop service. Is it anyhow possible to receive incoming emails with Google cloud functions, process them and store them in firebase db?
I'm thinking of something similar to Amazon simple email service SES in combination with lambda functions. Does any of the available email services like sendgrid, mailgun, postmark or any other has api's to trigger Google Cloud Functions on incoming emails?
Yes, services like Sendgrid and Mailgun allow you to set up webhooks for incoming mail. You can configure these webhooks to point to an HTTPS Cloud Function, at which point it will be invoked each time you get a new incoming email.
Related
I am currently facing the following situation.
Sending Firebase Messages via HttpCall via the google API endpoint:
https://fcm.googleapis.com/v1/projects/projectName/messages:send
Here we have to use OAuth2.0 with a valid Bearer Token like discussed in this question:
What Bearer token should I be using for Firebase Cloud Messaging testing?
After following these steps I was able to send Firebase Messages via the google API.
Now I would like to get the Bearer Token via a HttpCall without doing the manual step with the Playground https://developers.google.com/oauthplayground.
I cannot find any documentation on how to "Exchange authorization code for tokens" via simple HttpCall. I have no possibility to implement any code because I would like to send Firebase messages inside a "Dataverse Cloud Flow/PowerAutomate", therefore no possibility to load any external DLL (like the Firebase Admin Dll, which would implement this functionality).
I am not,looking for a solution which depends on external Dll like https://firebase.google.com/docs/database/rest/auth#authenticate_with_an_access_token or Pre-RequestScript
Any help is appreciated
What you are after is fundamentally not possible, since you can't hook the result of the bearer token into the same URL process to send messages. By the sounds of it you are unable to fetch one URL, process the results from that URL to pass onto the other which is what the REST API would do.
As such, you will need a secondary service that you can simply send messages to and it will invoke the Message and authentication for you, a bridge as you will. You can use Firebase Cloud Functions with an onRequest call or a simple express server on a Google Compute Engine instance (f1 free tier).
Then you can send your message request from your service to this bridge which will authenticate for you and send the message, it would be a fairly simple script to implement, specially with the admin-sdk.
I am trying to find the feature in firebase console to send bulk emails to the registered users in the firebase. But not able to find one.
Please suggest me how can I send the bulk emails through the firebase console to the registered users with the email ids in the Firebase Authentication
There is no built-in feature to send bulk emails from Firebase. The only built-in email sending capacity is around signing in with Firebase Authentication, and the contents of those emails is tightly controlled by Firebase to prevent it being used for sending spam.
If you want to send your own emails from Firebase you'll have to build it on top of Firebase, typically using Cloud Functions as sending email reliably is best done from a trusted environment.
Two examples of sending emails from Firebase:
Using the trigger email extension, which sends an email when data is written to the Firestore database.
Using the email confirmation sample for Cloud Functions, which works similarly as the extension.
Both of these require you to provide your own SMTP server details, which means you are in control of abuse prevention.
Is there a way to trigger a firebase function or create an item in Firestore when an email is received on Gmail or Outlook.
I'm trying to recreate on of ServiceNow's features where in if the helpdesk email address has received an email, it will automatically create a ticket (to firestore) out of it.
Thank you!
Here is one possible solution for Gmail (untested):
According to the Gmail API documentation:
The Gmail API provides server push notifications that let you watch
for changes to Gmail mailboxes... Whenever a mailbox changes, the Gmail
API notifies your backend server application.
...
The Gmail API uses the Cloud Pub/Sub API to deliver push notifications.
Since you can trigger a Cloud Function whenever a new Pub/Sub message is sent to a specific topic you can do as follows:
Set up a Cloud Pub/Sub client.
Using your Cloud Pub/Sub client, create the topic that the Gmail API should send notifications to.
Configure the Gmail account(s) to send notifications for mailbox updates
Write a Cloud Function that is triggered whenever a new Pub/Sub message is sent to this topic and execute the desired Business Logic (e.g. write to Firestore)
For Outlook, this SO answer indicates that it should be possible to call an API when a new mail is received. You could either call an HTTPS Cloud Function or directly the Firestore REST API.
I haven't seen any examples of this, but I want to purely interact with Firebase through the backend, and not the frontend with Javascript.
I have auth tokens being minted on my Go backend when a new user is added and then these users are written into a mongo database.
What I want is to be able to get a messaging token for my users, and then add it to their user document in mongo, that'll be used to send messages through the backend.
The reasoning is that we don't want to have to communicate with Firebase on our frontend.
Is this even possible?
If you want to send a message directly to a device with Firebase Cloud Messaging, you will definitely need some information from the client. There is no avoiding following the setup instructions on the client. In particular, you will have to handle the registration token on the client and send it to your backend so it can send the messages.
The Firebase Authentication token will not be useful to you at all for sending messages. FCM doesn't send messages to users - it sends messages to devices (or topics). You will have to figure out for yourself which devices belong to which users.
When customers make an order we need to send a mail to sellers, is it possible by firebase cloud function sent from Gmail account to other Gmail account (with free plan)
You will find here an official Sample for a Cloud Function that sends e-mails through Gmail: https://github.com/firebase/functions-samples/tree/Node-8/email-confirmation
Since it is Gmail it is a Google-owned service and therefore you can use it with a free Spark Plan.
As detailed in this sample documentation, "be aware that Gmail has an email sending quota": no "more than 500 recipients in a single email and or (no) more than 500 emails in a day sent.", see https://support.google.com/mail/answer/22839.
The sample documentation explains that:
If you are planning on sending a large number of emails you should use
a professional email sending platform such as Sendgrid, Mailjet or
Mailgun.
Using Sendgrid, for example, is very easy but then you would need to be on a payed Plan because Sendgrid is not a Google-owned service.