Serverless SES Forwarding for GrooveHQ
Recently, I started to investigate the possibility of using a SaaS-based helpdesk for our AWS customers. After looking at the usual suspects, ZenDesk, FreshDesk, and GrooveHQ and comparing what we could do for $free$ (it is just a test case at this point) I decided to go with GrooveHQ.
After creating your account in GrooveHQ, they provide you with a forwarding email address. If you want to, you can provide this email address to your customers and start receiving support tickets right away. I wanted to use an email address tied to my domain, so I needed to forward inbound emails to the address provided to me by Groove.
GrooveHQ email forwarding
Here’s the catch, although forwarding email is a trivial exercise I didn’t want to create a (not $free$) Google Apps account, nor did I want to (not $free$) create an EC2 instance and run something like Postfix on it. On top of it not being $free$ I would have to maintain both the application and the operating system - not how I want to spend my time.
So with these requirements in hand, I decided to build a server-less solution on the AWS platform. Here’s what I ended up creating.
GrooveHQ SES Integration
Here’s the high-level workflow
- Customer sends an email to our support address; SES receives the incoming message
- SES stores the raw email messages in an S3 bucket and invokes a Lambda function
- The Lambda function processes the email, and grabs the raw data from the email object stored in the S3 bucket
- The Lambda function forwards the email to the defined GrooveHQ email address
Here’s an overview of the AWS services that I used
Simple Email Service (SES)
I configured SES to receive mail, created a simple email ruleset to handle incoming email to my support email address. The ruleset stores mail in an S3 bucket and calls a Lambda function to forward inbound emails to GrooveHQ.
Simple Storage Service (S3)
I created an S3 bucket to store the raw email and configure a Lifecycle Management Rule (LCM) to delete objects permanently after two days.
Lambda Function
I created a simple Python script that uses Boto3, grabs objects from S3 and forwards the request off to GrooveHQ and opens a ticket. A couple of issues showed up here. First, I needed to transform the to and from email addresses to match the SES verified domain and second I needed to grab the message content from the raw email stored in S3. After a little bit of trial and error, I managed to get everything working. I’ve made the Python script and the IAM role that it uses available on GitHub.
So, that’s it. A server-less architecture that I can use to forward support tickets to GrooveHQ. Doing a (very) rough estimate, I figure that even if I received 10,000 support requests in a month this solution would cost me about $35USD. Not $free$, but much better than if I had to run an EC2 instance, plus there’s the side benefit that I don’t have to maintain any compute! Win!