Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slack sink kamelet #429

Merged
merged 9 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/modules/ROOT/assets/images/kamelets/slack-sink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
* xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source]
* xref:ROOT:sftp-sink.adoc[image:kamelets/sftp-sink.svg[] SFTP Sink]
* xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source]
* xref:ROOT:slack-sink.adoc[image:kamelets/slack-sink.svg[] Slack Sink]
* xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source]
* xref:ROOT:sqlserver-sink.adoc[image:kamelets/sqlserver-sink.svg[] Microsoft SQL Server Sink]
* xref:ROOT:sqlserver-source.adoc[image:kamelets/sqlserver-source.svg[] Microsoft SQL Server Source]
Expand Down
130 changes: 130 additions & 0 deletions docs/modules/ROOT/pages/slack-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/slack-sink.svg[] Slack Sink

*Provided by: "Apache Software Foundation"*

*Support Level for this Kamelet is: "Preview"*

Send messages to a Slack channel.

== Configuration Options

The following table summarizes the configuration options available for the `slack-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *channel {empty}* *| Channel| The Slack channel to send messages to.| string| | `"#myroom"`
| *webhookUrl {empty}* *| Webhook URL| The webhook URL used by the Slack channel to handle incoming messages.| string| |
| iconEmoji| Icon Emoji| Use a Slack emoji as an avatar.| string| |
| iconUrl| Icon URL| The avatar that the component will use when sending message to a channel or user.| string| |
| username| Username| This is the username that the bot will have when sending messages to a channel or user.| string| |
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `slack-sink` can be used in various contexts.

=== Knative Sink

The `slack-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.slack-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: slack-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: slack-sink
properties:
channel: "#myroom"
webhookUrl: "The Webhook URL"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `slack-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f slack-sink-binding.yaml
----

==== *Binding to Knative using the Kamel CLI:*

The procedure described above can be simplified into a single execution of the `kamel bind` command:

[source,shell]
----
kamel bind channel/mychannel slack-sink -p "sink.channel=#myroom" -p "sink.webhookUrl=The Webhook URL"
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.

=== Kafka Sink

The `slack-sink` Kamelet can be used as Kafka sink by binding it to a Kafka topic.

.slack-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: slack-sink-binding
spec:
source:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: slack-sink
properties:
channel: "#myroom"
webhookUrl: "The Webhook URL"

----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Make also sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `slack-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f slack-sink-binding.yaml
----

==== *Binding to Kafka using the Kamel CLI:*

The procedure described above can be simplified into a single execution of the `kamel bind` command:

[source,shell]
----
kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic slack-sink -p "sink.channel=#myroom" -p "sink.webhookUrl=The Webhook URL"
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: slack-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "0.3.0"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaWQ9IkxheWVyXzEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMyNUQzNjY7fQoJLnN0MXtmaWxsOiNGRkZGRkY7fQoJLnN0MntmaWxsOiNGRjAwMDA7fQoJLnN0M3tmaWxsOiMzRDVBOTg7fQoJLnN0NHtmaWxsOnVybCgjU1ZHSURfMV8pO30KCS5zdDV7ZmlsbDp1cmw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IgdHJhbnNmb3JtPSJtYXRyaXgoMC45NTEgLTAuMzA5MSAwLjMwOTEgMC45NTEgLTc5LjMyNSAxMzAuODY4OSkiIHdpZHRoPSI4OC44IiB4PSIzMjguOSIgeT0iMjcxLjMiLz48L2c+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Slack"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Slack Sink"
description: |-
Send messages to a Slack channel.
required:
- channel
- webhookUrl
type: object
properties:
channel:
title: Channel
description: The Slack channel to send messages to.
type: string
example: "#myroom"
webhookUrl:
title: Webhook URL
description: The webhook URL used by the Slack channel to handle incoming messages.
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
iconEmoji:
title: Icon Emoji
description: Use a Slack emoji as an avatar.
type: string
iconUrl:
title: Icon URL
description: The avatar that the component will use when sending message to a channel or user.
type: string
username:
title: Username
description: This is the username that the bot will have when sending messages to a channel or user.
type: string
types:
out:
mediaType: application/json
dependencies:
- "camel:jackson"
- "camel:slack"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "slack:{{channel}}"
parameters:
webhookUrl: "{{webhookUrl}}"
iconEmoji: "{{?iconEmoji}}"
iconUrl: "{{?iconUrl}}"
username: "{{?username}}"
64 changes: 64 additions & 0 deletions slack-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: slack-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "0.3.0"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaWQ9IkxheWVyXzEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4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oLTAuOTUxIDAuMzA5MSAtMC4zMDkxIC0wLjk1MSAzMzEuOTg5NiAzNDAuMjQ1KSIgd2lkdGg9Ijg5LjQiIHg9Ijk0LjQiIHk9IjE1MS43Ii8+PHJlY3QgY2xhc3M9InN0MjAiIGhlaWdodD0iODguOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC45NTEgLTAuMzA5MSAwLjMwOTEgMC45NTEgLTEwNS43NDk4IDc5LjAzMDEpIiB3aWR0aD0iODkuNCIgeD0iMTUxLjgiIHk9IjMyOC44Ii8+PHJlY3QgY2xhc3M9InN0MjEiIGhlaWdodD0iODguOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC45NTEgLTAuMzA5MSAwLjMwOTEgMC45NTEgLTc5LjMyNSAxMzAuODY4OSkiIHdpZHRoPSI4OC44IiB4PSIzMjguOSIgeT0iMjcxLjMiLz48L2c+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Slack"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Slack Sink"
description: |-
Send messages to a Slack channel.
required:
- channel
- webhookUrl
type: object
properties:
channel:
title: Channel
description: The Slack channel to send messages to.
type: string
example: "#myroom"
webhookUrl:
title: Webhook URL
description: The webhook URL used by the Slack channel to handle incoming messages.
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
iconEmoji:
title: Icon Emoji
description: Use a Slack emoji as an avatar.
type: string
iconUrl:
title: Icon URL
description: The avatar that the component will use when sending message to a channel or user.
type: string
username:
title: Username
description: This is the username that the bot will have when sending messages to a channel or user.
type: string
types:
out:
mediaType: application/json
dependencies:
- "camel:jackson"
- "camel:slack"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "slack:{{channel}}"
parameters:
webhookUrl: "{{webhookUrl}}"
iconEmoji: "{{?iconEmoji}}"
iconUrl: "{{?iconUrl}}"
username: "{{?username}}"