If no value is supplied for a webform field that is configured to be passed to mailchimp, then the following error is returned from the mailchimp API:

Data did not match any of the schemas described in anyOf

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

autopoietic created an issue. See original summary.

autopoietic’s picture

This patch converts the mergevars to strings before subscribing, which avoids problems with null values.

I am using 8.x-5.1, but I have rolled the patch against 8.x-5.x (currently 5.3).

autopoietic’s picture

Missed a line in patch

miro_dietiker’s picture

Priority: Normal » Major

Promoting, can lead to data loss.

maweba’s picture

*push*

currently using hook alter

/**
 * Implements hook_mailchimp_lists_mergevars_alter().
 */
function MODULE_mailchimp_lists_mergevars_alter(&$mergevars, $webform_submission, $entity_type) {
  if(isset($mergevars) && count($mergevars)) {
    $mergevars = array_map('strval', $mergevars);
  }
}
baikho’s picture

Status: Active » Needs review
hanoii’s picture

Status: Needs review » Closed (won't fix)

I am not sure about fixing this with code, if you add apostrophes, it should just work:

FNAME: '[webform_submission:user:field_firstname]'

The above should provide FNAME: '' if null.