diff --git a/.gitignore b/.gitignore index f0d0da2..56dd524 100755 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ build/Release node_modules config.json npmrc + +# Email template files +templates/* \ No newline at end of file diff --git a/apiary.apib b/apiary.apib index d5c6300..dee8b50 100755 --- a/apiary.apib +++ b/apiary.apib @@ -568,6 +568,90 @@ __optionals__ | String | Optional | Object containing all send options (onlyGcm } +# Group Templates + +## Create email template [/api/notification/template] + +### Create an HTML email template [POST] +Generates a new HTML email template from a non-HTML input. + +**Currently supported formats are .mjml files, using the format specified by [MJML](https://mjml.io/)** + +#### Attributes for the json body parameter + +Name | Type | Required | Description +--- | --- | --- | --- +__filename__ | String | Required | Name of the email template to be generated +__content__ | String | Required | Input text that will be transformed into HTML +__type__ | String | Required | The input type. Currently can be ´mjml´ **only** + ++ Request (application/json; charset=utf-8) + + + Body + + { + "filename": "custom-template", + "content": "Hello World!", + "type": "mjml" + } + ++ Response 200 + + { + "output": "done" + } + ++ Response 400 (application/json; charset=utf-8) + + { + "code": "BadRequestError", + "message": "Missing or invalid parameters: content, filename, type" + } + +## Email template listing [/api/notification/template/list] + +### Fetch list of email templates [GET] +Returns a list of the email template filenames currently available + ++ Request (application/json; charset=utf-8) + + + Body + + {} + ++ Response 200 + + [ + { + "name": "my-template-1", + "type": "html", + }, + { + "name": "my-template-2", + "type": "html" + } + ] + +## Email template details [/api/notification/template/details/:templateName.:type] + +### Fetch email template details [GET] +Returns a the content of an email template (either HTML or other) and the placeholders it has in its content. + ++ Request (application/json; charset=utf-8) + ++ Response 200 + + { + "html": "Hello World!", + "placeholders": ["USER"] + } + ++ Response 404 + + { + "code": "NotFoundError", + "message": "Template not found" + } # Data Structures diff --git a/cucumber/features/email_features/email_send.feature b/cucumber/features/email_features/email_send.feature index 1311403..9393c24 100644 --- a/cucumber/features/email_features/email_send.feature +++ b/cucumber/features/email_features/email_send.feature @@ -1,11 +1,11 @@ Feature: the server receives a request to send an email - Scenario Outline: send batch Email to an identity objects + Scenario Outline: send in-body HTML batch Email to identity objects Given an authenticated identity in the app with Then a request is sent to to send an email and returns Examples: - | identity_id | endpoint | email | response | + | identity_id | endpoint | email | response | | 01f0000000000000003f0001 | /api/notification/email | email/batch/valid_email_over_batch_limit.json | email/valid_email_response.json | | 01f0000000000000003f0001 | /api/notification/email | email/batch/valid_email_under_batch_limit.json | email/valid_email_response.json | | 01f0000000000000003f0002 | /api/notification/email | email/batch/invalid_to_email.json | email/invalid_to_email_response.json | @@ -13,7 +13,16 @@ Feature: the server receives a request to send an email | 01f0000000000000003f0001 | /api/notification/email | email/batch/empty_email.json | email/empty_email_response.json | | 01f0000000000000003f0002 | /api/notification/email | email/batch/missing_email_message.json | email/missing_email_message_response.json | - Scenario Outline: send email to a single email address + Scenario Outline: send custom HTML template batch Email to identity objects + Given an authenticated identity in the app with + Then a request is sent to to send a custom email template