Giter Site home page Giter Site logo

slack-neo4j's Introduction

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

slack-neo4j's People

Contributors

jexp avatar

Watchers

Ed Finkler avatar Jeremy Kendall avatar James Cloos avatar Greg Jordan avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.