A tiny serverless function currently in use at hint.io for converting emailed receipts into .pdf
format and uploading them to google drive.
Problem: At Hint we keep all of our receipts in a single location in PDF format. Paper receipts are easy (we use Readdle's "Scanner Pro" app), but email receipts require conversion to PDF, then uploading to google drive. This was a manual process that nobody enjoyed.
Solution: We've automated the process with this serverless function. Anyone on our team can forward a receipt to a designated email address and it'll automagically be uploaded to our shared receipts folder in google drive.
- An Amazon SES rule uploads all emails received at a designated address to an S3 bucket.
- A lambda function is triggered on S3 object creation, renders the email in pdf format, then uploads it to google drive.
Absolutely! Feel free to use it as-is, or adapt it for your needs. We use Google Drive at Hint, but swapping that out for dropbox or similar would be pretty simple. Have questions? Feel free to open an issue.
- Create a service account which will be used to upload PDF's to google drive.
- Duplicate env.sample.yml as
env.yml
and add service account details, destination google drive folder id, and your preferred s3 bucket name (can be anything). - Deploy the function to AWS. This project was built using the serverless framework. You can read up on that here: https://serverless.com.
- Setup an SES rule that'll store emails in the S3 bucket created when you deployed the function in the previous step.
- Profit!
Receipt Processor is released under the MIT License.