Alexa Life Hack challenge was certainly the main motivation behind this project. The lure of prizes, the excitement of competing and the possibility of something big taking shape from this idea kept me going.
What it does
Alexa skill for attorneys based in USA to auto-fill and receive important court forms via email making it easy to access and fill widely used legal forms. It retrieves name and email tied to the linked Amazon account via Account Linking. It retrieves address (street, city, state, postal, country) by exclusively requesting permissions for full address. It then uses this gathered data to autofill a form desired by the user and identified by a unique identifier. For example: After invoking this skill, attorneys will simply say 'Get Form AO 458' and an 'Appearance of Counsel' form will be auto filled and sent to them as an attachment via email. Similarly, to get 'Waiver of the Service of Summons' court form auto filled and mailed to them, they will say 'Get Form AO 399'.
How I built it
Essentially, the project has 3 modules :
- AWS Lambda function
- NodeJS API
- Standalone Java library (JAR)
First, the AWS lambda function retrieves user's name, email and address information via the well documented mechanisms of Amazon Alexa Architecture like 'Account Linking' and 'Permissions'. It also parses the skill invocation requests for variable data (known as 'slots' in Alexa dev terminology) like the concerned form identifier ('AO 458' in the request described above).
Once, these variables are gathered, it invokes the NodeJS API with the data gathered that translates the payload into arguments that are then passed to the JAR file. The JAR file uses an open source 3rd party java library (jar) to fill data into PDFs.
Once the JAR execution stops, NodeJS API emails the generated PDF as an attachment to the email address identified by and passed on to it by the lambda function. The lambda function is also responsible of responding appropriately to the various interactions possible in the skill.
NodeJS API and Java libraries are hosted on an EC2 instance.
Challenges I ran into
It was quite a challenge to incorporate account linking by deploying your own OAuth2 implementation. Given that the use case required access to only few details like name and email that are easily accessible using Account Linking with the customer's Amazon Account, I settled for the latter and it worked flawlessly. At some point, I will like to learn how to set up OAuth2 on my server.
Accomplishments that I'm proud of
- Figuring out Account Linking with Amazon Account.
- A generic system that was created to take collection of keys and values and auto fill PDFs.
- Everything works End to End!
What I learned
I learnt how to retrieve alexa skill user's email, name and full address using Account Linking with user's Amazon Account.
What's next for Legal Forms Assistant
Incorporate more forms and make it an exhaustive warehouse of all possible court forms that attorneys, court staff and judges can use. Auto-filling signatures using DocuSign APIs could open a whole new set of opportunities. Also, there is nothing stopping a similar concept being deployed to another niche or to simply have a uber repository of all forms in the world. This concept has many applications and the possibilities are endless.