Sunnysideup\CampaignMonitor\Api\Traits\Subscribers::addSubscribers
Updates an existing subscriber (email, name, state, or custom fields) in the specified list.
The update is performed even for inactive subscribers, but will return an error in the event of the given email not existing in the list.
Signature
public function addSubscribers(string
$listID,
array|dataList
$membersSet,
bool
$resubscribe,
[array
$customFields = ,
[boolean
$queueSubscriptionBasedAutoResponders = false,
[boolean
$restartSubscriptionBasedAutoResponders = false]]] )
Parameters
$listID
— string$membersSet
— object- - list of Member|object with Email, FirstName, Surname fields
$resubscribe
— object- Whether we should resubscribe any existing subscribers
$customFields
— array- The subscriber details to use during creation. Each array item needs to have the same key as the member ID - e.g. array( 123 => array( [custom fields here] ), 456 => array( [custom fields here] ) )
$queueSubscriptionBasedAutoResponders
— boolean- By default, subscription based auto responders do not trigger during an import. Pass a value of true to override this behaviour
$restartSubscriptionBasedAutoResponders
— boolean- By default, subscription based auto responders will not be restarted
NOTE that for the custom fields they need to be formatted like this:
Array(
'Key' => The custom fields personalisation tag
'Value' => The value for this subscriber
'Clear' => true/false (pass true to remove this custom field. in the case of a [multi-option, select many] field, pass an option in the 'Value' field to clear that option or leave Value blank to remove all options)
)
Returns
- mixed
- A bad response will be empty