How It Works: High-Level Summary
The cost of building this app is approximately €4500. The cost of running the app with subscription services is €22/mo.
Purpose: To grant the Node.js application access to Google Sheets and Google Docs for creating and managing documents.
Process:
- Use OAuth2 for authorization.
- Obtain and store access tokens for API access.
Purpose: To collect client and task details interactively through a conversational interface.
Process:
- Interact with ChatGPT to input client details, task descriptions, quantities, and costs.
- Store the collected data in structured format (e.g., JSON).
Purpose: To store the task details in a structured format for easy reference and calculation.
Process:
- Use Google Sheets API to create a new spreadsheet.
- Populate the spreadsheet with task details including descriptions, quantities, and costs.
Purpose: To generate a professional-looking invoice document using a template.
Process:
- Use Google Docs API to copy a predefined invoice template.
- Replace placeholders in the template with actual client and task details.
- Calculate the total cost and include it in the invoice.
Purpose: To create a PDF version of the invoice for easy sharing and record-keeping.
Process:
- Use Google Drive API to export the filled Google Doc to PDF format.
- Save the generated PDF for distribution.
Purpose: To deliver the generated invoice to the client via email.
Process:
- Use a Node.js email service (e.g., Nodemailer) to compose an email.
- Attach the generated PDF invoice to the email.
- Send the email to the client’s provided email address.
Purpose: To deploy and run the Node.js application in a cloud environment, ensuring it is accessible and can operate autonomously.
Process:
- Set up a Heroku account and create a new application.
- Deploy the Node.js codebase to Heroku using Git.
- Configure environment variables for API keys and credentials.
- Optionally, use Heroku Scheduler to automate the execution of the script at specific intervals or set up an HTTP endpoint to trigger the script.
- Client Interaction:
- User speaks into ChatGPT to provide invoice details.
- Data Processing:
- ChatGPT collects and formats the data.
- Google APIs:
- Authorize with Google APIs.
- Create and populate Google Spreadsheet.
- Generate Google Docs invoice.
- Convert invoice to PDF.
- Email Dispatch:
- Send the PDF invoice via email using Nodemailer.
- Hosting:
- Deploy the application on Heroku for continuous operation and accessibility.