Skip to content

poggenpower/nextcloud-address-book-integration-poc

Repository files navigation

Nextcloud Address Book Integration

This project is a proof of concept for integrating and synchronizing contact information between Nextcloud address books and a local CSV file. The script fetches contacts from Nextcloud, merges the data to a CSV file with mobile phone numbers and other details, and saves the updated CSV file. It also writes the Birthday read from the local CSV back to the CALDAV server.

Features

  • Fetch contacts from Nextcloud address books.
  • Normalize German strings to handle special characters.
  • Format phone numbers in a standardized format.
  • Writes local CSV file with contact details from Nextcloud.
  • Handle birthdays and other contact notes.

Prerequisites

  • Python 3.x
  • Nextcloud instance with CardDAV enabled
  • Required Python packages (listed in requirements.txt)

Installation

  1. Clone the repository:

    git clone https://github.com/poggenpower/nextcloud-address-book-integration-poc.git
    cd nextcloud-address-book-integration-poc
  2. Install the required Python packages:

    pip install -r requirements.txt
  3. Configure the script by creating a config.toml file based on the provided config-example.toml:

    this is optional, you can specify each parameter on the CLI too, or use a mixture of both.

    csv_file = "address-data-clean.csv"  # Replace with your CSV file path
    output_file = "output.csv"  # Replace with desired output CSV file path
    changes_file = "changes.csv"  # Replace with desired changes CSV file path
    nextcloud_url = "https://your.nextcloud.instance.com"
    username = "your_nextcloud_username"
    password = "your_nextcloud_password"
    group_name = "Test"  # Optional
    address_book_names = ["Contacts", "Other Contacts"]

Usage

  1. Run the script:

    python merge.py --csv_file address-data-clean.csv --vcf_file 2025-01-31_14-10_Abi95.vcf --output_file output.csv --changes_file changes.csv --nextcloud_url https://your.nextcloud.instance.com --username your_nextcloud_username --password your_nextcloud_password --address_book_names Personal Business

    --config allow to specify the path to a config file. use --help to get some details about the parameters.

  2. The script will:

    • Discover address books in your Nextcloud instance.
    • Fetch contacts from the specified address books.
    • Update the local CSV file with contact details from Nextcloud.
    • Save the updated CSV file to the specified output path.
    • send updates for changed vcards (birthday) to the CARDDAV server.

Notes

  • This project is a proof of concept and may require further enhancements for production use.
  • Ensure that your Nextcloud instance has CardDAV enabled and that you have the necessary permissions to access the address books.
  • CSV Columnames are hard codes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

Contact

For any questions or suggestions, please open an issue.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages