Small app that checks your Gmail for new Rocketbook emails and sends the attached pdf/jpeg to a specified Github repo and deletes the email.
I initially created this because I was using Obsidian as my notetaking app with its plugin for git integration, making a setup like this the easiest way to get my Rocketbook notes to Obsidian. I still use Obsidian but have swapped Rocketbook for an iPad with the Apple Pencil so I no longer need this utility, however it is a pretty simple application, so as long either Github or Google haven't changed their APIs this should still work.
-
Create a Personal access token and give it
repo
access, making note of the generated token. -
Signup to Heroku if you don't already have an account and deploy the app using the button bellow:
-
At deployment chose a name for your application and set the appropriate configurations. Note: The PASSWORD variable is only required to access the webpage where you can upload Google API Credentials and look at info logs on the app.
-
Open the app. After login (with the password you provided) you will be taken to the index page, make note of the
redirect uri
provided and click on the Google API link. -
Once in the Google Cloud Platform click on
Select a project
as shown in image bellow and create a new project. -
After creating the project and selecting it, look for the Gmail API as shown in the image bellow. Select it and then Enabled it.
-
Once enabled you will be taken to this page:
As show click on
Create Credentials
. For this section just follow these configurations:- Select an API --- Gmail API
- What data will you be accessing? --- User data
- Next
- App name --- Something
- User support email and Developer contact information --- Your Email
- Save and Continue
- Skip Scopes
- Save and Continue
- Application type --- Web application
- Authorized redirect URIs --- ADD URI
On the ADD URI section just paste the
redirect uri
provided in step 4. Finally once that is done click on Create and download the credentials generated. -
Upload the credintials.json to the application via the page that was open in step 4 (The index page of the Heroku application).
-
Lastly, given you are running a free tier of Heroku, you will need a seperate service to ping your app at least once every 30 mins otherwise it will idle and stop running tasks. I recommend Kaffeine with sleep turned on but if you find another one it should also work, though keep in mind you want one that can also stop pinging on set times because without setting a credit card Heroku only gives you about 22 days of continuous dyno operation per month as of late 2021.
That is it! After that the application will start ruining the Rocketbook --> Github
script every 3 minutes. You will be redirected to a dashboard where you can view the info logs and force the app to run the main script at your request (This will not stop the automatic execution)
-
Create a Personal access token and give it
repo
access, making note of the generated token. -
Make sure both pm2 and virutalenv are installed.
-
git clone
this repository where you want to have the application located. -
Run
setup.py
and provide it with the appropriate variables. -
Open the port on your firewall,
utf allow PORT
if you are using Ubuntu. -
Access your app at
http://SERVERIP:PORT
, follow steps 4-8 from the setup above and that is it! No need to worry about Dyno idling.
To deploy the app use python manage.py
and these are the required ENVs:
- GITHUB_TOKEN
An access token as described on step 1 on Free Setup
- GITHUB_REPO
The repo you want to push the files to
- GITHUB_BRANCH
The branch the files should be pushed to, eg: heads/master or heads/main
- GITHUB_DESTIONATION
The folder/subfolder that the files should be pushed to
- PASSWORD
Password to access the app
- PORT
Port in which the app should run