Skip to content

Instantly share code, notes, and snippets.

@raynerpupo
Last active August 1, 2019 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raynerpupo/66ab324387368d8949e753f4eb28f8cf to your computer and use it in GitHub Desktop.
Save raynerpupo/66ab324387368d8949e753f4eb28f8cf to your computer and use it in GitHub Desktop.

TechOps Chatbot backend

Architecture overview

The TechOps Chatbot backend is a NodeJS API written in TypeScript, served with ExpressJS, secured with Passport through a secret bearer token and provisioned on AWS using Terraform. The users feedback is stored in a DynamoDB database on AWS using the aws-sdk and dynamodb-data-mapper.

API endpoints

POST::/feedback

Body:

  • feedbackType : [Useful | Average | Poor] mandatory
  • time : numeric timestamp mandatory
  • comment: alphanumeric optional

Security

Bearer Token for every request

Models

Feedback

  • feedbackType: DynamoDB::hashKey
  • time: DynamoDB::rangeKey
  • comment: DynamoDB::attribute

ENV Variables

APP_ENV: Current app environment (prod | dev | qa)

BOT_TOKEN: The secret private token to match against the requests

DB_HOST: The DynamoDB database URL

AWS_DEFAULT_REGION: The AWS app region, ej: us-east-1

AWS_ACCESS_KEY_ID: The AWS access key

AWS_SECRET_ACCESS_KEY The AWS secret for the above access key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment