Giter Site home page Giter Site logo

email-microservice's Introduction

email-microservice

Overview

This is a gateway between a REST API and Twilio's SendGrid API. It is meant as a microservice, with some consumer sending data for an email and then receiving a reply back.

Install

Make sure Go is installed. You can find directions here: https://go.dev/doc/install

Clone this github: git clone htts://github.com/janneyt/email-microservice.git

Change directories to the cloned repository: cd email-microservice

Initialize the mod system go mod init email-microservice.com/m/v2

Tidy the mod (install dependencies, among many other useful features) go mod tidy

Now you can build the executable: go build email-microservice.go

And then run the microservice like so: ./email-microservice run or on Windows: email-microservice run

Usage

You must use one of two arguments to run the service. These are the only valid command line arguments for this microservice:

go run email-microservice.go run and go run email-microservice.go help

##############################

Communication Contract

Communication with this microservice relies on the following endpoints:

- Endpoint: /
    -Receives: a GET request with no queries

    -Example call:
        ###
        GET http://localhost:8090 
        Content-Type: application/json 
        Authorization: x-access-token

    -Returns the following status codes:

        Status: 200
        Data: 
            [{
                "Name":"All",
                "Method":"GET",
                "Description":"Returns all endpoints currently enabled",
                "Example":"/api/contact/email/all",
                "Required":
                    {"Sender":"Not required",
                    "SenderName":"Not required",
                    "Recipient":"Not required",
                    "RecipientName":"Not required",
                    "Subject":"Not required"}},
            {
                "Name":"send_email",
                "Method":"POST",
                "Description":"Sends a email based on the passed properties.","Example":"/api/contact/email/send_email",
                "Required":
                    {"Sender":"Not required",
                    "SenderName":"Not required",
                    "Recipient":"Not required",
                    "RecipientName":"Not required",
                    "Subject":"Not required"}}]

        Status: 400-Bad Request
        Data: None, this indicates a malformed request on the calling agent's side

        Status: 404-Not Found
        Data: None, this indicates a processing error but a graceful exit and reply to the end user.

- Endpoint: /api/contact/send/email
    -Receives: a POST request with the following mandatory fields:
        {
            "sender":"[email protected]",
            "recipient":"[email protected]",
            "message":"Hi Ted, Hope all is well."
            "sendername":"Ted"
            "recipientname":"Ted"
        }
    
    -Example call:
        ###
        POST http://localhost:8090/api/contact/email/send_email HTTP/1.1
        Content-Type: application/json
        Authorization: x-access-token

        {
            "sender":"[email protected]",
            "recipient":"[email protected]",
            "message":"Hi Ted, Hope all is well."
        }
        
        ![Email Contact Form Microservice vpd](https://user-images.githubusercontent.com/70920801/199119972-65b86ab7-8d11-448e-aeec-e3ca9d03e2cb.jpg)

file:///home/castimir/Downloads/Email%20Contact%20Form%20Microservice.vpd.jpgimage

email-microservice's People

Contributors

janneyt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.