https://github.com/dpca/slack-fooda-bot
Slack bot that looks up and remembers popups from Fooda
https://github.com/dpca/slack-fooda-bot
fooda slack
Last synced: 4 months ago
JSON representation
Slack bot that looks up and remembers popups from Fooda
- Host: GitHub
- URL: https://github.com/dpca/slack-fooda-bot
- Owner: dpca
- License: mit
- Created: 2016-10-23T14:36:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T14:03:28.000Z (over 3 years ago)
- Last Synced: 2025-07-29T08:41:05.533Z (11 months ago)
- Topics: fooda, slack
- Language: Ruby
- Homepage:
- Size: 82 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/dpca/slack-fooda-bot)
[](https://codeclimate.com/github/dpca/slack-fooda-bot)
[](https://coveralls.io/github/dpca/slack-fooda-bot?branch=master)
* * *
# fooda-bot

Slack bot that looks up current events from [Fooda](https://www.fooda.com/) and
remembers reactions for when they come around again. Lets everyone in a
channel, such as "#lunch", know both the restaurant popup for the day and the
reactions that were used when it last came around.
Also supports [Peach](https://www.peachd.com/).
## Setup
Set the following in `.env`:
* `SLACK_API_TOKEN` - Slack token (see below)
* `SLACK_CHANNEL` - channel to post in
* `SLACK_USERNAME` - bot name
* `SLACK_ICON_EMOJI` - bot icon
* `FOODA_URL` - fooda url for your popup space, e.g. "fooda.com/idb". For
multiple fooda locations, provide a comma-separated list like
"fooda.com/company1, fooda.com/company2"
* `PEACH_HOME_LOCATION_ID` - Peach API location ID, can be found by looking at
network requests to `/api/locations/LOCATION_ID` when loading the peach site
* `PEACH_REFERRAL_CODE` - Peach referral code for rewards
Fooda-bot uses [Redis](http://redis.io/) to remember its message history and
look up the last restaurant reactions. If running with docker, this is taken
care of, otherwise ensure that redis is either running locally or set
`REDIS_URL` in your `.env` or environment to point it to a redis instance. All
fields that fooda-bot sets in redis are prefixed with "fooda-bot:".
You can request a token for testing purposes from
https://api.slack.com/docs/oauth-test-tokens but should use a bot token from
https://my.slack.com/services/new/bot for a real deployment. Read more about
bot users here: https://api.slack.com/bot-users.
## Run with Docker
```
docker-compose up
```
## Run locally
`bundle install` first.
Use `bin/run.rb` to look up and post about the day's fooda event in the
morning, and `bin/ask_for_ratings.rb` to ask for reactions in the afternoon.
These two actions are separate to increase likelihood that users remember to
leave an emoji rating - they don't have to go back to the morning's message
after they've eaten lunch.
To run on a schedule, use cron. For example, `0 11 * * 1-5 bin/run.rb` to run
at 11 AM on weekdays and `0 14 * * 1-5 bin/ask_for_ratings.rb` to ask for
ratings at 2 PM.
## Test
```
bundle exec rspec spec
```