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 = [
['Marge.Hickle@example.com', 'Marge.Hickle@example.net', 'MHickle@example.net'],
['Bridie.Christiansen@example.com', 'Bridie.Christiansen@example.net'],
['Birdie.Schiller@example.com', 'Birdie.Schiller@example.net'],
]
For the first record, handles 'Marge.Hickle@example.net'
and 'MHickle@example.net'
will be merged into the 'Marge.Hickle@example.com'
contact record.