Skip to content

GraphStory/slack-neo4j

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neo4j Slack Integration

Small Python server to integrate Slack with Neo4j the open source graph database.

graph things

First steps are to import users and channels and list them and run queries in our Neo4j query language Cypher on top of that data.

Usage

Webapp

git clone http://github.com/neo4j-examples/slack-neo4j

pip install -r requirements.txt

export NEO4J_URL=http://localhost:7474
export SLACK_TOKEN=xop-34987294-23423-324
export TEAM_TOKEN=fVowo4UQVpajf394802fakj
python app.py 8001

curl http://localhost:8001
curl -XPOST http://localhost:8001/slack

Push to Heroku

The application already contains a Procfile for Heroku to run with the port provided. You can use a Neo4j instance on GrapheneDB or GraphStory for your experiments.

git clone http://github.com/neo4j-examples/slack-neo4j
heroku apps:create my-slack-neo4j
git remote add heroku https://git.heroku.com/my-slack-neo4j.git

heroku config:set NEO4J_URL=http://server:port
heroku config:set NEO4J_URL=http://localhost:7474
heroku config:set TEAM_TOKEN=fVowo4UQVpajf394802fakj

git push heroku master

Integration with Slack

Configure a /graph slash command that interacts with your server, e.g. http://my-slack-neo4j.herokuapp.com/slack

Setup a Slack-API token and note it down and configure it as SLACK_TOKEN to retrieve data from slack.

Note down the team token and configure it with your app as TEAM_TOKEN

Add infos for these commands

  • list overview

  • [import] …​ Import Users and Channels into Neo4j

  • [cypher] query …​ Run Cypher query

Implementation Notes

Howto Integrate Slash commants https://api.slack.com/slash-commands They POST a payload to our /slack endpoint like this

token=gIkuvaNzQIHg97ATvDxqgjtO
team_id=T0001
team_domain=neo4j
channel_id=C2147483705
channel_name=test
user_id=U2147483697
user_name=Steve
command=/graph
text=cypher match (u:User) return u.name

Idea: dispatch on first word as command:

  • nothing → list statistics

  • cypher query → run cypher query and return results (todo only allow read-only queries)

  • import → import users and channels idempotently

About

Neo4j Slack Integration Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%