Skip to content

Commit

Permalink
Merge pull request #161 from Kajakaran/webhook_api
Browse files Browse the repository at this point in the history
Return webhook if api is set for webhook setting for list
  • Loading branch information
veda-consulting committed Oct 20, 2015
2 parents b2b1a81 + 9e03992 commit 157ed28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CRM/Mailchimp/Page/WebHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ function run() {
if (!empty($_POST['data']['list_id']) && !empty($_POST['type'])) {
$requestType = $_POST['type'];
$requestData = $_POST['data'];
// Return if API is set in webhook setting for lists
$list = new Mailchimp_Lists(CRM_Mailchimp_Utils::mailchimp());
$webhookoutput = $list->webhooks($requestData['list_id']);
if($webhookoutput[0]['sources']['api'] == 1) {
CRM_Mailchimp_Utils::checkDebug('CRM_Mailchimp_Page_WebHook run API is set in Webhook setting for listID', $requestData['list_id'] );
return;
}

switch ($requestType) {
case 'subscribe':
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@ sending a request to Mailchimp for every affected contact would be very slow.

### Important note about unsubscribed contacts

Note: currently, removals are processed as unsubscribes from Mailchimp. This is
so that Mailchimp's reporting and subscriber history is not affected by
removals. However, Mailchimp treats unsubscribed people in a bit of a permanent
way; you cannot ever re-subscribe them! This is caution on Mailchimp's part, as
they have to ensure their service is not used by spammers. However it's an awkward
feature for the general integration case. The only way to re-subscribe someone
who previously unsubscribed is to first delete them from the Mailchimp list.
Note: If anybody is added/removed to group in civiCRM, they get subscribed/unsubscribed to Mailchimp immediately.
If Webhook is set properly in Mailchimp, then subscribe/unsubscribe in Mailchimp is treated back to civiCRM
immediately as addition/deletion to group


We have an upcoming feature that will give you the option to force
a CiviCRM to Mailchimp sync which will automatically do the necessary deletions,
Expand Down

0 comments on commit 157ed28

Please sign in to comment.