Giter Club home page Giter Club logo

cetninarius / google-contacts-to-obsidian Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 13 KB

This Python script enables the download of Google contacts using the Google People API and converts each contact into a .md file format. This is particularly useful for visualizing your connections in tools like Obsidian, where you can create graphs displaying relationships between people.

License: Other

Python 100.00%
connections contacts contacts-manager google-contacts graph obsidian obsidian-md prm

google-contacts-to-obsidian's Introduction

Google Contacts to Obsidian Graph

This Python script enables the download of Google contacts using the Google People API and converts each contact into a .md file format. This is particularly useful for visualizing your connections in tools like Obsidian, where you can create graphs displaying relationships between people. Alongside the script, a .md template is included that you can customize to suit your needs.

Usage

  1. Obtain an API key from the Google API console
  2. Install the required Python libraries
  3. Run the script to download contacts in .md format
  4. Open the generated vault with Obsidian

1. API Key (Google Client Setup)

The first step to using the script is getting set up with Google credentials that the application case use.

  • Create Google Cloud Project
  • Activate Google People API
  • Configure OAUTH Screen
    • Applcation should be external
    • Define scopes
      • .../auth/userinfo.profile
      • .../auth/contacts.readonly
      • .../auth/contacts.other.readonly
      • .../auth/directory.readonly
  • Add Test users as needed
  • Go to the Credentials screen of the project and create a OAuth Client ID using the Create Credentials dropdown. Choose Desktop App as type
  • Under 'Client seecrets' click on the Download JSON button, rename the file to 'credentials.json' and place it in the same folder with the script

2. Required Libraries

All required libraries for this script are listed in requirements.txt file.

3. Running the script

When you run the script, it will open your browser to complete OAuth2 authentication, accept everything, and once you've logged in, the download process will begin.

Note: Download limit is 2000 contacts!

4. Obsidian vault

After the download is finished all your contact files will be located in the /vault/ folder, witch you can easily open with the Obsidian app.

Note: For automatic graph connections in Obsidian, you should configure your contacts to have a 'Related person' field, that contains a connections name in format: '[givenName] [familyName]'. Also i highly encourage using #tags in notes field of your contacts, since all objects containing the same #tag will be also connected

Images

Graph view 1

Graph view 2

.md Template

A basic t_person.md template is included, but feel free to adapt or add new templates as per your requirements.

The script is compatible with Jinja templates.

Template fields

The object that's being used to fill out the templates is 'repo', so you can use:

{{ repo.organizations[0].title }} # to get the job title
{{ repo.organizations[0].name }}  # to get the company

Also, you can iterate through objects, e.g. one person having multiple phone numbers, also you can choose to skipp a section if a person doesn't have a phone number

{% if repo.phoneNumbers %}
Phones:
{% for phone in repo.phoneNumbers %}
    {% if phone.type %} {{phone.type}} | {% endif %}{{phone.value}}
{% endfor %}
{% endif %}

Example of a repo object with all properties can be found in repo_example.json

List of personFields used by this script:

  • names
  • emailAddresses
  • organizations
  • phoneNumbers
  • biographies
  • relations
  • birthdays
  • events
  • addresses

For the complete list of template fields please reffer to People API

Note

It's crucial to follow the instructions for setting up the API key and ensure proper permissions before running the script.

This project is under development, so feel free to contribute and report issues or suggestions.

Enjoy connecting and visualizing your network!

google-contacts-to-obsidian's People

Contributors

cetninarius avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.