extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Sync existing user email addresses when connecting Mailchimp Extension to Firebase

Open zkhalapyan opened this issue 6 years ago • 9 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about a feature request for a specific extension in this repository. To file a feature request that affects multiple extensions or the Firebase Extensions platform, please reach out to Firebase support directly.

[REQUIRED] Step 2: Extension name

This feature request is for extension: auth-mailchimp-sync

What feature would you like to see?

After I connected mailchimp extension to firebase, I realized that the existing user email addresses were not synced. New users are added, but I have to manually backfill. Would be great if by connecting mailchimp, firebase automatically imported all the existing users as audience members in mailchimp.

How would you use it?

Send out emails to my users just how mailchimp is intended. It would prevent me the headache of manually back-filling.

zkhalapyan avatar Aug 06 '20 18:08 zkhalapyan

Hey @zkhalapyan - thanks for raising this feature request. We'll discuss internally with the Firebase Extensions team and get back to you.

Quick thoughts on this though; I don't think this would be feasible in the extension itself as the extension only reacts to the auth onCreate functions trigger - so it is not aware of existing users. However maybe something like a manual one time run import script that uses the firebase-admin SDK to list all users and sync to Mailchimp - whether that is in scope for this extension though is something we need to discuss internally.

References:

  • https://firebase.google.com/docs/functions/auth-events#trigger_a_function_on_user_creation
  • https://firebase.google.com/docs/auth/admin/manage-users#list_all_users

Salakar avatar Aug 06 '20 18:08 Salakar

I am not completely aware of the extensions architecture overall, but it probably makes sense to have some API for setupExtension that gets called when an extension is installed and at which point you can do a one time read/push to MailChimp. After that, all additional users will be added from onCreate.

From business perspective, I think there is a fairly strong need for this; I am assuming most likely what project owners would do is a manual export/import or maybe get a developer to write the feature above, but both of these sound painful.

Thanks for getting back so quickly 😊

zkhalapyan avatar Aug 07 '20 17:08 zkhalapyan

Kind of related to this. There is no authentication triggers for when users update their email address. So this plugin wouldn't handle that case. Maybe some kind of recurring job that checks for these changes is the way to go. Such a job could tie in with setupExtension.

HyperNexus avatar Aug 13 '20 01:08 HyperNexus

@HyperNexus I think makes sense, but that seems less of a "one time setup" and more of an ongoing update trigger. Probably best to open a new task.

zkhalapyan avatar Aug 14 '20 18:08 zkhalapyan

@Salakar what do you think if we write a script that the user can manually invoke to sync auth with mailchimp? another option is to build it as a scheduled function, but that will run for all users even if they don't need this.

i14h avatar Sep 28 '20 21:09 i14h

Given the multiple scenarios. We could potentially introduce two new tasks...

setupExtension or syncContacts - This would be a manual task that would do as @zkhalapyan suggested, that would sync existing users. In theory this can be ran at any time - so would need to ensure no duplicates are created.

For @HyperNexus, perhaps a new trigger for updating a user could update mail-chimp. A scheduled function would potentially cause delays in synchronisation and as mentioned - be unnecessary for the majority of users

dackers86 avatar Oct 05 '20 10:10 dackers86

After further investigation. setupExtension or syncContacts will perhaps need to be a manual process that can be explained within a setup guide. This will then need to be executed manually?

The main issues here are based around...

  • Timeout limitations through http requests.
  • Potential memory usage based on how many users (though I doubt we would ever hit the 2gb limit)

Please see https://firebase.google.com/docs/functions/quotas.

dackers86 avatar Oct 05 '20 13:10 dackers86

Initial PR script added at https://github.com/firebase/extensions/pull/464

dackers86 avatar Oct 06 '20 14:10 dackers86

Closing in favour of https://github.com/mailchimp/Firebase/issues/29

dackers86 avatar Nov 24 '21 10:11 dackers86