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
| State | What it means |
|---|---|
| Active | Gets mail from the lists it is a member of. |
| Unconfirmed | Waits for double opt-in. Gets no mail from lists, and is not counted as a list member. |
| Deleted | Has left all its lists, but keeps its properties and can be restored. |
| Pseudonymized | Deleted by the daily cleanup. Its email address is replaced with a hash, and its SMS number and properties are removed. |
| Forgotten | Its 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
removeRecipientFromMailingList | deleteRecipient | forgetRecipient | |
|---|---|---|---|
| Contact | Stays active | Deleted and unconfirmed | Forgotten |
| Lists | Leaves one list, or all with list_id 0 | Leaves all lists | Leaves all lists |
| Properties | Kept | Kept | Erased |
| Consents | Kept | Revoked | Erased |
| Undo | joinMailingList | Restore it, then rejoin lists | Not 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.
enableRecipient | reactivateRecipient | |
|---|---|---|
| Finds the contact by | ID | Email address or SMS number, in email |
| Confirmation | Always confirmed | Confirmed with confirm, otherwise given a confirmation code |
| Address blocked after bounces | Removes the block and restores the contact | Returns an error |
| Active contact | Returns an error | Confirms it, or gives it a confirmation code |
| Pseudonymized contact | Returns 0 | Restores it with the same ID, unconfirmed and without its old properties |
| Forgotten contact | Returns 0 | Returns 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 contact | createRecipient | createAndJoinRecipient | List import |
|---|---|---|---|
| Active | Error | Updates it and adds it to the lists | Updated and added |
| Active, has left the list | Error | Updates it and adds it back to the list | Skipped |
| Deleted | Error | Returns false, nothing changes | Skipped |
| Pseudonymized | Restored with its old ID | Restored with its old ID | Restored with its old ID |
| Forgotten | New contact with a new ID | New contact with a new ID | Skipped |
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
| Endpoint | Finds | Returns |
|---|---|---|
getRecipient | An active contact by ID | An error for other contacts |
getDeletedRecipient | A deleted contact by ID | An error for an active contact |
getShadowRecipient | Any contact by ID | The contact, with enabled |
getDeletedRecipients | All deleted contacts, paged | Forgotten and pseudonymized ones included |
isEnabledRecipient | A contact by ID, email or SMS | 1 if it is active |
getRecipientsStatusByEmail | Many email addresses | 0 active, 1 deleted, 2 no contact |
existsRecipient | A contact by email or SMS | Its 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
-
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 inoptions.properties. It works for deleted contacts too. -
Forget the contact
For an erasure request, call
forgetRecipientwith the contact's ID, orforgetRecipientByEmailorforgetRecipientBySMS. 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.