You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
Fundraising/External-facing/E-mail preferences: Difference between revisions
Jump to navigation
Jump to search
imported>Wfan (wip) |
imported>Cstone No edit summary |
||
Line 4: | Line 4: | ||
https://phabricator.wikimedia.org/T125272 | https://phabricator.wikimedia.org/T125272 | ||
* | * Local test link: | ||
* | ** https://localhost:9002/index.php/Special:EmailPreferences/emailPreferences?checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&contact_id=208 | ||
* Queue | ** for above url, add uselang=?? to update translations | ||
* Local Json response test link: | |||
** https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&api_key=API_KEY&contact_id=208 | |||
* Get Email Preference Info from civiproxy | |||
** dev/src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Civiproxy/Getpreferences.php | |||
* Update Email Preference with Queue | |||
# /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/CRM/Queue/PreferencesQueueConsumer.php | # /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/CRM/Queue/PreferencesQueueConsumer.php | ||
# /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferencesqueue/Consume.php | # /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferencesqueue/Consume.php | ||
# /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferences/Create.php | # /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferences/Create.php | ||
* Documentation of Email Preference: | * Documentation of Email Preference: https://docs.google.com/document/d/1wKtGxJn06bs6OGAFV7DKUfVw2salKdU_NAUn5SMGks0 | ||
* Design: | * Design: https://design.bytrilogy.com/wikimedia-email-preference-center?frequency=cat&button=&s=#epc-form-col-content-salutation-email-edit | ||
* | == File paths == | ||
* | |||
* HTML: src/email-pref-ctr/extensions/DonationInterface/email_forms/templates/emailPreferences.html.mustache | |||
* CSS: src/email-pref-ctr/extensions/DonationInterface/modules/css/emailPreferences.css | |||
* JS: src/email-pref-ctr/extensions/DonationInterface/modules/js/ext.donationInterface.emailPreferences.js | |||
== Queue == | == Queue == | ||
Line 27: | Line 35: | ||
./vendor/bin/phpunit --filter testEmailPreferenceCenterUpdateApi | ./vendor/bin/phpunit --filter testEmailPreferenceCenterUpdateApi | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== CiviCRM == | |||
*Local civi url to see the api: http://wmff.localhost:32353/civicrm/api3#explorer: select contact -> get -> then input the contact id and the checksum there to see the donor info | |||
* Check user from civi: https://wmff.localhost:32353/civicrm/contact/view?reset=1&cid=6 | |||
* From edit view, you will see the opt in from communication section, home email, and their prefer language, and Email preference Country. | |||
== Civiproxy == | == Civiproxy == | ||
Official documentation: https://docs.civicrm.org/civiproxy/en/latest/ | Official documentation: https://docs.civicrm.org/civiproxy/en/latest/ | ||
* Link to test from docker add in key and hash from a test contact (need checksum and contact_id): [https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&api_key=API_KEY&contact_id=208 https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=&api_key=API_KEY&contact_id=] | * Link to test from docker add in key and hash from a test contact (need checksum and contact_id): | ||
* [https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&api_key=API_KEY&contact_id=208 https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=&api_key=API_KEY&contact_id=] | |||
[[File:Email Prefs CiviProxy 1.png|left|frameless|500x500px|Diagram of the Email Preference Center and Civiproxy flow from 2021]] | |||
== Deploying == | |||
Revision as of 20:12, 1 March 2022
Overview
The email preference center is a standalone wiki that uses civiproxy to talk to civicrm.
https://phabricator.wikimedia.org/T125272
- Local test link:
- https://localhost:9002/index.php/Special:EmailPreferences/emailPreferences?checksum=705239735920094e8b2cf6c1f9b04215_1645597635_168&contact_id=208
- for above url, add uselang=?? to update translations
- Local Json response test link:
- Get Email Preference Info from civiproxy
- dev/src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Civiproxy/Getpreferences.php
- Update Email Preference with Queue
- /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/CRM/Queue/PreferencesQueueConsumer.php
- /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferencesqueue/Consume.php
- /src/civi-sites/wmff/drupal/sites/default/civicrm/extensions/wmf-civicrm/api/v3/Preferences/Create.php
- Documentation of Email Preference: https://docs.google.com/document/d/1wKtGxJn06bs6OGAFV7DKUfVw2salKdU_NAUn5SMGks0
File paths
- HTML: src/email-pref-ctr/extensions/DonationInterface/email_forms/templates/emailPreferences.html.mustache
- CSS: src/email-pref-ctr/extensions/DonationInterface/modules/css/emailPreferences.css
- JS: src/email-pref-ctr/extensions/DonationInterface/modules/js/ext.donationInterface.emailPreferences.js
Queue
drush cvapi Preferencesqueue.consume time_limit=1000 max_batch_size=1
Unit Test
./vendor/bin/phpunit --filter testEmailPreferenceCenterUpdateApi
CiviCRM
- Local civi url to see the api: http://wmff.localhost:32353/civicrm/api3#explorer: select contact -> get -> then input the contact id and the checksum there to see the donor info
- Check user from civi: https://wmff.localhost:32353/civicrm/contact/view?reset=1&cid=6
- From edit view, you will see the opt in from communication section, home email, and their prefer language, and Email preference Country.
Civiproxy
Official documentation: https://docs.civicrm.org/civiproxy/en/latest/
- Link to test from docker add in key and hash from a test contact (need checksum and contact_id):
- https://localhost:9005/rest.php?entity=civiproxy&action=getpreferences&key=SITE_KEY&version=3&json=1&checksum=&api_key=API_KEY&contact_id=