A Latex-rendering app for Slack.
- Send Slack messages with rendered latex code using a slash command
- Preview your messages before making them public
- Edit your messages
slack_latex is a Slack app, and needs a server to run on. It can be run easily on your machine using a tool like ngrok, or on a PaaS such as Heroku.
- Download the source, navigate into the parent
slack_latex
directory and run
pip install .
- Download and install ngrok and run
ngrok http 4390
- Make note of the forwarding url ngrok gives you - you will need it when you're adding the app to Slack.
- Complete the steps in the section below to add the app to Slack.
- Once you have added the app to Slack, export the token and verification token you received from Slack as environment variables:
export $SLACK_TOKEN=[token]
export $VERIFICATION_TOKEN=[verification token]
- Run the app with
python slack_latex/run.py
Note: the files Procfile
and runtime.txt
are only needed for running on Heroku. If you are not using Heroku, you do not need these files.
- Set up a (free) Heroku account, and install the Heroku cli. Follow the instructions to login to your Heroku account from the cli.
- Navigate into the parent
slack_latex
directory, and run
heroku create
git push heroku master
- Make a note of the url Heroku gives you - you will need it when you're adding the app to Slack. You can find the url by running
heroku open
- Complete the steps in the section below to add the app to Slack.
- Once you have added the app to Slack, you'll need to configure Heroku with the token and verification token you received from Slack:
heroku config:set SLACK_TOKEN=[token]
heroku config:set VERIFICATION_TOKEN=[verification token]
- From your Slack team, navigate to the Apps and Integrations page -> Build -> Your Apps.
- Create a new app, and fill out the relevant information. Under Basic Information, you will find the verification token for your app. This is the token you should use for the
$VERIFICATION_TOKEN
variable. - Visit the Interactive Messages section, and under Request URL enter
[your url]/button
, where[your url]
is the url you were given by ngrok or Heroku. - Visit the Slash Commands section, and add two new commands. Name the first
/latex
, and under Request URL enter[your url]/latex
. Name the other/latexedit
, and under Request URL enter[your url]/latexedit
. - Visit the Slack legacy token page, and obtain a token. This is the token you should use for the
$SLACK_TOKEN
variable.
To post a Latex message, use the command /latex [latex code]
. The Latex code need not contain $ ... $
or \( ... \)
. You will then be shown a preview of your message; from there you can either make the message public or edit the message. To edit the message, press the edit button and then use the command /latexedit [latex code]
.