This is a work in progress Slack source using Knative Eventing Sources to bridge Slack events via a Slack App/Bot to a Kubernetes Cluster running the Knative Eventing stack.
You will need Knative and ko setup and installed with a running k8s cluster.
- Get Slack App API keys in the Slack Admin Console.
- Replace the base64 encoded keys in
config/once/secret.yaml
- Then,
kubectl apply -f config/once/secret.yaml
- Replace the base64 encoded keys in
- Install the Slack Source,
ko apply -f config/
Optionally install one of the demos inside of ./config/demo
or write your own.
Slack Source creates a Container Source running a RTM connection to Slack using
the provided API keys. Applying config/slack.yaml
also creates 2 channels and
a subscription for the Slack Source to receive messages from within the cluster.
Slack -> Source -> channel/slack-in
The Slack Source only forwards cloudevents of type slack.Message to slack-in
.
channel/slack-out -> Source -> Slack
The Slack Source is only looking for CloudEvents with Response objects.
type Response struct {
Channel string
Text string
}
The receiver demo just prints to the pod log.
The echo demo looks for slack.Message events and if the message.Text starts with
"echo "
then sends a new cloudevent to slack-out
with the same text with
"echo "
trimmed off to the same channel as it was sent.