Guides

Contact lifecycle

Contacts belong to your account, not to a mailing list. Each contact has a state, such as active or deleted, and a separate membership on each list it joins. A contact that leaves a list is not deleted, and creating a contact with the address of a deleted one does not give you a new contact.

Contact states

StateWhat it means
ActiveGets mail from the lists it is a member of.
UnconfirmedWaits for double opt-in. Gets no mail from lists, and is not counted as a list member.
DeletedHas left all its lists, but keeps its properties and can be restored.
PseudonymizedDeleted by the daily cleanup. Its email address is replaced with a hash, and its SMS number and properties are removed.
ForgottenIts personal data was erased on request. Cannot be restored.

getRecipient and getDeletedRecipient show the state in the recipient fields. enabled is true only for active and unconfirmed contacts, confirmed is false for an unconfirmed contact, and forgotten is true for a forgotten one. A pseudonymized or forgotten contact has a hash as its email.

A contact becomes confirmed when you call confirmRecipient, when you add it to a list with joinMailingList without noauto, when you create it with autoconfirm, or when a list import adds it.

membership in the getRecipient response shows the lists the contact is on or has been on, with the list ID and name, the join time and the unsubscribe time. A contact that has left a list has an unsubscribe time for it, and stays active on its other lists.

Daily cleanup

Once a day, LianaMailer deletes and pseudonymizes active contacts that have not been on any mailing list for over a week. Contacts that were in a delivery other than an event or welcome mail during the past week are kept. To keep the contacts you create, add them to a list, for example with createAndJoinRecipient.

Leaving a list or deleting

removeRecipientFromMailingListdeleteRecipientforgetRecipient
ContactStays activeDeleted and unconfirmedForgotten
ListsLeaves one list, or all with list_id 0Leaves all listsLeaves all lists
PropertiesKeptKeptErased
ConsentsKeptRevokedErased
UndojoinMailingListRestore it, then rejoin listsNot possible

quitMailingList is deprecated. It removes a contact only from a list it has a membership on. Use removeRecipientFromMailingList instead.

When a contact leaves a list, including when it is deleted, LianaMailer saves the time and the reason. getUnsubscriptions returns them, even for contacts that have since rejoined the list.

Restoring a deleted contact

enableRecipient and reactivateRecipient both set enabled back to true and keep the contact's ID and properties. Neither restores its list memberships, or the consents that were revoked when it was deleted. getDeletedRecipient shows the lists the contact left in membership. Add it back to them with joinMailingList.

enableRecipientreactivateRecipient
Finds the contact byIDEmail address or SMS number, in email
ConfirmationAlways confirmedConfirmed with confirm, otherwise given a confirmation code
Address blocked after bouncesRemoves the block and restores the contactReturns an error
Active contactReturns an errorConfirms it, or gives it a confirmation code
Pseudonymized contactReturns 0Restores it with the same ID, unconfirmed and without its old properties
Forgotten contactReturns 0Returns an error

Use enableRecipient to undo a deletion you made yourself, and reactivateRecipient when the person subscribes again. Without confirm, a reactivated contact gets no mail from lists until it is confirmed, for example through a confirmation email.

Creating or importing a contact again

createRecipient, createAndJoinRecipient and the list imports look for an existing contact with the same email address or SMS number. What they do depends on its state:

Existing contactcreateRecipientcreateAndJoinRecipientList import
ActiveErrorUpdates it and adds it to the listsUpdated and added
Active, has left the listErrorUpdates it and adds it back to the listSkipped
DeletedErrorReturns false, nothing changesSkipped
PseudonymizedRestored with its old IDRestored with its old IDRestored with its old ID
ForgottenNew contact with a new IDNew contact with a new IDSkipped

Pseudonymized and forgotten contacts are recognized by their email address.

The v1 and v2 imports behave the same way, and also skip addresses that were deleted because mail to them bounced. In getImportLog, skipped contacts that had left the list or were deleted count as Unsubscribed, and bounced and forgotten addresses as Deleted. Truncating the list does not change this, because it removes only active members. See Importing contacts.

Adding a contact to a list it has left, with joinMailingList or createAndJoinRecipient, subscribes it again. Do this only when the person has asked for it.

Finding a contact in any state

EndpointFindsReturns
getRecipientAn active contact by IDAn error for other contacts
getDeletedRecipientA deleted contact by IDAn error for an active contact
getShadowRecipientAny contact by IDThe contact, with enabled
getDeletedRecipientsAll deleted contacts, pagedForgotten and pseudonymized ones included
isEnabledRecipientA contact by ID, email or SMS1 if it is active
getRecipientsStatusByEmailMany email addresses0 active, 1 deleted, 2 no contact
existsRecipientA contact by email or SMSIts ID, also of a deleted contact

getRecipientByEmail returns deleted contacts too if you set include_deleted. Forgotten and pseudonymized contacts can no longer be found by their old email address or SMS number, only by their ID.

GDPR requests

  1. Export the contact's data

    For a data access request, call getRecipientDatafile. It returns a Base64-encoded XLS file, or a zipped JSON file, with the contact's email address and SMS number, consents, received mails, opens, clicks and logged events, and the properties you list by handle in options.properties. It works for deleted contacts too.

  2. Forget the contact

    For an erasure request, call forgetRecipient with the contact's ID, or forgetRecipientByEmail or forgetRecipientBySMS. They find deleted contacts too. The contact is deleted and leaves its lists. Its properties, SMS number, consents and logged events are removed, and its email address is replaced with a hash. You cannot undo this, so export the data first if you need it.

Last modified on