A Slack integration pack for Flyte
3.2K
See https://github.com/HotelsDotCom/flyte-slack
Respond to, and send Slack messages in your Flyte flows.
Ensure you are already running Flyte locally (see Quick Start at https://hub.docker.com/r/hotelsdotcom/flyte/ ), then start the pack up:
docker run -d \
-e FLYTE_API=http://flyte:8080 \
-e FLYTE_SLACK_TOKEN=xoxp-xxxxx-xxxxx-xxxxx-xxxxx \
-e FLYTE_SLACK_DEFAULT_JOIN_CHANNEL=A12B34C56 \
--link flyte:flyte \
hotelsdotcom/flyte-slack
Now you have the pack running, you can create a simple flow that uses it.
Create the following flow in a local file helloworld.json :
{
"name": "echo",
"description": "Echo for debugging",
"steps": [
{
"id": "hello_world",
"event": {
"packName": "Slack",
"name": "ReceivedMessage"
},
"criteria": "{{ Event.Payload.message|match:'^flyte hello world$' }}",
"command": {
"packName": "Slack",
"name": "SendMessage",
"input": {
"channelId":"{{ Event.Payload.channelId }}",
"message":"You said {{ Event.Payload.message }}"
}
}
}
]
}
Then upload this to your local Flyte curl -fsd @helloworld.json http://localhost:8080/v1/flows
If you now enter the Slack channel you specified in FLYTE_SLACK_DEFAULT_JOIN_CHANNEL you should be able to type flyte hello world and get back the response you said flyte hello world.
You can also check the logs from Flyte - you should see confirmation the Slack pack has registered itself with Flyte, your helloworld flow, and that a message was received from Slack and the flow complete with a status of SUCCESS:
[INFO] 2018/04/20 11:26:12 handler.go:47: Pack registered: PackId=Slack
[INFO] 2018/04/20 11:28:17 handler.go:46: Flow flowName=helloworld added to repo
[INFO] 2018/04/20 11:28:30 handler.go:50: Received Event: EventName=ReceivedMessage Pack=&{Id:Slack Name:Slack Labels:map[]}
[INFO] 2018/04/20 11:28:30 flow.go:53: Action has been created actionId=5ad9cededb30a10007748b47
[INFO] 2018/04/20 11:28:32 handler.go:135: Action actionId=5ad9cededb30a10007748b47 taken
[INFO] 2018/04/20 11:28:32 handler.go:81: Received Event: EventName=MessageSent Pack=&{Id:Slack Name:Slack Labels:map[]}
[INFO] 2018/04/20 11:28:32 handler.go:98: Action with actionId=5ad9cededb30a10007748b47 has been completed, new state=SUCCESS
The plugin is configured using environment variables:
| ENV VAR | Default | Description | Example |
|---|---|---|---|
| FLYTE_API | - | The API endpoint to use | http://localhost:8080 |
| FLYTE_SLACK_TOKEN | - | The API token to use | token_abc |
| FLYTE_SLACK_DEFAULT_JOIN_CHANNEL | - | A channel to join by default when launched | 1234 |
| FLYTE_SLACK_BACKUP_DIR | $TMPDIR | Directory where to backup joined channels | /flyte-slack |
Content type
Image
Digest
Size
7.2 MB
Last updated
almost 6 years ago
docker pull hotelsdotcom/flyte-slack