1

When a new user is added to Firebase, I would like to send myself an email with all of the data associated with that user. So if I have a /contacts path and a /projects path, I'd like to include the data from both paths when a child is added to the /contacts path.

I've looked at Zapier using Mailgun, but can't figure out how to accomplish this.

If Zapier won't work, is this something can be accomplished with the firebase-util?

Tree for my-firebase-app.firebaseio.com/contacts

-contacts
--anonymous:-JttGEelQDsVtZ55n3d2
---name: john doe
---address: 100 Main St.
// . . . 

Tree for my-firebase-app.firebaseio.com/projects:

-projects
--anonymous:-JttGEelQDsVtZ55n3d2
---projectName: "My first project"
---projectDate: July 27, 2015
// . . . 

UPDATED:

In response to the comment below, here is some additional info:

I have tried the following steps in Zapier:

  1. Selected Add child record under Firebase
  2. Selected Send email under Mailgun
  3. Set path to data: /contacts
  4. In the email body section, I inserted Raw Json Data

The email only contains the Json data located in /contacts. It does not contain any of the data located in /projects.

Ken
  • 3,091
  • 12
  • 42
  • 69
  • Triggering the sending of email from zapier through Firebase should work fine. Asking for an other off-site solution is off topic for StackOverflow. Instead describe what you've done and where you got stuck. You might also want to reach out to Zapier support. – Frank van Puffelen Jul 27 '15 at 21:44
  • possible duplicate of [Send Email When Match in Firebase Database](http://stackoverflow.com/questions/28656191/send-email-when-match-in-firebase-database) – Frank van Puffelen Jul 27 '15 at 21:44
  • @Frank van Puffelen Thanks for the feedback. I edited my question to provide some more information. I hope that helps. I looked at the possible duplicate, but it didn't answer my question. – Ken Jul 27 '15 at 21:57
  • Cross-post: https://groups.google.com/forum/#!topic/firebase-talk/rIOvKfRKeJ8 – Frank van Puffelen Jul 27 '15 at 23:21
  • @Frank van Puffelen That Google Groups post you linked to above was not from me. For what it's worth, I'm using Angular, Node, and Firebase. – Ken Jul 28 '15 at 00:18
  • Oops. Apparently my cross-post detection foo failed here. Sorry about that. – Frank van Puffelen Jul 28 '15 at 01:15

1 Answers1

0

This can pretty easily be accomplished with Zapier.

You have define a node that will trigger Zapier to read your data. Then set Zapier to 'observe' that trigger node. You define the fields in the node and then in Zapier, map them to variables that are used to fill in the email.

In general use something like this (ObjC)

Firebase *zapierRef = [myRootRef childByAppendingPath:@"zapier_queue/out"];

Then, compile the data you want Zapier to read, I am using a dictionary in this example

NSDictionary *dict = @{
                     @"name", @"john doe",
                     @"address", @"100 main street",
                     @"anonymous: @"-JttGEelQDsVtZ55n3d2",
                     @"projectName": @"My first project",
                     @"projectDate": @"July 27, 2015"
                     }

then write that out as a child node in the Zapier node

Firebase *zapChildRef = [zapierRef childByAppendingPath@"data"]

[zapChildRef setValue:dict];

Zapier will be triggered by the write to this node, read the data, format it into the email and then once completed with automatically remove the node and wait for the next piece of data.

Jay
  • 34,438
  • 18
  • 52
  • 81
  • Thank you, this is interesting. I wasn't aware of this option. How would I compile the data if I don't know the info you listed in the dictionary example? i.e., if I all I know is that I want to get the information for a new UID and any children associated with it in the `/contacts` path and the `/projects` path? – Ken Jul 29 '15 at 08:37
  • You will know the information at some point: perhaps when writing the data to the /contacts node or projects node you could also write it to the node that Zapier is observing. You could also set up a firebase observer on your /projects node to trigger a write to the zapier node. i.e. write data to /contacts then write data to /projects (which is being observed in your app). That triggers a read of the the info from /contacts and /projects - compile the data and finally write it out to the zapier node. – Jay Jul 29 '15 at 17:46