exportContacts method

Export of contact data from Selzy. 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 Selzy. The contact can unsubscribe through Selzy, 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.selzy.com/en/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_id Optional 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_names An array of system and user field names that need to be exported. If absent, then all possible fields are exported. The transfer method using HTTP: field_names[]=1&field_names[]=2.

Available system fields:

  • id
  • email
  • email_status
  • email_availability
  • email_add_time
  • email_request_ip
  • email_confirm_time
  • email_confirm_ip
  • email_list_ids
  • email_subscribe_times
  • email_unsubscribed_list_ids
  • email_last_delivered_at
  • email_last_read_at
  • email_last_clicked_at
  • phone
  • phone_status
  • phone_availability
  • phone_add_time
  • phone_request_ip
  • phone_list_ids
  • phone_subscribe_times
  • phone_unsubscribed_list_ids
  • tags

The names of the system fields do not depend on the language.

Available user fields can be obtained using getFields method from the name field.

email Email address. If this parameter is specified, the result will contain only one contact with such email address.
phone Phone number. If this parameter is specified, the result will contain only one contact with such phone number.
tag Tag. If this parameter is specified, the search will take into account only contacts that have such tag.
email_status Email 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 Selzy, mailing is not yet possible.
phone_status Phone 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_uuid Unique identifier of the data preparation task.
status The 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.selzy.com/en/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_uuid Unique identifier of the data preparation task.
task_type Type 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.
status The 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_uuid Unique identifier of the data preparation task.
task_type Type 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.
status The status of the task.
file_to_download Link 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_uuid Unique identifier of the data preparation task.
task_type Type 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.
status The status of the task.
file_to_download Link to download the file.

Examples of forming the URL request

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

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

Did we answer to your question?

1
0