Yelp Love lets you show others your appreciation for something they've done. Did they make you laugh in your darkest hour? Did they save your ass? Did they help fix that bug? Send them love!
- Send love to one or more recipients (publicly or privately)
- Email notifications when users receive love
- Viewing the most recent 20 loves sent or received by any user
- Leaderboard with the top 20 users who sent and received love
- API that allows external applications to send and retrieve love data
- Manual or automated synchronization between Yelp Love and your employee data
- Admin section to manage aliases and API keys
To get an idea what Yelp Love looks like go and check out the screenshots.
Yelp Love runs on Google App Engine. In order to install Yelp Love you will need a Google account and the Google App Engine SDK for Python.
Follow the instructions on creating a project and initializing your App Engine app - you'll also need to set up billing and give Cloud Build permission to deploy your app.
Copy the example config file to config.py and change the settings. Don't forget to specify your own SECRET_KEY.
Finally, run
$ make deploy
This will open a browser window for you to authenticate yourself with your Google account and will upload your local application code to Google App Engine.
If the initial deployment fails with a Cloud Build error, try running
$ gcloud app deploy
manually. After that, make deploy
should do the job, and will make sure
everything is uploaded properly - including the worker service, database indexes
and so on.
Once the deployment succeeds open your browser and navigate to your application URL, normally https://project_id.appspot.com.
Create a file employees.csv in the import directory, add all your employee data, and deploy it. We‘ve put an example csv file in that directory so you can get an idea of which fields Yelp Love requires for an employee.
Once the CSV file is deployed point your browser to https://project_id.appspot.com/employees/import. and follow the instructions.
Create a file employees.json, add all your employee data, and save it in an S3 bucket. We‘ve put an example JSON file in the import directory so you can get an idea of which fields Yelp Love requires for an employee.
The S3 bucket name must be configured in config.py.
In order to access the S3 bucket you have to save AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY using the Secret model. Locally, you can temporarily add an endpoint inside loveapp/views/web.py and then navigate to it in your browser (e.g., http://localhost:8080/create_secrets):
@web_app.route('/create_secrets')
def create_secrets():
from loveapp.models import Secret
Secret(id='AWS_ACCESS_KEY_ID', value='change-me').put()
Secret(id='AWS_SECRET_ACCESS_KEY', value='change-me').put()
return "please delete me now"
In production you can use the Datastore UI.
To kick off the final import you have to run:
from loveapp.logic import employee
employee.load_employees()
You can also setup a cronjob to keep employee data up to date. Checkout cron.yaml for further details.
Before you can run Yelp Love on your local machine please install the Google App Engine SDK for Python. You can get it from Google directly or use your favorite packet manager.
- Check out the application code:
git clone [email protected]:Yelp/love.git
- Follow the Prepare for deployment section
- Run the app:
make run-dev
will start both Yelp Love as well as the Admin server - Follow the CSV import section to locally import user data
- Make your changes
When you bumped versions in the appropriate files you can deploy your changes by running
make deploy
.
If you are seeing the following error:
Error 404: --- begin server output ---
This application does not exist (project_id=u'PROJECT-ID'). To create an App Engine application in this project, run "gcloud app create" in your console.
This is because GAE is no longer automatically initialized, you must run gcloud app create
using the Google Cloud Shell (not your terminal...I know...confusing) before deploying on App Engine for the first time. See the screenshot below:
Once your code has been uploaded to Google, you must activate the newly deployed version in the Developer Console. Then you're done!
Yelp Love also ships with an API which will be available under https://project_id.appspot.com/api. All data of successful GET requests is sent as JSON.
Successful requests to the API require an API key. These can be created in the Admin section of the
application. Authenticating with an invalid API key will return 401 Unauthorized
.
All names, e.g. sender or recipient in the following examples refer to employee usernames.
GET /love?sender=foo&recipient=bar&limit=20
You must provide either a sender or a recipient. The limit parameter is optional - no limiting will be applied if omitted.
curl "https://project_id.appspot.com/api/love?sender=hammy&api_key=secret"
[
{
"timestamp": "2017-02-10T18:10:08.552636",
"message": "New Barking Release! <3",
"sender": "hammy",
"recipient": "darwin"
}
]
POST /love
Sending love requires 3 parameters: sender, recipient, and message. The recipient parameter may contain multiple comma-separated usernames.
curl -X POST -F "sender=hammy" -F "recipient=john,jane" -F "message=YOLO" -F "api_key=secret" https://project_id.appspot.com/api/love
Love sent to john, jane!
GET /autocomplete?term=ham
The autocomplete endpoint will return all employees which first_name, last_name, or username match the given term.
curl "https://project_id.appspot.com/api/autocomplete?term=ha&api_key=secret"
[
{
"label": "Hammy Yo (hammy)",
"value": "hammy"
},
{
"label": "Johnny Hamburger (jham)",
"value": "jham"
}
]
For more info check out the Authors file.
Yelp Love is licensed under the MIT license.
Everyone is encouraged to contribute to Yelp Love by forking the Github repository and making a pull request or opening an issue.