Skip to content

tchiotludo/slack2hangoutschat-webhook

Repository files navigation

slack2hangoutschat-webhook

Slack 2 Google HangoutChat webhook converter

license npm Dependency Status devDependency Status

This project convert and forward all incoming Slack webhook to Hangouts chat. In an opinionated way, it expose a webserver to that will proxy Slack webhook to Google chat Api.

Online demo

https://slack2hangouts-chat.now.sh/

Installation

Docker

docker run -d \
    -p 3000:3000 \
    tchiotludo/slack2hangoutschat-webhook

Go to http://localhost:3000 for instruction

Local

git clone https://github.com/tchiotludo/slack2hangoutschat-webhook
cd slack2hangoutschat-webhook
npm install
npm run watch # for dev with watch
npm run build && NODE_ENV="production" npm run start # build and start

Go to http://localhost:3000 for instruction

Azure App

  • Create a Http Trigger
  • npm install slack2hangoutschat-webhook
  • update to index.js with this content
const webhook = require('slack2hangoutschat-webhook/dist/webhook');
module.exports = webhook.Webhook.azure
  • Deploy to azure

Api Usage

npm install slack2hangoutschat-webhook
import { Converter } from "slack2hangoutschat-webhook";

console.log(Converter.convert({{
   "attachments": [
       {
           "fallback": "Required plain-text summary of the attachment.",
           "color": "#36a64f",
           "pretext": "Optional text that appears above the attachment block",
           "author_name": "Bobby Tables",
           "author_link": "https://gsuite.google.com/products/chat/",
           "author_icon": "https://www.gstatic.com/images/branding/product/2x/chat_64dp.png",
           "title": "Slack API Documentation",
           "title_link": "https://api.slack.com/",
           "text": "Optional text that appears within the attachment",
           "fields": [
               {
                   "title": "Priority",
                   "value": "High",
                   "short": false
               }
           ],
           "image_url": "https://assets.brandfolder.com/oox8px-b08c7c-5m1qjd/original/full-color-mark%202x.png",
           "thumb_url": "https://assets.brandfolder.com/oox90q-9q2cew-bw1vdr/view.png",
           "footer": "Slack API",
           "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
           "ts": 123456789
       }
   ]
})

License

MIT © tchiotludo