Send Email When Match in Firebase Database - angularjs

I'm trying to build a web app using AngularJS and Firebase that sends an email to two users that match on certain parameters. The users submit their information first and if there is a match with another person in the database, I want to send an email to both those people. For example, if two people, A and B both have the age of 25, I would like to send A and B an email with certain information. Is this possible using Firebase?

If you are NOT running a server
Yes
You could achieve it by using a service like Zapier.
You could create a zap linking FireBase and an e-mail service like Mandrill.
A Zap combines triggers and actions — whenever the trigger event occurs, Zapier automatically completes the action for you!
When there is a match, update a special key in your FireBase database.
As Zapier is listening to updates of that particular key, it will react by sending your e-mails via Mandrill.
March 2017 UPDATE
New tools have now been added to Firebase to trigger database event handlers:
database events triggers: https://firebase.google.com/docs/functions/database-events
cloud functions for FireBase: https://firebase.google.com/docs/functions/functions-and-firebase
using cloud functions to send e-mails through sendGrid:
https://cloud.google.com/functions/docs/tutorials/sendgrid
If you are running a server
Your server can easily check the values in FireBase and send e-mails accordingly. That would then be a
Yes, of course :)

Related

When to update the db with the created order. Firebase Firestore, React, Stripe

Ideal Scenario.
The user makes the order.
Firebase Server sends the request to Stripe.
Stripe Confirm Payment Method and sends a webhook to Firestore. At this point, I can create the order on the server. But:
webhook sometimes is fast and others not
need to create a temp order and update it later with the data from the hook
Problems till here
how to know the id of the created order to update later?
is there some way to send data automatically from the server to the client?
The most common way to handle this is to attach metadata to your PaymentIntent with a UUID for your Order ID. At the same time you create a corresponding order in your database. Then, that same Order ID will come through via your Webhook (via the metadata you set) when the payment has been completed and you update your database accordingly for that order.

how to send "order is confirmed emails to customer" in django

I am trying to make an e-commerce website in Django and react. but I am not able to find a way for this scenario.
whenever a user purchases something a confirmation email should go to the user and one to the admin that a user buy something.
can we do this just by code or we have to use something like Mailchimp?i want to do it by writing code.
You don't need a service like Mailchimp for this. You need to write your own code for sending emails.
To send emails in Django you need to configure a mail server. You can use your own mail server or use providers like AWS SES (Simple Email Service) or SendGrid.
Then you need to write the code that will send two emails after the purchase. Ideally, it should be done in the webhook that will wait for payment confirmation from your payment provider (for example Stripe).
BTW, I'm working on Django+React tutorials at SaaSitive and just committed example code how to send activation emails (after registration) https://github.com/saasitive/django-react-boilerplate

Send an email when records are added to Firebase database

I would like to send an email to the signed user with the data that was added by the user to the Firebase database. I am using AngularJS UI. Is there are Firebase module which will trigger email with the data being added to the signed user.
Thanks, Rajesh
You should look into Cloud Functions for Firebase. This will let you write database triggers that run on Google servers that can act whenever data in your database changes. There is plenty of sample code the illustrates some of the many things you can do, including one specific example that shows how to send email in response to a change in the database.

Connect to ejabberd server and application server

I have an ejabberd server and I am trying to build a chat module in my Angular/NodeJS app.
Currenlty, my Angular app connects directly to the chat server. Assume my roster has 100 contacts comprising of online and offline contacts. I need to map all the 100 contacts with the users in my application server to get more details like companyId, email, contact, etc.
Do I have to loop through each contact and call an API to the application server? Wouldn't that put a lot of load on the frontend? Is there a better way of achieving this?
Apologies if my question is silly. I am new to XMPP.
There are several way´s of doing this.
You could go and fetch every single user from your API, cache them so the next you don´t have to fetch all the data, but that´s not the optimal solution.
The other solution would be to get all contacts with one single call by passing all id´s to your node application. Then the node app can fetch all needed data from your database and pass it back with one Request and not 100.
With more or less the same problem I used a jabber search getting up all the users and stored on client for the entire session.
My requsite it's "all users can chat with all other users" (about 100 users on server),
if your is not, I suggest you to create a custom IQ and let server cache the Jabber search (updating after each user registration) and reply with only required datas in a single call, async.

Run code in GAE according to changes in Firebase

Since Parse is shutting down, we are currently using Firebase to support basic data storage and real-time messaging. However, in order to implement a key feature in our app, we need to run some code on a server. The following is what we are trying to accomplish:
We allow users to upload key words to Firebase, then we want to send notifications to them if any new posts that contain these key words were uploaded by other users. For example, userA wants to know if anyone posted information related to chemistry, so userA enters key words "chemistry" and "science" in our app which get stored in Firebase, userB posted an article called "chemistry rocks!" which contains the key word "chemistry", userA will then receive a notification immediately about this post.
We have a couple of solutions in mind, but we are not sure which way to go and how to properly implement these solutions.
1 - Build a server that listens to Firebase changes and also supports sending notifications to individual users. However, to host and maintain a server just to run a search algorithm is just too much work for this simple task.
2 - Store the key words in another database that somehow can send notifications according to the search result. This would be faster because we wouldn't have to connect Firebase server to our own server, but again we would still have to host and maintain a separate server.
I have looked into Google App Engine, their push/pull queue feature sounds like something we want, but does GAE support notifications? And also how can we hook it up with Firebase? We also came across Firebase+Batch to send notifications, but I don't think Batch supports cloud computation.
Has anyone run into this problem? Any solutions?

Resources