Skip to content

Commit 2d5f0a5

Browse files
feat(alerting): ClickUp alerting provider (#1462)
* feat(alerting): Add ClickUp alerting provider * test: added ClickUp tests, docs in README and switch http to github.com/TwiN/gatus/v5/client from http.Client * docs: Update ClickUp API token instructions in README * fix(alerting): Update ClickUp alert configuration and default values * docs: fixed formatting and removed line breaks from content in README * feat(alerting): Add group-specific overrides and validation checks, updated README * Update alerting/provider/clickup/clickup.go Co-authored-by: PythonGermany <[email protected]> * fix(alerting): add priority validation * fix(alerting): set default priority to 3 * feat(alerting): add priority map for ClickUp provider * feat(alerting): make notify-all configurable for ClickUp provider * docs: add instructions for finding Assignee IDs for ClickUp * refactor(alerting): simplified ClickUp configurations example * refactor(alerting): clean up new lines in ClickUp provider --------- Co-authored-by: PythonGermany <[email protected]>
1 parent 6c8761c commit 2d5f0a5

File tree

9 files changed

+690
-0
lines changed

9 files changed

+690
-0
lines changed

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Have any feedback or questions? [Create a discussion](https://github.com/TwiN/ga
5858
- [Tunneling](#tunneling)
5959
- [Alerting](#alerting)
6060
- [Configuring AWS SES alerts](#configuring-aws-ses-alerts)
61+
- [Configuring ClickUp alerts](#configuring-clickup-alerts)
6162
- [Configuring Datadog alerts](#configuring-datadog-alerts)
6263
- [Configuring Discord alerts](#configuring-discord-alerts)
6364
- [Configuring Email alerts](#configuring-email-alerts)
@@ -827,6 +828,7 @@ endpoints:
827828
| Parameter | Description | Default |
828829
|:---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:--------|
829830
| `alerting.awsses` | Configuration for alerts of type `awsses`. <br />See [Configuring AWS SES alerts](#configuring-aws-ses-alerts). | `{}` |
831+
| `alerting.clickup` | Configuration for alerts of type `clickup`. <br />See [Configuring ClickUp alerts](#configuring-clickup-alerts). | `{}` |
830832
| `alerting.custom` | Configuration for custom actions on failure or alerts. <br />See [Configuring Custom alerts](#configuring-custom-alerts). | `{}` |
831833
| `alerting.datadog` | Configuration for alerts of type `datadog`. <br />See [Configuring Datadog alerts](#configuring-datadog-alerts). | `{}` |
832834
| `alerting.discord` | Configuration for alerts of type `discord`. <br />See [Configuring Discord alerts](#configuring-discord-alerts). | `{}` |
@@ -911,6 +913,72 @@ If the `access-key-id` and `secret-access-key` are not defined Gatus will fall b
911913
Make sure you have the ability to use `ses:SendEmail`.
912914

913915

916+
#### Configuring ClickUp alerts
917+
918+
| Parameter | Description | Default |
919+
| :--------------------------------- | :----------------------------------------------------------------------------------------- | :------------ |
920+
| `alerting.clickup` | Configuration for alerts of type `clickup` | `{}` |
921+
| `alerting.clickup.list-id` | ClickUp List ID where tasks will be created | Required `""` |
922+
| `alerting.clickup.token` | ClickUp API token | Required `""` |
923+
| `alerting.clickup.api-url` | Custom API URL | `https://api.clickup.com/api/v2` |
924+
| `alerting.clickup.assignees` | List of user IDs to assign tasks to | `[]` |
925+
| `alerting.clickup.status` | Initial status for created tasks | `""` |
926+
| `alerting.clickup.priority` | Priority level: `urgent`, `high`, `normal`, `low`, or `none` | `normal` |
927+
| `alerting.clickup.notify-all` | Whether to notify all assignees when task is created | `true` |
928+
| `alerting.clickup.name` | Custom task name template (supports placeholders) | `Health Check: [ENDPOINT_GROUP]:[ENDPOINT_NAME]` |
929+
| `alerting.clickup.content` | Custom task content template (supports placeholders) | `Triggered: [ENDPOINT_GROUP] - [ENDPOINT_NAME] - [ALERT_DESCRIPTION] - [RESULT_ERRORS]` |
930+
| `alerting.clickup.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
931+
| `alerting.clickup.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
932+
| `alerting.clickup.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` |
933+
| `alerting.clickup.overrides[].*` | See `alerting.clickup.*` parameters | `{}` |
934+
935+
The ClickUp alerting provider creates tasks in a ClickUp list when alerts are triggered. If `send-on-resolved` is set to `true` on the endpoint alert, the task will be automatically closed when the alert is resolved.
936+
937+
The following placeholders are supported in `name` and `content`:
938+
939+
- `[ENDPOINT_GROUP]` - Resolved from `endpoints[].group`
940+
- `[ENDPOINT_NAME]` - Resolved from `endpoints[].name`
941+
- `[ALERT_DESCRIPTION]` - Resolved from `endpoints[].alerts[].description`
942+
- `[RESULT_ERRORS]` - Resolved from the health evaluation errors
943+
944+
```yaml
945+
alerting:
946+
clickup:
947+
list-id: "123456789"
948+
token: "pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
949+
assignees:
950+
- "12345"
951+
- "67890"
952+
status: "in progress"
953+
priority: high
954+
name: "Health Check Alert: [ENDPOINT_GROUP] - [ENDPOINT_NAME]"
955+
content: "Alert triggered for [ENDPOINT_GROUP] - [ENDPOINT_NAME] - [ALERT_DESCRIPTION] - [RESULT_ERRORS]"
956+
957+
endpoints:
958+
- name: website
959+
url: "https://twin.sh/health"
960+
interval: 5m
961+
conditions:
962+
- "[STATUS] == 200"
963+
alerts:
964+
- type: clickup
965+
send-on-resolved: true
966+
```
967+
968+
To get your ClickUp API token follow: [Generate or regenerate a Personal API Token](https://developer.clickup.com/docs/authentication#:~:text=the%20API%20docs.-,Generate%20or%20regenerate%20a%20Personal%20API%20Token,-Log%20in%20to)
969+
970+
To find your List ID:
971+
972+
1. Open the ClickUp list where you want tasks to be created
973+
2. The List ID is in the URL: `https://app.clickup.com/{workspace_id}/v/l/li/{list_id}`
974+
975+
To find Assignee IDs:
976+
977+
1. Go to `https://app.clickup.com/{workspace_id}/teams-pulse/teams/people`
978+
2. Hover over a team member
979+
3. Click the 3 dots (overflow menu)
980+
3. Click `Copy member ID`
981+
914982
#### Configuring Datadog alerts
915983

916984
> ⚠️ **WARNING**: This alerting provider has not been tested yet. If you've tested it and confirmed that it works, please remove this warning and create a pull request, or comment on [#1223](https://github.com/TwiN/gatus/discussions/1223) with whether the provider works as intended. Thank you for your cooperation.

alerting/alert/type.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const (
88
// TypeAWSSES is the Type for the awsses alerting provider
99
TypeAWSSES Type = "aws-ses"
1010

11+
// TypeClickUp is the Type for the clickup alerting provider
12+
TypeClickUp Type = "clickup"
13+
1114
// TypeCustom is the Type for the custom alerting provider
1215
TypeCustom Type = "custom"
1316

alerting/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/TwiN/gatus/v5/alerting/alert"
88
"github.com/TwiN/gatus/v5/alerting/provider"
99
"github.com/TwiN/gatus/v5/alerting/provider/awsses"
10+
"github.com/TwiN/gatus/v5/alerting/provider/clickup"
1011
"github.com/TwiN/gatus/v5/alerting/provider/custom"
1112
"github.com/TwiN/gatus/v5/alerting/provider/datadog"
1213
"github.com/TwiN/gatus/v5/alerting/provider/discord"
@@ -54,6 +55,9 @@ type Config struct {
5455
// AWSSimpleEmailService is the configuration for the aws-ses alerting provider
5556
AWSSimpleEmailService *awsses.AlertProvider `yaml:"aws-ses,omitempty"`
5657

58+
// ClickUp is the configuration for the clickup alerting provider
59+
ClickUp *clickup.AlertProvider `yaml:"clickup,omitempty"`
60+
5761
// Custom is the configuration for the custom alerting provider
5862
Custom *custom.AlertProvider `yaml:"custom,omitempty"`
5963

0 commit comments

Comments
 (0)