Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 3.72 KB

README.md

File metadata and controls

69 lines (50 loc) · 3.72 KB

Mailing Automation Scripts

Automates the mailing process for KOSS during various events like KWoC and selections.

Warning Always do a test run before using the scripts, there are many things which might go wrong and we can't afford sending broken/incorrect mails to the reciepients.

How to use

  1. For the first time, you need to generate token for api.

  2. Either use already available templates or create a new template with the conventions mentioned in about templates.

  3. Make sure the the column names for name and email entries are one of those mentioned in variable_mappings.py.

  4. Make sure the files are stored in correct directory:

    • Templates files must be stored in ./templates/.
    • CSV files must be stored in ./csv/,

    Hence no need to mention them again while specifying the location, just specify the location after these default directories.

  5. Use the script according to your needs, bcc.py or one-to-one.py. Both follow same method of execution

    python3 script.py <template> <csv_file> (OPTIONAL)<variables with same value for all mails>
  6. Use the calendar-invite script to mail a calendar invite for an event. Do not use templates with personalised variables for each email. Do not include a lobby link as it will be auto generated.

    python3 calendar-invite.py <template_file> <csv_file> <include_meet> <slot_time> (OPTIONAL)<variables_with_same_value_for_all_mails>

Executing the scripts

Here are one example for each case supported:

python3 one-to-one.py selections/onboarding onboarding.csv number_of_applicants="250+"
python3 one-to-one.py selections/task day1.csv deadline="Monday, 9 June 2023"
python3 bcc.py selections/rejection rejected.csv
python3 bcc.py selections/round1-interview-slot r1d1.csv slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM" lobby_link="https://meet.google.com/xxx-xxxx-xxx"
python3 bcc.py selections/round2-interview-slot r2d2.csv slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM" lobby_link="https://meet.google.com/xxx-xxxx-xxx"
python3 calendar-invite.py selections/onboarding onboarding.csv YES slot_time="Tuesday, 3 June 2023, 10:00 PM - 11:00 PM"
python3 calendar-invite.py selections/onboarding onboarding.csv NO slot_time='Tuesday, 2 February 2030, 8:00 AM - 1:00 PM number_of_applicants='250+'

Generating token for GMail enabled googleapi

  1. Follow the steps at Gmail API - Python Quickstart guide to get credentials.json.

    Note credentials.json is permanent until you delete it in your google clound console.
    And make sure to add [email protected] as a test user in case you made the app internal.

  2. Follow the steps below to generate token.json:

    • Download gentokenjson.py in the same folder containing credentials.json

    • Import the required module

      pip install google-auth-oauthlib
    • Execute gentokenjson.py with send argument

      python3 gentokenjson.py send
    • Browser window will open and ask you to select the account, choose the one receiving OTP for login

    • Allow permission on that email to use just enabled GMAIL API

      • Click on Continue instead of Back To Safety
      • Then press Continue again
    • token.json will be generated in same folder as that of credentials.json

    Warning token.json expires after sometime. So make sure to check that in your projects and keep refreshing it.