actions_slack.md 1.83 KB
Newer Older
1
2
3
4
5
6
7
---
title: Slack Actions
html_title: Creating Slack Actions for Signals Alerting
slug: elasticsearch-alerting-actions-slack
category: actions
order: 400
layout: docs
8
edition: beta
9
description:
10
11
12
13
---

<!--- Copyright 2019 floragunn GmbH -->

Nils Bandener's avatar
Nils Bandener committed
14
# Slack Action
15
16
17
18
{: .no_toc}

{% include toc.md %}

Nils Bandener's avatar
Nils Bandener committed
19
20
21
22
23

Use Slack actions to send notifications via Slack. You can use Mustache templates to define dynamic content for the Slack message.

## Prerequisites

Nils Bandener's avatar
Nils Bandener committed
24
In order to use Slack actions, you need to configure a Slack webhook using the accounts registry of Signals. See the [accounts registry documentation](accounts.md) for more on that.
Nils Bandener's avatar
Nils Bandener committed
25
26
27
28
29

## Basic Functionality

A basic Slack action looks like this:

30
<!-- {% raw %} -->
Nils Bandener's avatar
Nils Bandener committed
31
32
33
34
35
36
37
38
39
40
41
42
43
```json
 {
	"actions": [
		{
			"type": "slack",
			"name": "my_slack_action",
			"throttle_period": "1h",
			"account": "internal_slack",
			"text": ":warning:\n**Bad destination weather** for {{data.bad_weather_flights.hits.total.value}} flights over last {{data.constants.window}}"
		}
	]
}
```
44
<!-- {% endraw %} -->
Nils Bandener's avatar
Nils Bandener committed
45
46
47
48
49
50
51
52
53

The basic configuration attributes are:

**name:** A name identifying this action. Required.

**throttle_period:** The throttle period. Optional. Specify the time duration using an *amount*, followed by its *unit*. Supported units are m (minutes), h (hours), d (days), w (weeks). For example, `1h` means one hour.

**checks:** Further checks which can gather or transform data and decide whether to execute the actual action. Optional.

Nils Bandener's avatar
Links    
Nils Bandener committed
54
**account:** Identifies the Slack application which shall be used for sending the message. See the [accounts registry documentation](accounts.md).
Nils Bandener's avatar
Nils Bandener committed
55
56

**text:** Defines the content of the message. Mustache templates can be used to render attributes from the watch runtime data. Optional. See the [Slack documentation](https://api.slack.com/messaging/composing/formatting) for details on how to format the message.