guest-feedback-module
v0.2.0
Published
This sends gets allows the guest to directly send us feedback
Downloads
33
Readme
🚀 Welcome to the Guest Feedback Module
Description
This project is a one stop shop for gathering guest feedback via email. By making the usage as simple as possible as well as making it platform agnostic it makes it possible to add to virtually any project.
Intallation
Intalling the library in a project is as simple as:
npm install guest-feedback-module
Usage
Import the class from the library Instantiate it with your api key Then bind the 'gatherFeedback' to any event you would like.
Here is an example binding the method to a button click handler:
import GuestFeedback from "guest-feedback-module";
const gfm = new GuestFeedback("yourApiKeyGoesHere");
const appConfig = {
appSpecificText:
"body of the email you want sent goes here, useful if you want to talk about dateleg, app, how this was collected etc...",
Subject: "subject line of the email",
};
The project ships with typescript definitions, weather you use them or not you should be able to get hints on the valid users
<button onClick="gfm.gatherFeedback(['rafa', 'another valid user'], appConfig)">
clickMe
</button>
** Note: ** The emails is an array and supports you adding as many emails to the distribution list as you would like.
Internal API
send-request-to-api
inputs ( key: string ), ( email: {To, From, HtmlBody, Subject} ) it appends the api key to the query parameters as 'key' performs the axios request returns (statusCodes: 200, 400, 500)
generate-email-from-input
Generate the template Return the email object
handle-email-request REMOTE
get key from query parameter of name key sha256 it and compare it to the known sample -- diff entrypoint if 1 send prod email then send 200 if 0 send 400 if -1 send 200 and send test email
validate-key REMOTE
input -- key: string apply sha256 to the key compare it to the known keys dictionary return ValidationResult_
get-secret REMOTE
import google secrets manager pull the secret path from the config start a new secrets manager instance use the instance to return the secret value
Screenshots
User Interface
Email Notification
Made With
unpack-emails REMOTE
get the users array from the To field of the email map the users array to an actual email return a new email with actual emails in the to field