slack-mastodon mirrors your Mastodon feed to a Slack channel
slack-mastodon is based on pansapiens/masto2slack, which performs a similar function but for your own posts. I started from that repo, adjusted for my own build process, and tweaked the code to use the user's timeline instead of their own posts.
You'll need to:
- On your Mastodon server, create a 'new application' and get an access token (
access_token) (you can do this underhttps://<your_instance>/settings/applications/newin the web interface). You'll needreadaccess. - Create a Slack App, grant it the chat:write and link:write bot scopes, and install to your workspace.
- Create a configuration file,
~/.config/slack-mastodon/config.yml, as below.
Example ~/.config/slack-mastodon/config.yml:
slack:
bot_token: xoxb-BLAH
channel: C04GDJLJASD
mastodon:
server: https://mastodon.social
access_token: TOKENEither create a cronjob (crontab -e) to call slack-mastodon every 5 mins (or longer):
*/5 * * * * /usr/local/bin/slack-mastodon update >/dev/null 2>&1
(this assumes you've copied slack-mastodon to /usr/local/bin/slack-mastodon)
Alternatively, run:
watch -n 300 ./slack-mastodon update
to check for new posts every 5 mins (300 seconds).
go install github.com/akerl/slack-mastodon@latest
slack-mastodon is released under the MIT License. See the bundled LICENSE file for details.