Sign inSign up

jguyomard/slackbot-links

By jguyomard

•Updated over 8 years ago

A Slack Bot, to save all shared links to ElasticSearch

Image
0

1.2K

jguyomard/slackbot-links repository overview

Do you use Slack? Do you share links with your co-workers? SlackBot-Links store all theses urls, enrich them with metadata, and expose them through a REST API. You can now find shared urls by searching in their title, content, author name...

⁠Get Started

go get github.com/jguyomard/slackbot-links

Note: You need to set GOPATH correctly before running this.

⁠2. Create a new bot on Slack⁠

Once you create this bot, you will get an API token. Create config.yaml and edit it to add your bot token:

cp $GOPATH/src/github.com/jguyomard/slackbot-links/config.yaml.sample /etc/slackbot-links/config.yaml
vi /etc/slackbot-links/config.yaml

Then, invite this bot to channels of your choice (#links for instance).

This bot use Elastic Search 5.x to save links. The client connects to Elasticsearch on http://localhost:9200 by default.

For instance, to start Elastic Search using official docker image:

docker run -d -p 9200:9200 elasticsearch:5
⁠4. Run this bot

if $PATH contains $GOPATH/bin, slackbot-links command is now available:

slackbot-links -config-file=/etc/slackbot-links/config.yaml

Your bot is live! You can now share link on #links and fetch them using REST API :

curl localhost:9300/v1/links/

⁠API

REST API Documentation can be found here⁠.

This documentation is generated from API.apib file (API Blueprint syntax):

make docapi

⁠Docker image

You can also run this slackbot using its Docker image:

docker run -d --name slackbot-links -p 9300:9300 -v $PWD/config.yaml:/etc/slackbot-links/config.yaml jguyomard/slackbot-links

If you also need to run ElasticSearch, prefer docker-compose:

docker-compose up

⁠Commands

⁠restore

This command recreates the Elasticsearch index from a given links.log log file. This is very useful for fast testing with a given scenario, or for initializing a staging environment, for instance.

slackbot-links -config-file=/etc/slackbot-links/config.yaml -links-file=./links-tests.log restore

If a link already exists (same ID), it is updated.

⁠Testing

To run the test suite:

make test

⁠Issues

If you have any problems with or questions about this Service Provider, please contact me through a GitHub issue⁠.

⁠Contributing

You are invited to contribute new features, fixes or updates to this container, through a Github Pull Request⁠.

Tag summary

Content type

Image

Digest

Size

7.1 MB

Last updated

over 8 years ago

docker pull jguyomard/slackbot-links