Skip to content

hac-ohmygod0193/auto-e3

Repository files navigation

E3 email summarizer

Star My Repo if you think it is useful, THX

Demo Result

image

靈感來源

因為E3 email的訊息太亂太雜,希望能透過LLM統整、摘要重要訊息,並儲存在notion database上方便查閱。

Source of Inspiration

Due to the chaotic and cluttered nature of E3 emails, I hope to streamline and summarize important information using LLM, and store it in a Notion database for easy reference.

Getting Start

Clone all files to your

git clone https://github.com/hac-ohmygod0193/auto-e3.git
pip install -r requirements.txt

Here you need to paste your own secret key to enable the power of auto-e3 image

Setup Gmail secret token

  1. Follow the instrustions from setup tutorial source Remember to set Redirect URI in OAuth 2.0 Client IDs to http://localhost:8080/
image
  1. After you finish step 6 above(download and rename the file as client_secret.json), Execute the code below
python3 setup_gmail_api.py
  1. You will see the messeage like below in your terminal or just see a pop out webpage. Click and authorize with the account you apply for your gmail api.
image
  1. Copy the string in your gmail_token.json after step 4 and paste here to get encoded string.
image
  1. New Repository secrets Name called BASE64_GMAIL_TOKEN and paste the encoded base64 string to Secret below
image

Setup Notion secret token

  1. Follow the instructions from here

  2. Make Sure you create a new page in your notion as database instead of page

  3. Make Sure you add connection to your notion api you just create

image
  1. New Repository secrets Name called DATABASE_ID and paste your id of your notion database to Secret below

You need DATABASE_ID here, which can be obtained from the web version of Notion by clicking on the page. At the end of the URL, there will be an ID that you can grab here. For example, in https://www.notion.so/ohmygod0193/test-4f3f55661c333e5585660c4c35e10533 4f3f55661c333e5585660c4c35e10533 is the DATABASE_ID.

  1. New Repository secrets Name called NOTION_TOKEN

  2. Paste the notion api your create with step 1 to Secret below

Setup Gemini APi secret token

  1. Head over to makersuite.google.com/app/apikey visit and sign in with your Google account.

  2. Under API keys, click the “Create API key in new project” button. image

  3. generate google gemini api key

  4. Copy the API key and keep it private. Do not publish or share the API key publicly. image

  5. New Repository secrets Name called GOOGLE_API_KEY and paste the API key to Secret below

Deploy scheduled bot with Github Actions

  1. Create a .github/workflows directory in your repository on GitHub if this directory does not already exist.
  2. In the .github/workflows directory, create a file named actions.yml. For more information, see "Creating new files."
  3. Copy my actions.yml here
image
  1. You can set up your desired running schedule by changing this line - cron: 0 */3 * * * # run every 3 hours. For more crontab settings , see here

Run it locally

If you want to run it locally on your desktop or laptop. Just replace

  1. os.environ["NOTION_TOKEN"] os.environ["DATABASE_ID"] in notion.py
  2. os.environ["GOOGLE_API_KEY"] in gemini_agent.py

And Keep your gmail_token.json file under same directory with gmail.py

Reference

simplegmail Get_course_info requests method How to access gemini model notion-client-api GitHub Actions Secrets

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages