Sign inSign up

jeremija/slack2spark

By jeremija

•Updated over 8 years ago

Adapter that receives Slack-compatible webhooks and converts them to Cisco Spark webhooks

Image
0

270

jeremija/slack2spark repository overview

⁠slack2spark

Build Status Docker Build

Work in progress. Adapter that receives Slack-compatible webhooks and converts them to Cisco Spark-compatible webhooks

⁠Usage

# clone this repository
git clone https://github.com/jeremija/slack2spark
cd slack2spark

# install dependencies
npm install

# run the tests
npm test

# start the application
npm start

# start the server on port 8443, and use HTTPS
HTTPS=1 PORT=8443 node index.js

Post a slack-compatible message to: http://localhost:3000/app/message⁠ and it will be forwarded to the configured space on Spark. Make sure the user whose token is used is added to that space.

⁠Docker

This project is available on Docker Hub: jeremija/slack2spark⁠.

To enable HTTPS via docker, put your SSL/TLS certificates in /etc/ssl/certs (or similar) folder run the docker image:

docker run -p 443:3000 \
  -v /etc/ssl/certs:/app/config/ssl
  -e HTTPS=1 \
  -e NODE_CONFIG='{"app":{"ssl":{"cert":"./config/ssl/cert.pem","key":"./config/ssl/cert.key"}}}' \
  jeremija/slack2spark

⁠Configuring Cisco Spark

Go to My Apps⁠ in Cisco Spark for Developers section. Create a new bot. Copy Bot's Access Token. Go to Cisco Spark app and add your newly created bot to a space, using the Bot Username field. Go to Get Room Details⁠ or List Rooms⁠ endpoint and get the id of your room.

Next, add this information to your configuration, for example config/local.yaml:

---
app:
  accessToken: 'changeme'

spark:
  token: '<token of your newly created bot>'
  spaces:
    - name: 'room-name'
      roomId: '<id of your room>'

After the app is started, slack-compatible incoming webhooks⁠ will be forwarded to the configured space on Spark:

curl -X POST 'localhost:3000/api/messages/room-name?token=changeme' \
  -H 'Content-type: application/json' \
  -d '{"text": "test", "attachments": [{"text":"test"}]}'

or

curl -X POST http://localhost:3000/api/messages/room-name \
  -H 'Authorization: Token changeme' \
  -H 'Content-type: application/json' \
  -d '{"text": "test"}'

or

curl -X POST http://localhost:3000/api/messages/room-name?token=changeme \
  --data-urlencode 'payload={"text":"test"}'

⁠Config Files

This project uses node-config⁠ module. Configure config/default.yaml or add config/local.yaml. External configuration is available through the NODE_CONFIG environment variable, in the form of a JSON string.

⁠License

ISC

Tag summary

Content type

Image

Digest

Size

42.6 MB

Last updated

over 8 years ago

docker pull jeremija/slack2spark