WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

DenktMit-eG/ws-chat-to-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple Websocket to Slack bridge for anonymous web chats

This repository holds a simple go application which is at the same time a client/bot for the https://slack.com/ system as well as a simplistic websocket server which speaks a {nickname:str, msg:str} JSONL protocol which allows to trivially implement a client side chat service in a website. This way, externals can quickly communicate within a slack channel without authentification.

This is inspired by the matrix bridge. The go code is basically vibe coded, with minor enhancements.

Usage

In order to run the bot, you need two credentials:

  1. Slack app token: Go to https://api.slack.com/apps and click on create new app. The token begins with xapp-...
  2. Slack bot token: Install your app in a slack org. You then get the bot user OAuth token displayed, which begins with xoxb-...

Currently there are no slash commands or so, you have to decide at runtime which channel the bot shall join. This reads something like C1234567ABC and can be read off the URL when opening the channel in the browser.

In order to test the code, run it like

# defining your slack workspace
export SLACK_BOT_TOKEN="xoxb-..."

# defining your bot/app
export SLACK_APP_TOKEN="xapp-..."

# defining your channel
export SLACK_CHANNEL_ID="C1234567ABC"

export WS_ADDR=":8080"                      # optional
export PEOPLE_POLL_INTERVAL="30s"           # optional
# export COUNT_BOTS_AS_PEOPLE=false         # optional

go run .

For testing locally, spin up websocat ws://localhost:8080/ws and test chatting.

Deployment

The repo brings a Makefile and Dockerfile for generating a slim container. It also contains the k8s definitions for the deployment made. Since this is a write-once project, we don't have CI/CD and ship manually.

Restarting the pod with a new code means basically

export KUBECONFIG="..." # make sure you have access
make docker
kubectl rollout restart deployment ws-chat-to-slack -n svenk

The deployment is currently taking place to https://ws-chat-to-slack.denktmit.tech/ws

About

A little website chat bot which bridges Slack to a simpler no-auth websocket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published