putyourlightson / craft-campaign

Send and manage email campaigns, contacts and mailing lists in Craft CMS.
https://putyourlightson.com/plugins/campaign
Other
63 stars 25 forks source link

Import / Sync Contacts from an Entry Section #403

Closed adrianjean closed 1 year ago

adrianjean commented 1 year ago

The Campaign plugin is able to import contacts (CSV, User Group) and sync contacts (User Group), which is amazing.

However I don't use CraftCMS's "Users" as the content model to save contacts, for two reasons:

  1. Security. I know I can limit users with permissions to prevent login, etc., but I don't even want users to learn that they have a valid username/emails in the system with potential passwords. I like a clear separation between system users and contacts in a database
  2. My contacts database also contains contacts that don't have email addresses (...I know... ). So I need to use an Entry Section to allow for the creation of contacts where email is not a required field.

Would it be possible to build an option to Import/Sync with an Entry Section, allowing me to keep that separation between data (Contacts) and credentialed users but take advantage of the synergy between Campaign's contacts and my contact database. Manual Import/Sync would just skip over contacts where the supplied email is blank, and update those that do.

I have a Entry Reference field that contains what lists the contact belongs to, so I could tell import/sync to only import/sync contacts who's field ( contactMailingList ) is set to a specific value.

Right now I use CSV, but for my admin users it's a more daunting thing to do. Thank you!!

bencroker commented 1 year ago

Would it be possible to build an option to Import/Sync with an Entry Section, allowing me to keep that separation between data (Contacts) and credentialed users but take advantage of the synergy between Campaign's contacts and my contact database.

Your situation is extremely edge-case and I don’t see any general use-case to add contact import/sync from sections. You can, however, achieve this using a custom module/plugin. If that’s an option for you then I can prepare some sample code to get you started.