https://github.com/simonfelding/amazon-lambda-nodemailer-webhook
middy.js webhook that receives json and sends an email.
https://github.com/simonfelding/amazon-lambda-nodemailer-webhook
Last synced: 23 days ago
JSON representation
middy.js webhook that receives json and sends an email.
- Host: GitHub
- URL: https://github.com/simonfelding/amazon-lambda-nodemailer-webhook
- Owner: simonfelding
- License: lgpl-2.1
- Created: 2022-02-24T21:14:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-07T18:21:44.000Z (over 4 years ago)
- Last Synced: 2025-02-22T21:30:16.804Z (over 1 year ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# setup
`docker build -t protonmail-webhook .`
## invoke webhook
The server is easily modified, but currently expects json in the format of:
```
body:
name:
cpr:
mail:
text:
```
Make sure to examine the docker-compose.yml for important environment settings.
Also make sure to edit the inputSchema in server.js so it fits your purpose and modify the below curl string accordingly.
`curl -XPOST "http://webhook:8080/2015-03-31/functions/function/invocations" -d '{"body": {"name":"a","cpr":"12345678-1234","mail":"a@b.dk","text":"hello world! 123 123 123 123 123 12"}}' -H 'Content-Type: application/json'`
# optional weird self-hosted lambda server setup
use docker compose and add the container with container_name: "webhook". Add the following to nginx server block. the weird path is necessary for the AWS lambda container to work.
```
location /mailhook {
proxy_pass http://webhook:8080/2015-03-31/functions/function/invocations;
proxy_buffering off;
}
```
# test
`curl -XPOST "https://example.com/mailhook" -d '{"body": {"name":"a","cpr":"12345678-1234","mail":"a@b.dk","text":"hello world! 123 123 123 123 123 12"}}' -H 'Content-Type: application/json'`
# Advice
Don't actually store the password in the docker-compose.yml file. It's probably a bad idea for deployment (but fine if you're just testing, env variables can be securely set in the aws lambda control panel).