Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: Send email enpoint #167

Open
6 tasks
EmmanuelOmoiya opened this issue Jul 28, 2024 · 0 comments
Open
6 tasks

[FEAT]: Send email enpoint #167

EmmanuelOmoiya opened this issue Jul 28, 2024 · 0 comments
Assignees
Labels
email label related to mailing features

Comments

@EmmanuelOmoiya
Copy link
Contributor

Description

Endpoint to send mail to customer or user.

Acceptance Criteria

  • The endpoint should be accesible at /api/v1/mails/send.

  • The endpoint should accept HTTP POST requests.

  • The endpoint should be secured to ensure that only a user with an admin role.

  • Proper authentication mechanisms (e.g. JWT, OAuth2) should be implemented.

  • Requests to the endpoint must include a valid authentication token in the Authorization header. Authorization: Bearer <token>

  • Request body

    {
        "template": "login-successful",
        "recipient": "[email protected]",
        "params": {
            "first_name": "Emmanuel",
            "last_name": "Omoiya",
            "ip_address": "10.43.54.263"
        }
    }
  • Response (Success)

    {
       "status_code": "200",
       "message": "Mail sending request accepted and is being proccessed",
       "error": "",
    }
  • Response (Error)

    {
        "status_code": 401,
        "message": "Unauthorized",
        "error": "Bad Request"
    }

    Invalid params

    {
        "status_code": 400,
        "message": "Invalid params, 'user_name' not found'",
        "error": "Bad Request"
    }

    Internal Server Error

    {
        "status_code": 500,
        "message": "Internal server error",
        "error": "Bad Request"
    }

Purpose

To send mail using a template to a customer / user.

Requirements

  • User must be authenticated thereby having a Authoirization: Bearer <token> header in the request body
  • User must have the role of an admin
  • User account must be active

Expected Outcome

  • A response with status_code of 200 and message of "Mail sending request accepted and is being proccessed"

Testing

  1. Unit Tests
    The system should have unit tests covering:
  • Ensure the request body has the right properties and the value are of the right type
  • Test that the appropriate response and status code is returned
@Cyberguru1 Cyberguru1 added the email label related to mailing features label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
email label related to mailing features
Projects
None yet
Development

No branches or pull requests

2 participants