Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CiviCRM Email Marketing Integration #2274

Open
GFF-DS opened this issue Jan 31, 2025 · 0 comments
Open

Add CiviCRM Email Marketing Integration #2274

GFF-DS opened this issue Jan 31, 2025 · 0 comments
Milestone

Comments

@GFF-DS
Copy link

GFF-DS commented Jan 31, 2025

What are you trying to do?

See also #2271

We want to use Formie for newsletter subscription with Double-Opt-In, integrated with CiviCRM. The Double-Opt-In is made up of two parts: The first opt-in and the second opt-in.

Here's the user story:

  1. First opt-in to subscribe: User visits example.com, fills in a Formie form and clicks "Subscribe".
  2. After this first opt-in, the user gets an second-opt-in-mail with a personalized link to confirm the subscription. The link points to a subscribe-confirmation-page on example.com.
  3. Second opt-in to subscribe: Visiting the subscribe-confirmation-page automatically confirms the subscription, user gets a welcome-mail.
  4. Unsubscribe: Every newsletter contains a personalized link to unsubscribe. The link points to a unsubscribe-confirmation-page on example.com.
  5. Visiting the unsubscribe-confirmation-page automatically unsubscribes the user, user gets a bye-bye-mail.

What's your proposed solution?

CiviCRM comes with two different kinds of newsletter subscription management:

  1. CiviMail, which is part of CiviCRM Core
  2. Advanced Newsletter Management (ANM), which is a CiviCRM-Extension

We would like to integrate Formie with ANM.

ANM comes with a comparatively complex management for newsletter subscriptions. We only want to implement a small and simple subset of the available functionality.

Step 1

formie needs to send a HTTP POST request with the following fields:

  • mailing_lists=[mailing_list_id] # configured in the formie config
  • email=[email_address] # mapped from the formie form
  • first_name=[first_name] # mapped from the formie form
  • last_name=[last_name] # mapped from the formie form

Step 2

is done by CiviCRM.

Step 3

The confirmation page contains a profile name and a contact checksum, for example example.com/newsletter/optin/[profile]/[contact_checksum]. The profile name is set in CiviCRM and needs to be configurable in the formie config. The page url may be set by formie and is configurable in CiviCRM. Visiting the confirmation page triggers a HTTP POST request with the following fields:

  • mailing_lists=[mailing_list_id] # configured in the formie config
  • contact_checksum=[contact_checksum] # extracted from the page url
  • contact_id=[contact_id] # extracted from the contact_checksum
  • autoconfirm=1 # always the same value

Step 4

is done by CiviCRM

Step 5

The confirmation page contains a profile name and a contact checksum, for example example.com/newsletter/unsubscribe/[profile]/[contact_checksum]. The profile name is set in CiviCRM and needs to be configurable in the formie config. The page url may be set by formie and is configurable in CiviCRM. Visiting the confirmation page triggers a HTTP POST request with the following fields:

  • mailing_lists=[mailing_list_id] # configured in the formie config
  • contact_checksum=[contact_checksum] # extracted from the page url
  • contact_id=[contact_id] # extracted from the contact_checksum
  • unsubscribe_all=1 # always the same value

Authentication

Every HTTP POST request additionaly contains the following fields (configured in the formie config):

  • api_key=[api_key] # in CiviCRM associated with a CiviCRM-contact, holding the appropriate access rights
  • key=[site_key] # specific to the connected CiviCRM instance

HTTP endpoint

The endpoint for the HTTP POST requests needs to be configured in the formie form. For a Drupal-based CiviCRM it would be https://example.com/civicrm/ajax/rest

Additional context

Formie needs to process all pages like example.com/newsletter/optin/default/*, where default is a configurable string and the actual value at * is evaluated to generate the HTTP POST request. Is that possible?

@engram-design engram-design added this to the 2.2.0 milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants