Home > Technical Support > Tips & Tricks > How to import contacts from csv

How to import contacts from csv

Although we don't offer this function as part of the LiveAgent application, an example script capable of importing contacts from csv file to LiveAgent via API v3 is attached below this article.

Your csv file must contain column headers on the first line. You then use those column names in keys of variable COLUMNS.

Configure the script in the first section

/***************** CONFIGURATION START *****************/
// agent panel -> settings -> system -> API
const APIKEY = 'test';

// e.g. https://test.ladesk.com/api/v3
const API_URL = '';

// e.g. ./data.csv
const FILE_PATH = './contacts.csv';

// Col1;Col2;Col3;
const DELIMITER = ';';

// csv column name => api column name
// columns which is not mentioned will be ignored
// HACK_1: 'csv_column' => 'name'
//   it will devide name into firstname and lastname
//   'aaa bbb ccc' will be firstname => 'aaa', lastname => 'bbb ccc'
// HACK_2: 'csv_column' => 'company_name'
//   it will try to add contact into company if company already exists
//   if company doesn't exist, it will create that company
const COLUMNS = array(
    'Company fullname' => 'company_name',
    'User name' => 'firstname',
    'User Phone' => 'phones',
    'User E-mail' => 'emails',
/***************** CONFIGURATION END *******************/

and execute it on command line.

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us


+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2020 LiveAgent.com, All rights reserved