Description
Use the feature SaveOrCreateSubscriber to synchronize your subscribers. You can add new subscribers to the system or update existing subscribers. While adding a new subscriber you can trigger a Double-Opt-In meaning your subscriber has to confirm his subscription. When updating a subscriberâs data you can request a confirmation of the new data. Backclick will send an E-Mail with a link the subscriber has to click on. Only after this click data in Backclick will be changed. This way you can ensure that no third person is able to change data unasked.
This feature is not meant to import thousands of subscribers in a single request into the system. If you want to do so please use the feature Add/Update Subscribers (Batch-feature).
Available starting from Backclick-Version: 5.7.5
In order to add/update a subscriber you have to provide the following information:
- Mandator ID
- API-Key (optional authentication, if not provided the IP address will be used for authentication)
- Are the mailing lists provided meant to be additive or complete (default: âlistsAdditiveâ => false); optional
- Do you want to delete empty subscriber fields (default: âdeleteBlankFieldsâ => false); optional
- Do you want the last newsletter of the corresponding mailing list to be sent when subscribing to new mailing lists (default: âsendLastNewsletterâ => false); optional
- Do you want the welcome mail to be sent when subscribing to new mailing lists (default: âsendWelcomeâ => false); optional
- Do you want the anti-spam feature to be considered when subscribing to new mailing lists (default: âfilterAntiSpamâ => true); optional
- Subscribers to be added/updated:
- Subscriberâs E-Mail address
- Mailing lists the subscriber is supposed to subscribe to
- Mandator ID
- Double-Opt-In template ID for subscribing to new mailing lists (default: âdoubleOptinTemplateIdâ => 0 (no template)); optional
- Profile-Update template ID for updating subscriber data (default: âchangeProfileTemplateIdâ => 0 (no template)); optional
- Subscriber data:
- Name of the field (mandatory field when providing subscriber data)
- Value of the field (mandatory field when providing subscriber data)
- Do you want the subscriber to confirm changes (default: âconfirmChangeâ => false); optional
The state of your request will be displayed as a result. It includes a response code and a list of syntactically invalid E-Mail addresses. The value of the response code can be one of the following:
- 0: Request faultless. All subscribers were added or updated successfully
- 1: Syntactically invalid E-Mail addresses in the request (see list of invalid E-Mail addresses)
- 2: An error occurred while updating subscriber data
- 3: An error occurred while updating subscriber data and there are syntactically invalid E-Mail addresses in the request
- 4: An error occurred while adding subscribers
- 5: An error occurred while adding subscribers and there are syntactically invalid E-Mail addresses in the request
- 6: An error occurred while adding and updating subscriber data
- 7: An error occurred while adding and updating subscriber data and there are syntactically invalid E-Mail addresses in the request
The following error messages can occur in a faulty request:
- Invalid field name in request => a field provided for a subscriber does not exist
Example
$client = new SoapClient($wsdlUrl);
$saveOrCreateSubscriberRequest = new StdClass();
$saveOrCreateSubscriberRequest->mandatorId = 0;
$saveOrCreateSubscriberRequest->listsAdditive = false;
$saveOrCreateSubscriberRequest->deleteBlankFields = false;
$saveOrCreateSubscriberRequest->sendLastNewsletter = false;
$saveOrCreateSubscriberRequest->sendWelcome = false;
$saveOrCreateSubscriberRequest->filterAntiSpam = true;
$saveOrCreateSubscriberRequest->subscribers = array();
$subscriber = new StdClass();
$subscriber->subscriberEmail = "[email protected]";
$subscriber->newsletterListIds = array(1);
$subscriber->mandatorId = 0;
$subscriber->doubleOptinTemplateId = 0;
$subscriber->changeProfileTemplateId = 0;
$subscriber->subscriberFields = array();
$subscriberField = new StdClass();
$subscriberField->fieldName = utf8_encode("VORNAME");
$subscriberField->fieldValue = utf8_encode("Vorname");
$subscriberField->confirmChange = false;
array_push($subscriber->subscriberFields, $subscriberField);
$subscriberField = new StdClass();
$subscriberField->fieldName = utf8_encode("NACHNAME");
$subscriberField->fieldValue = utf8_encode("Nachname");
$subscriberField->confirmChange = false;
array_push($subscriber->subscriberFields, $subscriberField);
array_push($saveOrCreateSubscriberRequest->subscribers, $subscriber);
try {
$result = $client->SaveOrCreateSubscriber($saveOrCreateSubscriberRequest);
var_dump($result);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
object(stdClass)#2 (2) {
["responseCode"]=>
int(0)
["invalidAddresses"]=>
string(0) ""
}
$client = new SoapClient($wsdlUrl);
$saveOrCreateSubscriberRequest = new StdClass();
$saveOrCreateSubscriberRequest->mandatorId = 0;
$saveOrCreateSubscriberRequest->subscribers = array();
$subscriber = new StdClass();
$subscriber->subscriberEmail = "[email protected]";
$subscriber->newsletterListIds = array(1);
$subscriber->mandatorId = 0;
array_push($saveOrCreateSubscriberRequest->subscribers, $subscriber);
try {
$result = $client->SaveOrCreateSubscriber($saveOrCreateSubscriberRequest);
var_dump($result);
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
Source code
In order to test a working example you can download the source code.
Example for adding a new subscriber to the system