Skip to content

buzzfeed-openlab/sms-music-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sms-music-swap

A simple sms bot for mediating music recs between strangers

About

This is a flask app that handles text message exchanges with strangers. It uses Twilio to send/receive SMS.

In a nutshell, the app:

  • texts a prompt (currently the topic is music recs, but this can be adapted to fit other topics)
  • stores responses
  • texts randomly selected responses from strangers
  • texts notifications when responses have been seen
  • allows admins to moderate responses

UPDATE: the music swap bot used to live at 1-415-851-7927, but unfortunately it needs to be shut down due to high usage (i.e. high costs). If you're interested in reviving it, reach out: cathyd125 at gmail

Setup

1. Make sure you have OS level dependencies

  • Python 3
  • MySQL

2. Clone this repo

git clone https://github.com/buzzfeed-openlab/sms-music-swap.git
cd sms-music-swap

3. Install required python libraries

Optional but recommended: make a virtual environment using virtualenv and virtualenvwrapper.

Notes:

  • Instructions for setting up virtualenv here.
  • mkvirtualenv sms will automatically activate the sms environment; to activate it in the future, just use workon sms
  • if the virtualenv you make isn't python 3 (check w/ python --version), use mkvirtualenv sms -p /path/to/your/python3 (find your python3 path with which python3)
mkvirtualenv sms

Install requirements:

pip install -r requirements.txt

4. create a MySQL database

mysql -u root

& then

create database sms;

If you're working locally, you're good to go. But if you're going to host this on a shared server you probably want to create a new user for this database instead of using root.

5. Configure the app

There are two ways to do this: (a) making a config file or (b) setting environment variables.

You will need a twilio account & number to configure the app. (INSTRUCTIONS TO COME)

Option A
Copy the example secret config file

cp sms_swap/config_vars_secret.py.example sms_swap/config_vars_secret.py

Then, edit sms_swap/config_vars_secret.py.

Option B
see sms_swap/config_vars_secret.py.example for the names of environment variables to set & descriptions of what the values should look like.

6. Run the app locally

python application.py

7. Initialize the database

Visit the /initialize route (e.g. localhost:5000/intialize) & enter admin credentials (ADMIN_USER & ADMIN_PASS). This will create the table for storing responses.

About

sms bot for mediating music recs between strangers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published