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

exportContacts method

Вы здесь:

Export of contact data from UniSender. There are various scenarios to use this method:

  • Backup.
    You can download the entire contact database with the information as detailed as possible.
  • Synchronization with data of your server.
    Suppose that you always add new contacts firstly to your server and then to UniSender. The contact can unsubscribe through UniSender, or you can delete it on your server. In order to synchronize, you need to upload only email addresses (or phone numbers) of contacts through exportContacts and check if there are any contacts deleted from your server. Then, using
    importContacts , you import new contacts, change data of the modified ones, and delete those contacts that have been deleted on your server.

For more information about the contact, use the getContact method.

Principle of use

The user sends a request to export contacts

async/exportContacts – contact export request

URL to call the method
https://api.unisender.com/ru/api/async/exportContacts
Arguments
api_key *API access key.
notify_url *The URL to which the response will be sent after the report is generated.
list_idOptional export list code. If it is not specified, all lists will be exported. Codes of the lists can be obtained by calling the getLists method. Warning: if the list is specified, those email addresses that are not included in the list, but contacts have phone numbers included in this list, will be included in the upload result as well.
field_namesAn array of field names to be exported. If absent, then all possible fields are exported. The transfer method using HTTP: field_names[]=1&field_names[]=2. The names of the system fields do not depend on the language, the names of the user fields are taken from the substitution names.
emailEmail address. If this parameter is specified, the result will contain only one contact with such email address.
phonePhone number. If this parameter is specified, the result will contain only one contact with such phone number.
tagTag. If this parameter is specified, the search will take into account only contacts that have such tag.
email_statusEmail address status. If this parameter is specified, the result will contain only one contact with such email address status. The valid values are listed in the list of system fields below:

  • new – new.
  • invited – invitation sent with a subscription confirmation link, waiting for an answer, mailing to this address impossible.
  • active – active address, mailing is possible.
  • inactive – address disabled via web interface, all mailings are impossible, can be again enabled via the web interface.
  • unsubscribed – addressee unsubscribed from all mailings.
  • blocked – address blocked by the administration of our service (for example, on the addressee’s complaint), mailing impossible. Unlocking is possible only at the request of the addressee.
  • activation_requested – requested activation of the address from the administration UniSender, mailing is not yet possible.
phone_statusPhone number status. If this parameter is specified, the result will contain only one contact with such phone number status. The valid values are listed in the list of system fields below:

  • new – new.
  • active – active address, mailing is possible. Phone gets default status.
  • inactive – address disabled via web interface, all mailings are impossible, can be again enabled via the web interface.
  • unsubscribed – addressee unsubscribed from all mailings.
  • blocked – address blocked by the administration of our service (for example, on the addressee’s complaint), mailing impossible. Unlocking is possible only at the request of the addressee.
Return value
JSON object with the following fields:
{
    "result": {
        "task_uuid": "ff719cf2-4ed9-11e9-8647-d663bd873d93",
        "status": "new"
    }
}
task_uuidUnique identifier of the data preparation task.
statusThe status of the task.

The system prepares data

Depending on the number of contacts to export, the file may take some time to prepare. After the export is ready, it will be sent to the URL specified in the notify_url parameter of the async/exportContacts method.

You can also request task status.

Request task status

async/getTaskResult – get task status

URL to call the method
https://api.unisender.com/ru/api/async/getTaskResult
Arguments
api_key *API access key.
task_uuid *ID of the request for the preparation of the report, received when calling the async/exportContacts method.

If the task is still running:

Return value
JSON object with the following fields:
{
    "result": {
        "task_uuid": "ff719cf2-4ed9-11e9-8647-d663bd873d93",
        "task_type": "exportContacts",
        "status": "processing"
    }
}
task_uuidUnique identifier of the data preparation task.
task_typeType o task for preparing data.
The getTaskResult method is universal and suitable for methods that use data preparation. The parameter returns the name of the method by which the task is prepared. In this case, the async/exportContacts method is returned.
statusThe status of the task.

If the task has already been completed:

Return value
JSON object with the following fields:
{
    "result": {
        "task_uuid": "ff719cf2-4ed9-11e9-8647-d663bd873d93",
        "task_type": "exportContacts",
        "status": "completed",
        "file_to_download": "[URL to AWS]"
    }
}
task_uuidUnique identifier of the data preparation task.
task_typeType o task for preparing data.
The getTaskResult method is universal and suitable for methods that use data preparation. The parameter returns the name of the method by which the task is prepared. In this case, the async/exportContacts method is returned.
statusThe status of the task.
file_to_downloadLink to download the file.

The system sends the user a notification with a link to the requested data

After completing the data preparation task, the system sends the Webhook user to the specified URL (notify_url parameter)

 

Sent notification
JSON object with the following fields:
{
    "result": {
        "task_uuid": "ff719cf2-4ed9-11e9-8647-d663bd873d93",
        "task_type": "exportContacts",
        "status": "completed",
        "file_to_download": "[URL to AWS]"
    }
}
task_uuidUnique identifier of the data preparation task.
task_typeType o task for preparing data.
The getTaskResult method is universal and suitable for methods that use data preparation. The parameter returns the name of the method by which the task is prepared. In this case, the async/exportContacts method is returned.
statusThe status of the task.
file_to_downloadLink to download the file.

Examples of forming the URL request

https://api.unisender.com/ru/api/async/exportContacts?api_key=KEY
— contact export request

https://api.unisender.com/ru/api/async/getTaskResult?api_key= KEY
— Request task status