Skip to content

bfortuner/epilepsy_diary

Repository files navigation

Hapi Bot API

Python API for handling user requests from Hapi Facebook Messenger Bot

Key Links

Setup

Clone github repository:

$ git clone https://github.com/bfortuner/epilepsy_diary.git

Setup virtualenv:

$ sudo easy_install pip
$ sudo pip install virtualenv
$ virtualenv epilepsyenv
$ . epilepsyenv/bin/activate

Now install the required modules:

$ cd epilepsy_diary
$ pip install -r requirements.txt

Create required ENV variables (add to ~/.bash_profile or ~/.zshrc)

export EPILEPSY_APP_SECRET_KEY=''
export EPILEPSY_CONFIG='TestConfig'
export EPILEPSY_DATABASE_URI=''
export EPILEPSY_FB_VERIFICATION_TOKEN=''
export EPILEPSY_FB_PAGE_ACCESS_TOKEN=''
export EPILEPSY_PLOTLY_USERNAME=''
export EPILEPSY_PLOTLY_PASSWORD=''
export EPILEPSY_CLIENT_AUTH_KEY=''

*Email admins for keys

Create or Reset the Shared Devo Database

$ python create_db.py

Now you can launch the app:

$ python application.py

And point your browser to http://0.0.0.0:5000

Deployment

Deploy to Heroku:

$ git add --all
$ git commit -m 'My Commit Message'
$ git push heroku master

Helpful Heroku Commands

$ git push -f heroku master  #Override everything in the Heroku Repo with your local changes
$ git push heroku mydevbranch:master  #Deploy your development branch changes to Heroku
$ heroku run bash  #ssh into dyno
$ heroku pg:psql --app hapibackend DATABASE  #login to postgres db

Other Commands

ngrok http 8000  # Host the Node Frontend locally (update the FB developer page webhook)

Plotly broke. Need to fix

Looks like you don't have 'read-write' permission to your 'home' ('') directory or to our '/.plotly' directory. That means plotly's python api can't setup local configuration files. No problem though! You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'.

About

Backend FB Messenger Bot To Help Epileptics Track Seizures

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages