LianaMailer REST API

Confirmation

Server

With double opt-in, a new contact confirms their email address by clicking a link in a confirmation email. Send confirmation and welcome emails, confirm contacts directly, and add tasks that run when a contact confirms.


Get confirmation code

POST
https://rest.lianamailer.com/api
/v1/getRecipientCode

Returns the confirmation code of an unconfirmed contact. Returns an error if the contact is already confirmed.

If the contact has no code, create one with setRecipientNeedConfirmation.

Get confirmation code › Request Body

id
​RecipientId · required

Contact ID.

Example: 20000

Get confirmation code › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​RecipientConfirmCode

Contact confirmation code.

Example: bdeCyBcrkf

Create confirmation code

POST
https://rest.lianamailer.com/api
/v1/setRecipientNeedConfirmation

Creates a confirmation code for the contact and returns it. If the contact already has a code, that code is returned.

No email is sent. Confirm the contact with confirmRecipient.

Create confirmation code › Request Body

id
​RecipientId · required

Contact ID.

Example: 20000

Create confirmation code › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​RecipientConfirmCode

Contact confirmation code.

Example: bdeCyBcrkf

Confirm contact

POST
https://rest.lianamailer.com/api
/v1/confirmRecipient

Confirms the contact who has the given confirmation code and returns the contact ID, or 0 if the code is not found. A code can be used only once.

Actions that were waiting for the confirmation, such as list joins and consents given on a subscription page, are completed.

Confirm contact › Request Body

code
​RecipientConfirmCode · required

Contact confirmation code.

Example: bdeCyBcrkf

Free-text reason for the confirmation.

Example: Example reason.

Origin of the confirmation, e.g. the subscription page URL.

Example: example.com/subscription

Confirm contact › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​RecipientId

Contact ID.

Example: 20000

Send confirmation email

POST
https://rest.lianamailer.com/api
/v1/sendRecipientConfirmationEmail

Sends an email with the given content to a contact, to ask them to confirm their subscription.

Works only if your account requires new contacts to confirm. Otherwise, the error Recipient doesn't need confirmation is returned. The email is sent whether or not the contact has already confirmed, so send it only to contacts that have not.

Send confirmation email › Request Body

recipient_id
​RecipientId · required

Contact ID.

Example: 20000
​ConfirmationMsg · required

Send confirmation email › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​integer

Returns 1 on success.

Example: 1

Send welcome message

POST
https://rest.lianamailer.com/api
/v1/sendWelcomeMail

Sends the welcome message of the given site to a contact. The welcome message is set with setWelcomeDelivery, and an error is returned if the site has none.

With force set to 0, nothing is sent and 0 is returned if the contact has already received any mail.

Send welcome message › Request Body

recipient_id
​RecipientId · required

Contact ID.

Example: 20000
site_name
​Site · required

Domain name of the subscription site.

Example: site-domain
force
​WelcomeSendForce

Set to 0 to skip sending if the contact has already received any mail. Defaults to 1.

Example: 0
props
​WelcomeProperties

Property values for the message, as name-value pairs.

Example: {"property_name":"property value"}

Send welcome message › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​integer

Returns 1 on success.

Example: 1

Add confirmation task

POST
https://rest.lianamailer.com/api
/v1/addConfirmationTask

Adds a task to be run when the contact confirms: when the confirmation link in the welcome message is clicked or when confirmRecipient is called. Get the contact's confirmation code with getRecipientCode. Tasks are removed after 7 days, so a later confirmation does not run them.

Add confirmation task › Request Body

member_id
​RecipientId · required

Contact ID.

Example: 20000
confirmation_code
​RecipientConfirmCode · required

Contact confirmation code.

Example: bdeCyBcrkf
task_type
​ConfirmationTaskType · enum · required

Confirmation task type: consent adds a consent, membership joins a mailing list and properties sets contact properties.

Enum values:
consent
membership
properties
Example: membership
​ConfirmationTask · required

Task data, applied when the contact confirms. Required keys depend on the task type.

Add confirmation task › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​integer

Returns 1 on success.

Example: 1

Add confirmation tasks

POST
https://rest.lianamailer.com/api
/v1/addConfirmationTasks

Adds several tasks to be run when the contact confirms: when the confirmation link in the welcome message is clicked or when confirmRecipient is called. Works like addConfirmationTask, with the task type given in each task. The tasks are added one by one, so if one fails, the tasks before it are still saved.

Add confirmation tasks › Request Body

member_id
​RecipientId · required

Contact ID.

Example: 20000
confirmation_code
​RecipientConfirmCode · required

Contact confirmation code.

Example: bdeCyBcrkf
​object[] · required

Add confirmation tasks › Responses

OK

succeed
​boolean

Response status.

Example: true
result
​string | null

Returns null.

Example: null

Get confirmation tasks

POST
https://rest.lianamailer.com/api
/v1/getConfirmationTasks

Returns the tasks added with addConfirmationTask or addConfirmationTasks for a confirmation code. Returns an empty array if there are no tasks for the code.

Get confirmation tasks › Request Body

confirmation_code
​RecipientConfirmCode · required

Contact confirmation code.

Example: bdeCyBcrkf

Get confirmation tasks › Responses

OK

succeed
​boolean

Response status.

Example: true