Skill Level: Intermediate
The contact can be added to the Contact List by providing either a Contact ID or the key fields from the database. The Contact ID can be obtained from the RecipientId element in the response of the following operations: AddRecipient, UpdateRecipient, and SelectRecipientData.
If providing key fields and your database is a Restricted database, you must include all unique key columns with their corresponding name-value pairs. If using a Flexible database, one or more columns must be specified in order to look up the contact.
Upon looking up the contact in the database by the Contact ID or key fields, Watson Campaign Automation processes the contact as follows:
- If the contact is found and does not yet exist in the Contact List, they are added.
- If the contact is found and exists in the Contact List, they are not added.
- If more than one contact is found matching the Sync Fields for a Flexible list, an error message is returned.
- If the contact is not found, an error message is returned.
Syntax of the request and response XML for AddContactToContactList
Operation <AddContactToContactList> Elements CONTACT_LIST_ID The ID of the Contact List to which you are adding the contact. ¬† CONTACT_ID Optional The ID of the contact that is to be added to the Contact List. Either a CONTACT_ID or COLUMN elements must be provided. If CONTACT_ID is provided, any COLUMN elements are ignored. ¬† COLUMN Optional Required if the database is Restricted (Non-Email Keyed) or Flexible and Contact ID is not provided. XML nodes defining the column name and value that is used to look up a contact in a database. Ignored for Restricted (Email Keyed) databases.Note: Unique key columns must be part of the submission with column names and values. ¬† Child Element NAME Contains the field name. Example with Contact Id
<Envelope> <Body> <AddContactToContactList> <CONTACT_LIST_ID>85628</CONTACT_LIST_ID> <CONTACT_ID>15674222</CONTACT_ID> </AddContactToContactList> </Body> </Envelope>
Example with COLUMN elements
<Envelope> <Body> <AddContactToContactList> <CONTACT_LIST_ID>85628</CONTACT_LIST_ID> <COLUMN> <NAME>CustomerId</NAME> <VALUE>123-45-6789</VALUE> </COLUMN> <COLUMN> <NAME>First_Name</NAME> <VALUE>Joe</VALUE> </COLUMN> <COLUMN> <NAME>Last_Name</NAME> <VALUE>Smith</VALUE> </COLUMN> </AddContactToContactList> </Body> </Envelope>
Response <RESULT> Elements SUCCESS True if successful. Example
<Envelope> <Body> <RESULT> <SUCCESS>TRUE</SUCCESS> </RESULT> </Body> </Envelope>