Skip to content

Toronto Foundation for Student Success

License

Notifications You must be signed in to change notification settings

uoftblueprint/tfss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TFSS Email Processsing API

Contributors

Project Leads:

Pierre-William Lessard, Youssef Soliman

Senior Developers:

Jeff Huang, Min Gi Kwon, Sarah Xu, Valerie Yip

Junior Developers:

Caesar Saleh, Sataphon Obra, York Hay Ng

Project Setup Guide

This guide will walk you through the steps to set up and run the project.

Clone the Repository

First, you need to clone the repository to your local machine. You can do this by running the following command in your terminal:

git clone https://github.com/uoftblueprint/tfss.git

After cloning the repository, navigate to the project directory:

cd tfss

Next, install the project dependencies. The dependencies are listed in the requirements.txt file. You can install them using pip:

pip install -r requirements.txt

Setting Up the Environment

You need to set up your environment variables. An example of how to set them up is provided in the example.env file.

Replace YOUR_KEY_HERE with your ChatGPT API key and YOUR_PASSWORD with a secure password. This password will be used to authorize requests to the Flask server.

Running the Flask Server

The Flask server needs to be accessible over the internet for Power Automate to send HTTP requests. For production, regular deployment is recommended. However, for testing, you can use ngrok.

Using ngrok

  1. Download ngrok from https://ngrok.com/.
  2. Run the Flask server locally by executing the api.py script in the email_processing directory.
  3. In a separate terminal, start ngrok on the same port as the Flask server (default is 5000):
ngrok http 5000

The output will include a "forwarding" URL in the format <ngrok_url> -> http://localhost:5000. The <ngrok_url> is the URL power automate will interact with.

Setting Up Power Automate

To connect Power Automate to your server, you need to modify the "POST Process Email" HTTP block.

  1. Set the URI field to the URL of your server followed by /email. If you're using ngrok, this would be <ngrok_url>/email.
  2. Under the "headers" field, set the Authorization field to Basic <base64credentials>. Here, <base64credentials> is a Base64-encoded string of tfss_user:<YOUR_PASSWORD>. You can generate this string using a Base64 encoder like https://www.base64encode.net/.

For example, if your password is abc123, input tfss_user:abc123 into the encoder. The Authorization field would then be Basic dGZzc191c2VyOmFiYzEyMw==.

That's it! You've now set up the project and connected it to Power Automate.