This method creates and automatically starts an import process for the contacts listed in the xmlDoc parameter. You can use this method instead of calling a sequence of NewImportProcess and StartProcess methods. StartImportProcesses can also be used to update fields of an existing contact.
...
Note |
---|
The following table shows the most common combinations for the parameters that manage subscription status of imported recipients that are already present on MailUp Action required on already existing recipients | ConfirmEmail | AsOptout | AsPending | ForceOptIn | |
---|
No changes on subscription status | False | False | False | False | Default case | Pending become Subscribed | False | False | True | FalseBad | practice, please take care with itIt's a bad practice to force subscription of pending recipients at import time, the recommended practice with double optin is that you import as pending and you let MailUp do this status change when recipient actually clicks on the confirmation link. | Unsubscribed become Subscribed | False | False | False | True | Except for recipients that were unsubscribed due to hard bounce or complaints feedback loop | Subscribed become Pending | True | False | False | False | With this configuration the confirmation email is sent to both previously subscribed and previously pending | Unsubscribed become Pending | True | False | Any | True | Except for recipients that were unsubscribed due to hard bounce or complaints feedback loop Despite of its name, "AsPending" value is ignored here. | Subscribed become Unsubscribed | False | True | False | False | | Pending become Unsubscribed | False | True | True | False | |
|
Tip |
---|
|
Method call fails when another import process is running. You can use GetProcessDetails method to check if a previously started process is still running; while an alternative solution consist of periodically retry the method call until it returns ReturnCode=0 Method response contains either a global ReturnCode or a specific ReturnCode for each import process that has been started by this method. Call is successful only when all ReturnCodes are equal to "0" There is not a known size limit for xmlDoc field: it has been successfully tested with 1.2 million characters (in this case return value is quite immediate but the whole import process could take several minutes and other import requests will be denied during this period) When using cloud services it can happen that your application must respect a size limit in API calls that is lower than the size of the XML that you would pass as xmlDoc parameter. In this case you can split your import data, call several times NewImportProccess NewImportProcess with smaller recipient lists and then use StartImportProcesses (with empty xmlDoc parameter) to sequentially start all previously created import processes. This behavior requires MailUp 8.2.1 or higher. Please note that, when combining one or more calls to NewImportProcess and a final call to StartImportProcesses , the parameters of StartImportProcesses do not overwrite the import settings that were specified by each NewImportProcess request With ConfirmEmail=true, MailUp automatically selects the confirmation request message (you can customize it on Settings > List Settings > Notifications > Confirmation request) and it creates a queue of recipients that will receive that message. Please note that queue creation takes a while (even a couple of minutes if you have 1M recipients to be imported and notified) and queued message is made "ready for immediate sending" but it IS NOT automatically sent to the recipients. To send a queued message you can use StartDelivery method. You could also use GetNewsletterQueues before calling StartDelivery in order to double check if queuing in "ImmediateSendingQueue" is completed.
|
Lists and Groups
You must specify either listIDs
or listsGUIDs
parameters. If you specify both fields, then the number of items in each parameter must match, and you must use semicolons to delineate empty values. We've provided examples below to help with understanding how to work with these parameters.
...
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<ws:listsIDs>1;2</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>;</ws:groupsIDs> |
Add recipients to multiple lists (one group per list)
In this example values are provided for both listsIDs
and listsGUIDs
parameters (mandatory fields). Each of the parameters must have the same number of elements (separated by semi-colons). In this case, we are also specifying group 22 for list 1, and group 13 for list 2.
Code Block |
---|
language | html/xml |
---|
linenumbers | true |
---|
|
<ws:listsIDs>1;2</ws:listsIDs>
<ws:listsGUIDs>66af9900-7dd7-4cca-9125-beadaf3a3a59;0e591119-xxxx-yyyy-zzzz-6ac75384b564</ws:listsGUIDs>
<ws:groupsIDs>22;13</ws:groupsIDs> |
...
Code Block |
---|
language | php |
---|
linenumbers | true |
---|
|
<?php
class MailUpWsImport {
protected $ns = "http://ws.mailupnet.it/";
//replace <console host name> with the host name of your console
protected $WSDLUrl = "http://<console host name>/services/WSMailUpImport.asmx?WSDL";
protected $headers = array("User" => "user", "Password" => "password");
protected $rCode;
private $soapClient;
private $xmlResponse;
protected $domResult;
function __construct() {
$this->header = new SOAPHeader($this->ns, "Authentication", $this->headers);
$this->soapClient = new SoapClient($this->WSDLUrl,array("trace" => 1,"exceptions" => 0));
$this->soapClient->__setSoapHeaders($this->header);
}
function __destruct() {
unset($this->soapClient);
}
//...
public function startImportProcesses($processData) {
try {
echo $processData."<br/><br/>";
$this->soapClient->StartImportProcesses($processData);
} catch (SoapFault $soapFault) {
var_dump($soapFault);
}
}
//...
}
$WsImport = new MailUpWsImport();
$xmlData = <<<EOT
<subscribers><subscriber email="test@example.com" Prefix="+39" Number="3351234567" Name="Test">
<campo1>Luigi</campo1><campo2>Rossi</campo2><campo3>Rossi consulting</campo3><campo4>Parma2</campo4><campo5>PR</campo5>
<campo6>43102</campo6><campo7></campo7><campo8>ITA</campo8><campo9>Via Garibaldi, 1</campo9><campo10>0521123456</campo10>
<campo11>0521123457</campo11></subscriber></subscribers>
EOT;
$startImportProcessData = array(
"listsIDs" => "4",
"listsGUIDs" => "3c5cb08c-f0b5-4bd6-9c2a-b687ecdac8b4",
"xmlDoc" => $xmlData,
"groupsIDs" => "22",
"importType" => "3",
"mobileInputType" => "2",
"asPending" => '0',
"ConfirmEmail" => "0",
"asOptOut" => "0",
"forceOptIn" => "0",
"replaceGroups" => "0"
);
$WsImport->startImportProcesses($startImportProcessData);
?> |
C#
Code Block |
---|
|
WSMailUpImport toTest = new WSMailUpImport();
Authentication auth = new Authentication();
auth.User = tbLoginUserImport.Text;
auth.Password = tbLoginPasswordImport.Text;
auth.encType = string.Empty;
toTest.AuthenticationValue = auth;
string xmlString = "<subscribers><subscriber email=\"mike@example.com\" Prefix=\"\" Number=\"\" Name=\"\"><campo1>Mike</campo1><campo2>Brown</campo2><campo3>Example Company</campo3><campo4>Los Angeles</campo4><campo5></campo5><campo6>90125</campo6><campo7>CA</campo7><campo8>US</campo8><campo9>555 Some Street</campo9><campo10></campo10><campo11>555-123-1234</campo11></subscriber></subscribers>";
string myListId = "8";
string myListGuid = "CC9C4CBD-567B-4248-B56F-7C8364F11C5";
string myGroupsIDs = "45";
int importType = 3;
int mobileInputType = 2;
bool asPending = false;
bool ConfirmEmail = false;
bool asOptOut = false;
bool forceOptIn = false;
bool replaceGroups = false;
string retVal = toTest.StartImportProcesses(myListId ,myListGuid, xmlString, myGroupsIDs, importType, mobileInputType, asPending , ConfirmEmail, asOptOut, forceOptIn, replaceGroups); |
...