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.
Mandatory fields must be specified even when they are empty. Optional fields can be skipped if you want to use the default value.
Mandatory - List identifiers. You can include multiple list IDs, separated by semicolons. (See "Lists and Groups" section below for more information and examples.)
Mandatory - List GUIDs. You can include multiple list GUIDs, separated by semicolons. (See "Lists and Groups" section below for more information and examples.)
When specified: An XML string containing the recipients to be imported to the specified lists and groups. In this case the method Does not import any pending lists that were previously submitted using NewImportProccess
If not specified (NULL): method sequentially imports all pending XML structures that have been previously submitted using NewImportProccess. This option is available only starting from MailUp 8.2.1 or higher
See "Best Practices" and "XML Structure" sections below for known restrictions, more information and examples.
Mandatory - Group identifiers for each list, separated by semicolons. You can specify multiple groups for each list as well, separated by commas. (See "Lists and Groups" section below for more information and examples.)
Mandatory - Import type.
Any empty field is ignored if importType is equal to 1,2 or 3
1 = import occur only on email channel (mobile number, if present, is discarded)
2 = subscriptions occur only on SMS channel (email address, if present, is discarded)
3 = subscriptions occur on both email and SMS channels (no field is discarded)
Any empty field overwrites the value on MailUp if importType is equal to 4, 5 or 6
4 = import occur only on email channel (mobile number, if present, is discarded)
5 = subscriptions occur only on SMS channel (email address, if present, is discarded)
6 = subscriptions occur on both email and SMS channels (no field is discarded)
Mandatory - Mobile number input type.
1 = Entire number in a single field
2 = Prefix and Number separated into different fields
(See "XML Structure" section below for more information and examples.)
Mandatory - If "true" it subscribes (or unsubscribes, if "asOptOut=true") also the recipients that were pending in specified MailUp list before import. Please note that the name of this parameter is misleading, see table in Best Practices for details (Default = false)
Mandatory - If "true" sets subscription status of specified recipients as "pending" and sends them a confirmation email. Status change to "pending" and email sending applies to either brand new recipients or to recipients that were already subscribed or pending to the specified list before import. See table in Best Practices for details. (Default = false)
Mandatory - Imports recipients as "unsubscribed" when set to "true", regardless if they were previously subscribed into specified MailUp list. If you want to cancel subscription (i.e. unsubscribe) also for the recipients that were previously pending, you should set both "asOptOut=true" and "asPending=true". See table in Best Practices for details. (Default = false)
Mandatory - If "true" itenables change of subscription status even if a recipient was "unsubscribed" before import. It can be used to force "subscribed" or "pending" status for previously unsubscribed recipients, please note that this status change does not apply when recipient was automatically unsubscribed due to hard bounce or complaints feedback loop. See table in Best Practices for details. (Default = false)
Mandatory - Replace existing groups when set to "true". The system will automatically remove previously subscribed groups and keep only the groups specified in the groupsIDs parameter. (Default = false)
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
No changes on subscription status
Pending become Subscribed
It'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
Except for recipients that were unsubscribed due to hard bounce or complaints feedback loop
Subscribed become Pending
With this configuration the confirmation email is sent to both previously subscribed and previously pending
Unsubscribed become Pending
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
Pending become Unsubscribed
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 NewImportProcesswith 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 StartImportProcessesdo not overwrite the import settings that were specified by each NewImportProcessrequest
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.
Add recipients to a single list (no groups)
In this example values are provided for both listsIDs and listsGUIDs parameters (mandatory fields). There are no groups, so we include an empty groupsIDs tag.
In this example values are provided for both listsIDs and listsGUIDs parameters (mandatory fields). There are multiple groups for this list, so we separate them with a comma in the groupsIDs parameter.
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), so since there are no groups for either list, we include a single semi-colon in the groupsIDs parameter to denote that there are two elements.
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.
Add recipients to multiple lists (multiple groups)
In this example values are provided for both listsIDs and listsGUIDs parameters (mandatory fields). The first list (ID=1) has two groups (22,23), so we use a comma to separate them in the first element. We then use a semi-colon to denote the second element, since the groupsIDs, listsIDs and listsGUIDs parameters must all have the same number of elements
The XML structure for each recipient needs to be consistent for all subscribers, and include empty tags for required values that are empty. When specifying the phone number for a recipient, the structure of your XML must match the mobileInputType parameter, where either the entire phone number is represented in a single attribute, or the prefix and number are represented in separate attributes.
For example, if the mobileInputType parameter is set to 1,use the following XML structure:
<!--Option 1: number and prefix in a single field (use mobileInputType=1)-->
<subscriber email="firstname.lastname@example.org" Prefix="" Number="+0018889624587" Name="">
If the mobileInputType parameter is set to 2, use the following XML structure:
<!--Option 2: number and prefix in separate fields (use mobileInputType=2)-->
<subscriber email="email@example.com" Prefix="+001" Number="8889624587" Name="">
In case you also need to specify personal data fields an example is provided below
Personal data fields shall be specified in progressive order and you shall also include empty fields. It is also recommended to use the same data structure (i.e. the same number of fields for each record, even if some fields are empty) for all subscribers. In case of update of an existing subscriber, the empty fields are handled as "don't change this field" when you specify 1, 2 or 3 as ImportType.
Do not exceed 50 characters for "email" field and 100 characters for "campo" fields (up to 200 characters are allowed if you use only 7-bit ASCII strings)
If you want to update an existing subscriber and clear one or more of its fields you shall use import type with value 4, 5, or 6; in this case any empty field in xmlDoc parameter resets the correspondent field on MailUp console account.
<subscriber email="firstname.lastname@example.org" Prefix="" Number="" Name="">
<campo9>555 Some Street</campo9>
<!-- repeat for each recipient to import -->
You can use 0 and 1 in place of true and false for boolean parameter values.
Unsupported characters in subscribers fields
All field values are handled as strings, character '|' (pipe) is not allowed and may lead to "-402" error codes
Below is a list of the ReturnCode values, and what they mean when an error is encountered.
unrecognized error (it is likely that a mandatory parameter is missing)
xmlDoc is empty
convert xml to csv failed
create new import process failed
can not create confirmation email
listsIDs and listsGUIDs must contain the same number of elements
an import process is already running for the list
an import process is already running for a different list
error checking process status
error starting the process job
The code examples below are provided on an "as is" basis, without any warranty of any kind. MailUp shall not be held liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or other related to the example code. Please contact us if you are interested in submitting examples for programming languages that are not already included below.