Power Automate: Job application with GPT

1. Go to https://make.powerautomate.com/ and login using the credentials received. You may be asked to change password to your own.
   a. Make sure you select the environment from the selector that corresponds to your login. For example, "White Daisy" is the environment for "white.daisy@poweralabs1.onmicrosoft.com". Do NOT work in the "Power Labs (default)" environment!

2. Click "+Create" and choose "Instant cloud flow" in the "Start from blank" section.

3. Set a name for you flow, e.g. "Job application" and select "Manually trigger flow" from the list of triggers.

4. Create 2 parameters in the trigger action using "+Add an input" and name them:
   a. Text: job_requirements
   b. Text: email_to_apply

5. Open in new tab "One Drive" through the top left "9-dots" application menu. Save your CV in a local disk in TXT format and upload it to One Drive. Use a sample CV here if you don't have one handy.

6. Return back to the flow and add an action "Get file content" from the connector "OneDrive for Business". Choose your file in TXT format in the file selector of the action.

7. Add an action step "Create text with GPT using a prompt" from "AI Builder" connection.

8. In the "Prompt" dropdown select "+New custom prompt":
   a. Name it "Job application" or similar
   b. Add 2 inputs: "Requirements" and "CV"
   c. Enter prompt text: "Create a job application covering these requirements: … Use my experience from this text to provide brief but relevant address to the above requirements: …"
   d. Replace "…" with the parameters "Requirements" and "CV" respectively, using the "+Insert" button.
   e. Click "Save Custom prompt".

9. Once returned to the action "Parameters" tab select the values for "Requirements" and "CV" values (dynamic content tab with the lightning bolt):
   a. "Requirements" - select "job_requirements" from the "Manually trigger flow" section (click "Show all" if you don’t see it).
   b. "CV" - select "File content" from the "Get file content" action. 


10. Add "Start and wait for an approval" action from the "Approvals" connector. Select "Approve/reject - First to respond" and fill in the details required:
   a. Title: "Job application approval request" or similar
   b. Assigned To: enter your login (e.g. white.daisy@powerlabs1.onmicrosoft.com)
   c. Details: select "Text" from the "Create text with GPT using a prompt" step.

11. Find and add a "Condition" action in the "Control" connector and enter the condition parameters:
   a. "Outcome" from the "Start and wait for an approval" step
   b. Condition: "is equal to"
   c. Value: Approve

12. In the "True" branch (green) add action "Send an email (V2)" from the "Office 365 Outlook" connector. Fill in the parameters:
   a. To: select "email_to_apply" from the "Manually trigger a flow" action.
   b. Subject: "Job application" or similar
   c. Body: select "Text" from the "Create text with GPT using a prompt" step.
   d. In the Body tag change view to the HTML display ("<>" on the right) and replace "p" tag with "pre" tag and "/p" with "/pre". This will keep the original text formatting in email.
   e. Select "Show all" in the "Advanced parameters" and in the "Attachments" section add a new item:
        i. Name: CV.txt
        ii. Content: Select "File content" from the "Get file content" action.

13. Save and test your flow:
   a. Select "Test" -> "Manual" -> "Test". Make sure all connectors are marked with "green ticks" (logged in) and click "Continue".
   b. Find a job ad relevant to your skills and CV and copy text related to job requirements in the requirements section and enter it to the job_requirements parameter (use a sample job requirements extract here if needed). Add your personal email to the "email_to_apply" field.
   c. Check the emails in the https://outlook.office.com/mail/ in the new tab - this is the mailbox if your Power Labs account. Check for the "Job application approval request" email (it may be in the "Other" tab).
   d. Click "Approve" and "Submit" in the email.