📨A Lambda function for creating email contacts in SendInBlue. Perfect for landing page contact forms.
- ✅ Semantic HTTP statuses
- 💡 Checks email validity
- 🔒 CORS-ready (customizable)
- 💬 Send Slack notifications on success, duplicate, and errors
- 🚀 Build & deploy to AWS from the command line
Retrieve your API endpoint url from the Lambda console
POST
the following json body to the endpoint:
{
"email": "fred@flintstone.com"
}
Follow the steps outlined in the Dev setup section below if this is your first time.
# Start Docker 🐳 (I use Docker.app)
# Invoke the function
sam local invoke --env-vars .env.json --event events/goodEmail.json
Follow the steps outlined in the Deploy setup section below if this is your first time.
./create-contact/deploy.sh
- Install
npm
, theAWS SAM CLI
, and Docker cd create-contact && npm i
- In the project root, create and populate
.env.json
with the following env vars:
{
"CreateContactFunction": {
"SENDINBLUE_API_KEY": "xkeysib-****",
"CORS_HEADERS": "{ \"Access-Control-Allow-Origin\": \"*\" }",
"SLACK_DEV_NOTIFICATIONS_WEBHOOK_URL": "https://hooks.slack.com/services/****/****"
}
}
The Slack webhook is optional, but you'll be glad you set it up ;)
Open the Lambda console and follow my Lambda deployment guide to setup AWS.
When you create the function, name it SendInBlueCreateContact
When you create the AWS CLI upload profile, name it SendInBlueCreateContactLambdaAccess
.