This is the example application for my blog article. You can find the article here:
It uses the Serverless framework to build a serverless function. The function sends an email to the configured email address with the customer contact information.
The application uses Twilio Sendgrid for sending the email.
Install according to the Serverless installation instructions:
Then run after cloning this repository:
npm install
Set the environmental variables in serverless.yml according to your values.
For example:
export SENDGRID_API_KEY=xxxx
export MESSAGE_TO=your@x.com
export MESSAGE_FROM=website@yourwebsite.com
You can get your Sendgrid API key by signing up at: https://sendgrid.com/
sls offline
sls deploy
Note, after deploying there are costs associated with invoking the function depending on cloud provider.
sls remove
If internal server error occurs, run before deploy:
chmod -R +r node_modules/
MIT