merge-contacts.js
Uses the Front POST /contacts/merge
API endpoint see docs to merge multiple contacts into a single contact record.
Installation
- Save the
merge-contacts.js
file to your local machine. - Navigate to the directory you saved it.
- Run
npm install axios
to install the Axios HTTP client - Edit the
merge-contacts.js
file to save your Front API token - Edit the
merge-contacts.js
file to save your list of contacts to merge. - When setup is complete, run
node merge-contacts.js
to execute the file. Progress will be printed to your terminal in real-time.
You should save the contacts as an array of arrays, with the primary contact listed first in each array.
Using the example provided in the code;
const emailArrays = [
['[email protected]', '[email protected]', '[email protected]'],
['[email protected]', '[email protected]'],
['[email protected]', '[email protected]'],
]
For the first record, handles '[email protected]'
and '[email protected]'
will be merged into the '[email protected]'
contact record.