Skip to content

A small node app that automatically emails a file from a given Dropbox folder πŸ“€ (now on AWS)

License

Notifications You must be signed in to change notification settings

daviddeejjames/send-that-invoice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

87 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

send-that-invoice πŸ“€

Node.js Lambda that automatically emails a file from a given Dropbox folder. Also sends a text message via AWS SNS to verify an email has been sent.

Uses

Prerequisites

  • Node & nvm
  • AWS CDK - for deployment to AWS

How It Works πŸ”§

The application was made for a very specific use case, however the general problem it solves is to automate sending an invoice to a client.

This invoice is usually handwritten, scanned and uploaded to Dropbox. In the past, this would be then manually sent via email.

This application rectifies this by checking if the file has been uploaded to Dropbox and proceeds to generate the email and send it to the specific client as an email with an attachment, based on the uploaded file name prefix.

The application checks for the file every so often using a cron. These settings could be changed and the cron could be ditched in favor of a webhook connected to the particular Dropbox folder.

Build & Run Locally πŸ§™β€

  1. npm install to install CDK deps
  2. Set environment variables in variables.env
  3. Set at least one person.json in data folder
  4. cd src for lambda code
  5. npm install
  6. npm start

AWS CDK Commands πŸ—

Run these from the root directory

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

Deploying from local

Once .env vars set correctly:

  1. export $(cat .env | xargs) && cdk synth
  2. export $(cat .env | xargs) && cdk deploy

Moving data πŸš›

Note that there is a script to move files from your local machine to S3, to run this you will need the AWS-CLI installed and connected to your AWS account

To run it simply use npm run copy-data

Helpful Links πŸ“š

About

A small node app that automatically emails a file from a given Dropbox folder πŸ“€ (now on AWS)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published