Skip to content

Latest commit

 

History

History

wedlocks

Wedlocks

Wedlocks is the email sending service for Unlock.

You can use it locally with:

netlify functions:serve

API

There is a single API:

curl -X POST http://localhost:9999/.netlify/functions/handler/ \
   -H 'Content-Type: application/json' \
   -d '{
    "template": "debug",
    "recipient": "[email protected]",
    "params": {
        "foo": "bar"
    },
    "attachments":[]
}'

You can also preview emails in a web browser by going to:

http://localhost:9999/.netlify/functions/handler/preview/<template>?<foo>=<bar>

Where <template> is the template to use and <foo> are properties and <bar> are values in the template.

With the payload sent as a JSON body. The payload needs to include the following:

  • template
  • recipient address
  • params (key/values used in the template)

Check WedlockService in unlock-app for more details.

Setup for Local Development

At the time of writing, Wedlocks requires the generation of a key pair to be utilized as part of the message encryption process. The public key portion of the pair is expected to be utilized by the calling application.

The suggestion at this time is to utilize the code outlined here. This will be moved to a script.