Skip to content

automatically uploads books purchased on Kindle to Booklog.

License

Notifications You must be signed in to change notification settings

ega4432/kindle-booklog-sync

Repository files navigation

Kindle Booklog Sync

Caution

The email sent by Amazon when we purchasing a book has been changed and does not work properly.

clasp Node version GitHub release (latest by date) GitHub Lint Deployment

English Japanese

A program that automatically uploads books purchased on Kindle to Booklog.

image

Features

  • Login to Booklog
  • Search your Gmail inbox
  • Get asin code from email body
  • Upload new book to booklog using asin
  • Leave a log on the spreadsheet
  • Archive uploaded book notification emails

Environments

$ node --version
v14.16.1

$ yarn --version
1.22.10

$ clasp --version
2.3.1

Setup

Installation

# If you haven't installed it yet, do the following
$ npm install -g @google/clasp

$ git clone [email protected]:ega4432/kindle-booklog-sync.git

$ yarn

Dependencies

  • Google Account
    • Apps Script
    • Gmail
    • Spreadsheet
  • Booklog Account

Usage

# Auth
$ clasp login

# Create project
$ clasp create --title "kindle-booklog-sync" \
    --type sheets \
    --rootDir ./src

# Deploy
$ yarn push

Tips

# Lint
$ yarn lint

# In development
$ yarn watch

Deployment

Preparation is required before deployment. Please register the following in the secret.

If you have been authenticated using the command line ( e.g. clasp login ), there should have generated ~/.clasprc.json. Please refer to it and complete the registration.

$ cat ~/.clasprc.json | jq .
{
  "token": {
    "access_token": "XXXXXXXXXXXXXXXXXXX",
    "scope": "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/script.webapp.deploy openid https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/service.management https://www.googleapis.com/auth/logging.read https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/script.deployments https://www.googleapis.com/auth/drive.metadata.readonly",
    "token_type": "Bearer",
    "id_token": "XXXXXXXXXXXXXXXX",
    "expiry_date": 1234567890,
    "refresh_token": "AAAAAAAAAAAAABBBBBBBBBBBCCCCCCCCCCCCCCCCCDDDDDDDDDDDDEEEEEEEEEEEEEFFFFFFFFFFFFFGGGGGGGGGGGGGGGHHHHHHHHHH"
  },
  "oauth2ClientSettings": {
    "clientId": "1111111111-abcdefghijklmn22222222222.apps.googleusercontent.com",
    "clientSecret": "abcdefghijklmn",
    "redirectUri": "http://localhost"
  },
  "isLocalCreds": false
}

You can go to that page with Your Repository TOP > Settings > Secrets.

The final result will be the attached image below.

Deployment is triggered by tags in GitHub Actions. See deploy.yml for more details. Please type the tag starting with the prefix "v".