We have a Flutter project with Firebase setup we would like to create a Firebase cloud function with nodejs that perform the following:
Listen to pop3 or IMAP email inbox hosted by Gmail, then create a new Firestore document every time a new email comes, this document should be referred to an order number or to an existing ticket The process is:
- Listen to an email inbox
- Check the subject if related to order the subject should contain the order id If order I’d not exist then check existing tickets subject if the email subject match an existing ticket title
- create document with referred order id or ticket id
- send FCM and email notification