Pierre-William Lessard, Youssef Soliman
Jeff Huang, Min Gi Kwon, Sarah Xu, Valerie Yip
Caesar Saleh, Sataphon Obra, York Hay Ng
This guide will walk you through the steps to set up and run the project.
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
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.
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.
- Download ngrok from https://ngrok.com/.
- Run the Flask server locally by executing the
api.py
script in theemail_processing
directory. - 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.
To connect Power Automate to your server, you need to modify the "POST Process Email" HTTP block.
- Set the
URI
field to the URL of your server followed by/email
. If you're using ngrok, this would be<ngrok_url>/email
. - Under the "headers" field, set the
Authorization
field toBasic <base64credentials>
. Here,<base64credentials>
is a Base64-encoded string oftfss_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.