GitXplorerGitXplorer
s

rsvper-api

public
0 stars
0 forks
1 issues

Commits

List of commits on branch master.
Verified
a871a910a27e5f5f87909402bee4e70d1019c67a

Merge pull request #1 from shruti222patel/add-license-1

sshruti222patel committed 6 years ago
Verified
ba96d170d9e845ce1b8762e79e0daef35cda9009

Create LICENSE

sshruti222patel committed 6 years ago
Unverified
52db1d85e92b906c62f4bee90d580e917cb3481f

Move Spreadsheet Id into environment variable

committed 6 years ago
Unverified
201d8c39e72c613cd98f8e1ba2c58b282f0c8a5a

Change name of function from hello to bot. Made wording and phrasing updates

committed 6 years ago
Unverified
77efe8344ed68300d5e05279a7f7411b0ca13cfc

Move parsing of request to different function

committed 6 years ago
Unverified
b6a82eaeb4909129f6ecab20e74943d2c6c72850

Update serverless to include staging and prod deployments

committed 6 years ago

README

The README file for this repository.

RSVPER

Rsvper facilitates makeing and collecting RSVPs via text messages and (in the future) phone calls.

Setup

Install

  1. brew install awscli
  2. pip install --user aws-sam-cli
  3. npm install -g --upgrade aws-sam-local
  4. npm install
  5. git clone repo
  6. cd into repo and run npm install
  7. serverless sam export --output ./template.yml to create a sam template.

Local Development

  1. sam local start-api to start local instance of API Gateway. Note: your lambda logs will appear here. This should start the API Gateway on port 3000
  2. Run ssh -R rsvper.serveo.net:80:localhost:3000 serveo.net
  3. What to restart after updating specific sections:
    • Update lambda function -> Run make build Don't restart sam-local because it uses "hot reloading" (so, files are updated without losing the app's state).
    • Update secrets -> (Make sure to encrypt/decrypt as needed) Run serverless sam export --output ./template.yml & Restart sam local start-api
    • Update serverless configs -> Restart sam local start-api
  4. For testing:
    • Function Integration Test ->
      • add google api creds to the Makefile
      • run make test
      • replace <insert google api creds> with creds from another developer (Correction for now you will have to export those creds (gotten from a developer) into your env variables)
    • (Mock) Deployment ->
      • serverless deploy --nodeploy to regernate the rsvper.zip that sam-local uses.
    • Local End-to-End Test ->
      • run sam local start-api
      • run ssh -R rsvper.serveo.net:80:localhost:3000 serveo.net
      • you shouldn't have to update the webhook url as the subdomain used by serveo.net will always be the same, but if you do need to: Copy & paste the https://<forwarding-url>/bot (forwarding-url printed on the terminal) into the dialogflow fulfillment webhook -- Remember to press the Save button at the bottom of the page
      • import and run POST Fulfillment Request for RSVP... from the postman collection in docs/

Deployment

Code

  • make build to build the binaries for deployment
  • decrypted the secrets file for the given env (i.e. secrets.demo.yml, secrets.staging.yml, secrets.prod.yml)
  • serverless deploy --stage <env name> (make sure you have the correct default creds in your ~/.aws/credentials)
    • <env name> = demo, staging, or prod
  • to completely redeploy the entire stack and not just update the lambda function code:
    • delete the cloud formation stack (you may have to delete the s3 bucket first)
    • serverless deploy

Dialogflow Bot

  1. Export as Zip from Rsvper-staging
  2. Restore from Zip in Rsvper
  3. Update the Rsvper Fulfillment Webhook Url to the apporiate one for Prod
  4. Save the exported version with the date (still have to decide on where to store it)

Additional Config

  • Encrypt creds: serverless encrypt --stage <env name> --password <password>
  • Decrypt creds: serverless decrypt --stage <env name> --password <password>
  • if you need to switch to ngrok insteady of serveo.net:
    • brew install ngrok
    • ngrok http 3000
    • update the dialogflow webhook url with the newly generated ngrok forwarding url
  • to change the function name: update the folder name, the names in serverless.yml (3 places), and Makefile (2 places)

Architecture

App Diagram

TODO

  • Dockerize app
  • Add all 330 invite codes to the rsvper.invitecode (look into automated ways) - rn, typing in 0001, instead of 1 will result in an error. Maybe look into slotfilling to solve this issue?
  • When default fallback intent is triggered, send alert and/or log in google sheet
  • Build out invite code triggered conversation flow
  • Add end of conversation message (after they've rsvp'ed to all the events they've been invited to)
  • Limit the number of times the default intent asks users to repeat
  • Allow users to skip specific rsvps
  • Allow users to update specific even rsvps (instead of going through the welcome flow)
  • Allow users to reset their conversation (by deleting all their contexts)

Learnings

Dialogflow

  • if you need to match the entire training phrase, you'll have to put ALL the full matching phrases in training - e.g. when you expect the user to only enter a number, you have to add ALL the numbers, just typing in 1, 6, 9, 10 won't give you all the numbers, it won't even give you 1-10. You have to explicitly list all the numbers
  • both contexts & events are used to determine what is the next intent

Database Structure

INVITED_FAMILY

Origin

  • (informal) where the family is from
  • string
  • col A

Name

  • (informal) name used by Rajeshri
  • string
  • col B

Invite Name

  • name displayed on invite
  • string
  • col C

Invite Code

  • unique code to distinguish invited families
  • number
  • col D

Vidhi-Invite

  • number of people invited to the vidhi on the invitation card (ALL means unlimited, NULL means no value yet)
  • string/number
  • col E

Vidhi-RSVP'd

  • latest number rsvp'd by the invited family for the vidhi (NULL means no value yet)
  • strin/number
  • col F

Garba-Invite

  • number of people invited to the garba on the invitation card (ALL means unlimited, NULL means no value yet)
  • string/number
  • col G

Garba-RSVP'd

  • latest number rsvp'd by the invited family for the garba (NULL means no value yet)
  • string/number
  • col H

Wedding-Invite

  • number of people invited to the wedding on the invitation card (ALL means unlimited, NULL means no value yet)
  • string/number
  • col I

Wedding-RSVP'd

  • latest number rsvp'd by the invited family for the wedding (NULL means no value yet)
  • string/number
  • col J

** Note needed to add NULL to number columns because the golang google sheets lib automatically omits empty values **

UPDATE_EVENT

Invite Code

  • used to connect the event to the invited family
  • number
  • col A

Phone Number

  • phone number used to make the rsvp update
  • string
  • col B

Event

  • vidhi, garba, or wedding
  • string (enum)
  • col C

Number Attending

  • number of invitees atting the event
  • number
  • col D

Timestamp

  • time this rsvp update was made
  • number
  • col E

Useful Docs

Google Sheets

APIs

Github

Go

Emoji