User be advised.
The following software is still under active development and is not meant for use in a production environment. The developer of this product will not take any responsibility for damagers incurred from this tool. Use at your own risk.
Currently, only Google contacts is supported, but we plan on supporting more in the future.
- NodeJS v20
- GCP project with the People API enabled
This program has only been tested on MacOS Ventura 13.1. It should however, work on other systems with the correct NodeJS version.
Prerequisites
- A Google Account
- A Google Cloud Platform project (If you don't have one, you'll be guided to create one)
Steps
-
Enable the People API
- Navigate to the Google Cloud Console: https://console.cloud.google.com/
- Select your GCP project from the dropdown at the top.
- In the search bar, type "People API" and select it from the results.
- Click the "Enable" button.
-
Configure the OAuth Consent Screen
- In the Google Cloud Console, go to APIs & Services -> OAuth Consent Screen.
- Select the appropriate user type (Internal or External).
- Fill out the required app information.
-
Add Scopes
- In the "Scopes" section, click "Add or Remove Scopes".
- Search for
auth/contacts
and select it (and optionallyauth/contacts.readonly
). - Click "Update"
-
Obtain Credentials
- Go to APIs & Services -> Credentials.
- Click "Create credentials" and select "OAuth client ID".
- Choose
Desktop app
as the application type. - Click "Create" and store your client ID and client secret securely.
Important Notes:
- Verification: Apps using sensitive scopes might need verification.
- Scope Best Practices: Request only the minimum necessary scopes.
Code Example (Illustrative: Choose a language)
- Install the packages.
# npm
npm install
# yarn
yarn
- Make a copy of
.env.example
and set the environment variables specific to your GCP project. You will find these values in the credentials file that you obtained from theSetting up the GCP project
step.
Since this program is not a proper package yet, it is necessary to run commands from the project root. If for some reason, the program fails, please make sure that the following folders exist:
.tokens
, for storing user auth tokensoutput
which is the default location for storing results, if applicable
Please make sure to keep the contents of the .token
file secure.
Here are is a list of the most useful commands to get you started with the tool. Please note that most of these commands support additional arguments, but they have not been documented as they are either not implemented in their entiretey, or are undergoing testing.
This document will be updated as changes are made to the commands.
Note that this will only fetch contacts from the main contact list. Contacts
from the Other
or Directory
contact groups will not be returned.
node bin/index.js contacts export -a test@gmail.com
node bin/index.js contacts import -d desitnation@gmail.com -f <path to file>
node bin/index.js contact-groups list -a test@gmail.com
For saving to a file
node bin/index.js contact-groups list -a test@gmail.com -o <path to output file>
Please note that if the directory does not exist, the program will create the directory for you. If a file with the same name exists, the program will overwrite the file.
This command will remove all urls from the contacts of a specific account. The
--urls
flag is required to indicate that urls should be removed. You need to
pass in the --url-type
flag to indicate the type of url to remove.
node bin/index.js contacts clean --urls --url-type "Dex Contact Details" -f <path to file> -a test@gmail.com
If a file is not provided, the data will be fetched from the account. This may be useful when the data on the local file is outdated.
node bin/index.js contacts clean --urls --url-type "Dex Contact Details" -a test@gmail.com
Not implemented yet.
- Create npm package
- Introduce semver and release cycles
- Logging
- Support more services such as Apple contacts and Microsoft contacts
- Graciously handle daily limits
- Create more efficient batching for handling failed batches
- Introduce back-off when adding contacts one-by-one
- Implement better error-handling
- Implement unit tests
- Create routines for periodic contact backups