- PHP 7.1
- MySQL
- Composer
Create a #big-board
channel.
-
Click Create New App.
-
Do click the "Interested in the next generation of apps?" link. This will take you to the Developer Previvew page.
-
Click "Create a developer preview app".
-
Name it TobyBot and choose your team's workspace.
-
Allow the following permission scopes:
commands
channels:history
channels:read
channels:write
chat:write:user
emoji:read
pins:write
users.profile:read
users.profile:write
users:read
users:write
channels:manage
channels:join
chat:write.public
-
Click "Slash Commands". Create these seven commands. For each one, define the Request URL as
http://[YOURAPP].herokuapp.com/tobybot
. Include Descriptions and Usage Hints as desired./board
/solve
/info
/connect
- Go here
- Click "Create credentials". Choose "OAuth client ID".
- Add Authorized JavaScript origins
https://[YOURAPP].herokuapp.com
- Add Authorized redirect URIs:
https://[YOURAPP].herokuapp.com
https://[YOURAPP].herokuapp.com/oauth
- Note your Client ID and Client secret.
- Add the privacy policy URL (
http://your-domain/privacy
) to your OAuth consent screen. Once your app is live, you'll need to go through the verification process here) to get rid of the "unverified app" screen. - Create a separate credential for testing. Add
http://localhost:8888
to Authorized JavaScript origins andhttp://localhost:8888
andhttp://localhost:8888/oauth
to Authorized Redirect URI's for that one - Click "Create credentials" again and choose "Service Account". Download the JSON for login info here for later.
- At https://console.developers.google.com/apis/dashboard?project=[your-project-name], enable the google drive api and the picker api
- Enable auth/drive.file scope at https://console.developers.google.com/apis/credentials/consent/edit?project=[your-project-id]
- Click "Create credentials" again and choose "API Key"
Provision a MySQL add-on. I used ClearDB. Create a DB. Note your:
- URL
- DB name
- username
- password
Provision Heroku Redis. heroku addons:create heroku-redis:hobby-dev -a your-app-name
Allow workers on Heroku. heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
Define these locally and Heroku. Locally: copy envvars_example.config
to envvars.config
, fill out the fields, and run source envars.config
. On Heroku: config variables are in the settings tab.
Some notes on figuring these out:
Database configuration
BIG_BOARD_DB_HOST
BIG_BOARD_DB_NAME
BIG_BOARD_DB_USERNAME
BIG_BOARD_DB_PASSWORD
On Heroku - there's a CLEARDB_DATABASE_URL
config variable which is in the format mysql://BIG_BOARD_DB_USERNAME:BIG_BOARD_DB_PASSWORD@BIG_BOARD_DB_HOST/BIG_BOARD_DB_NAME?reconnect=true
.
Locally - Run mysql and create a database and a user. host is localhost, the rest is what you set while creating this.
Google Drive configuration
GOOGLE_APP_ID
- the project number in the google cloud consoleGOOGLE_CLIENT_ID
- you got this while setting up google credentials earlierGOOGLE_CLIENT_SECRET
- sameGOOGLE_DEVELOPER_KEY
- the API key you got while setting up google credentialsGOOGLE_DRIVE_ID
- go to google drive for your team folder, look at the url - it's the long id string there. Similarly forGOOGLE_DOCS_TEMPLATE_ID
GOOGLE_SERVICE_ACCOUNT_APPLICATION_CREDENTIALS
- this is the json for when you made the service account credential
Slack configuration
SLACK_DOMAIN
- just the id, without any dots or the slack.com domain -- e.g. palindrome2018TOBYBOT_SLACK_KEY
- OAuth Access token. Starts withxoxa
.TOBYBOT_VERIFICATION_TOKEN
- Verification Token, listed under Basic Information. 24 characters long.BIGBOARDBOT_SLACK_KEY
- Bot User OAuth Access Token for a standard bot. Starts withxoxb
.
Other
SIDEBAR_TEAM_INFO
- data that goes in Big Board sidebar. Semicolon separated; each semicolon starts a new line.
Run:
composer install --ignore-platform-reqs
At this point, make sure all the installed libraries (which are at vendor/bin/
) are on your PATH. Then run:
composer dump-autoload
propel config:convert
propel sql:insert
propel migrate --fake
You can run the app locally with e.g.
php -S localhost:8888
To set up the DB on Heroku, first push, then run:
heroku run bash
propel sql:insert
Set up automatic deployments by connecting your Heroku instance to your GitHub repo.