Contacts¶
-
class
dotmailer.contacts.
Contact
(**kwargs)¶ This class represents a DotMailer contact. To be able to create a contact, you must specify the email of the contact.
Required keyword arguments
email - A string containing the email address of the contact that you wish to add.
Optional keywoard arguments
opt_in_type - A string which represents the type of optin that the contact performed. You can either specify these values by hand or use the pre-defined constant values.
Constants
.CONTACT_OPTINTYPE_UNKNOWNConstants
.CONTACT_OPTINTYPE_SINGLEConstants
.CONTACT_OPTINTYPE_DOUBLEConstants
.CONTACT_OPTINTYPE_VERIFIEDDOUBLE
email_type - A string representing the type of email that the contact would prefer to receive. This can be either plain text or HTML. Alternatively use the constant values.
Constants
.CONTACT_EMAILTYPE_HTMLConstants
.CONTACT_EMAILTYPE_PLAIN
data_fields - A dictionary of values which any data fields and value that should be associated with the contact e.g
{ 'FavouriteColour': 'Red', 'age': 23 }
-
add_to_address_book
(address_book)¶ Adds a contact to a specific address book
Parameters: address_book – This should be an instance of AddressBook
Returns:
-
classmethod
bulk_create
(filedata)¶ Bulk creates, or bulk updates, contacts.
This function allows you to upload a bulk number of contacts to the server. The contact data must be in either a CSV or Excel format, and it must include one column that is called ‘Email’ or equivalent if your account is using a language other than English. All other columns will be mapped to your custom contact data fields.
Currently DotMailer place a file upload limit of 10MB. If your data is larger than this then you will need to split it into small chunks.
The API will return an ID for the import, and the current status. You can re-query the import status later, by using the unique ID value.
Parameters: filedata – Either a file or filepath which can be read from Returns:
-
classmethod
bulk_create_in_address_book
(address_book, filedata)¶ Bulk creates, or bulk updates, contacts in an address book.
Similar to the bulk create verions, this function can be used to create a bulk number of contacts in one go. However, this version will also automatically associate the contact with the address book that has been specified. The contact data must be in either a CSV or Excel format, and it must include one column that is called ‘Email’ or equivalent if your account is using a language other than English. All other columns will be mapped to your custom contact data fields.
Currently DotMailer place a file upload limit of 10MB. If your data is larger than this then you will need to split it into small chunks.
The API will return an ID for the import, and the current status. You can re-query the import status later, by using the unique ID value.
Parameters: - address_book –
- filedata –
Returns:
-
create
()¶ Creates a contact
Returns:
-
static
delete_all_from_address_book
(address_book)¶ Deletes all contacts from a given address book
Parameters: address_book – Returns:
-
delete_from_address_book
(address_book)¶ Deletes a contact from a given address book
Parameters: address_book – Returns:
-
static
delete_multiple_from_address_book
(id_list, address_book)¶ Deletes multiple contacts from an address book
Parameters: - id_list –
- address_book –
Returns:
-
get_address_books
(select=1000, skip=0)¶ Gets any address books that a contact is in
Parameters: - select –
- skip –
Returns:
-
get_all_address_books
()¶ Automatically performs all requests needed to return every possible address book that this contact is associated with.
Returns:
-
classmethod
get_all_contacts_since
(date, with_full_data=True)¶ Get all the contacts that have been created since a specific date.
This function will automatically handle making all the calls required to get a complete list i.e. if there are more than 1000 contacts since the specified date.
Parameters: - date –
- with_full_data –
Returns:
-
classmethod
get_all_scoring
()¶ Returns:
-
classmethod
get_by_email
(email)¶ Gets a contact by email address
Parameters: email – Returns:
-
classmethod
get_by_id
(id)¶ Gets a contact by ID
Parameters: id – Returns:
-
classmethod
get_contact_import_report
(id)¶ Gets a report with statistics about what was successfully imported, and what was unable to be imported.
Parameters: id – Returns:
-
classmethod
get_contact_import_report_faults
(id)¶ Gets a report with statistics about what was successfully imported, and what was unable to be imported.
Parameters: id – Returns:
-
classmethod
get_contact_import_status
(id)¶ Gets the import status of a previously started contact import.
Parameters: id – The bulk upload ID value returned when you submitted a bulk upload request. The ID is a GUID and should look similar to 842d81e8-c619-457f-bb77-ab6c4a17da39. Returns: A dictionary that contains an the keys ‘id’ and ‘status’.
-
classmethod
get_contacts_since
(date, with_full_data=True, select=1000, skip=0)¶ Gets a list of created contacts after a specified date
Parameters: - date –
- with_full_data –
- select –
- skip –
Returns:
-
classmethod
get_multiple
(select=1000, skip=0)¶ Gets a list of all contacts in the account
Parameters: - select –
- skip –
Returns:
-
classmethod
get_score_by_email
(email)¶ Gets contact scoring for a contact by email address
Parameters: email – Returns:
-
classmethod
get_score_by_id
(id)¶ Gets contact scoring for a contact by ID
Parameters: id – Returns:
-
classmethod
get_scoring
(select, skip)¶ Parameters: - select –
- skip –
Returns:
-
classmethod
get_scoring_in_address_book
(address_book, select, skip)¶ Gets contact scoring for contacts within a specific address book or segment
Parameters: - address_book –
- select –
- skip –
Returns:
-
classmethod
unsubscribe
(email)¶ Unsubscribes contact from account
Parameters: email – Returns:
-
update
()¶ Updates an existing contact’s data. Unlike the DotMailer’s API you currently can NOT create a contact using the update value and assigning an ID value of zero. If you need to create a contact then please use the create method.
Returns: