Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages

createList method

It is a method to create a new contact list.

It is assumed that each list sets a separate campaign subject. A contact can subscribe to or unsubscribe from a specific campaign subject by checking or unchecking the list on the subscription management page, which is available on the link in the letter. Therefore, it is not a good practice to create a new list for each new campaign.

Each contact list in one UniSender account must have a unique name. If you try to create another list with the same name, an error will be returned.

If you need to change the recipient list before starting the campaign, consider using the importContacts / exportContacts or indicating specific addresses/phone numbers in the createCampaign method.

Principle of use

Syntax and URL to call the method
createList (string title, string before_subscribe_url, string after_subscribe_url)
https://api.unisender.com/en/api/createList?format=json&api_key=KEY&title=NewListName
Arguments
api_key * API access key.
title * List name. It must be unique in your account.

Examples:

title=NewListTitle
title=%D0%9D%D0%BE%D0%B2%D1%8B%D0%B9

(«New» in the UTF-8 format)

before_subscribe_url The URL for redirect to the pre-subscription page. Usually this page shows a message that the contact should follow the confirmation link to activate the subscription. You can add substitution fields to this URL — for example, you can identify a contact by the email address by substituting an email here — or by the contact code in your database by saving the code in an additional field and substituting it into this URL.
after_subscribe_url The URL for redirect to the post-subscription page. Usually this page shows a message that the subscription has been completed successfully. You can add substitution fields to this URL — for example, you can identify a contact by the email address by substituting an email here — or by the contact code in your database by saving the code in an additional field and substituting it into this URL.
Return value
Object with the id field (list code). This id can be used in other methods later on where the contact list id is required.
Example of a successful creation of a new contact list:

{"result":{"id":353358}}

Error example:

{
  "error": "VM161103-01 [List \"Test List\" already exists]",
  "code": "invalid_arg"
}