Skip to content

Commit 22e42da

Browse files
adamrtalbotclaude
andcommitted
feat: replace webhook notifications with nf-slack plugin
Replace the custom webhook-based instant message system with the nf-slack plugin for improved Slack notifications. This change provides automatic workflow lifecycle notifications with enhanced features. Changes: - Add nf-slack plugin (v0.1.0) to nextflow.config - Configure automatic notifications for start, complete, and error events - Remove custom imNotification function and webhook templates - Remove hook_url parameter from pipeline configuration - Update README with Slack notification setup instructions Benefits: - Automatic notifications without manual coding - Built-in support for resource usage statistics - Fail-safe operation that never fails the workflow - Cleaner codebase with ~60 lines of code removed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent db7f526 commit 22e42da

File tree

8 files changed

+37
-179
lines changed

8 files changed

+37
-179
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ nextflow run nf-core/demo \
6161
6262
For more details and further functionality, please refer to the [usage documentation](https://nf-co.re/demo/usage) and the [parameter documentation](https://nf-co.re/demo/parameters).
6363

64+
## Slack Notifications
65+
66+
The pipeline includes automatic Slack notifications via the nf-slack plugin. To enable Slack notifications:
67+
68+
1. Create a Slack incoming webhook in your workspace:
69+
- Go to your Slack workspace settings
70+
- Navigate to "Apps" → "Incoming Webhooks"
71+
- Create a new webhook and copy the URL
72+
73+
2. Set the webhook URL as an environment variable:
74+
```bash
75+
export SLACK_WEBHOOK_URL='https://hooks.slack.com/services/YOUR/WEBHOOK/URL'
76+
```
77+
78+
3. Run your pipeline normally - notifications will be sent automatically:
79+
- Pipeline start notification
80+
- Pipeline completion notification (with task statistics)
81+
- Pipeline failure notification (with error details)
82+
83+
The plugin is configured to include command line details and resource usage statistics in the notifications. You can customize the notification settings in `nextflow.config` under the `slack` configuration block.
84+
85+
For more information about the nf-slack plugin, visit the [nf-slack repository](https://github.com/seqeralabs/nf-slack).
86+
6487
## Pipeline output
6588

6689
To see the results of an example test run with a full size dataset refer to the [results](https://nf-co.re/demo/results) tab on the nf-core website pipeline page.

assets/adaptivecard.json

Lines changed: 0 additions & 67 deletions
This file was deleted.

assets/slackreport.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

main.nf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ workflow {
8989
params.plaintext_email,
9090
params.outdir,
9191
params.monochrome_logs,
92-
params.hook_url,
9392
NFCORE_DEMO.out.multiqc_report
9493
)
9594
}

nextflow.config

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ params {
3434
email_on_fail = null
3535
plaintext_email = false
3636
monochrome_logs = false
37-
hook_url = null
3837
help = false
3938
help_full = false
4039
show_hidden = false
@@ -273,6 +272,20 @@ manifest {
273272
// Nextflow plugins
274273
plugins {
275274
id 'nf-schema@2.3.0' // Validation of pipeline parameters and creation of an input channel from a sample sheet
275+
id 'nf-slack@0.1.0' // Slack notifications for workflow events
276+
}
277+
278+
// Slack notification configuration
279+
slack {
280+
enabled = true
281+
webhook = System.getenv('SLACK_WEBHOOK_URL')
282+
notifyOnStart = true
283+
notifyOnComplete = true
284+
notifyOnError = true
285+
username = 'Nextflow Bot'
286+
iconEmoji = ':rocket:'
287+
includeCommandLine = true
288+
includeResourceUsage = true
276289
}
277290

278291
validation {

nextflow_schema.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,6 @@
193193
"fa_icon": "fas fa-palette",
194194
"hidden": true
195195
},
196-
"hook_url": {
197-
"type": "string",
198-
"description": "Incoming hook URL for messaging service",
199-
"fa_icon": "fas fa-broadcast-tower",
200-
"help_text": "Incoming hook URL for messaging service. Currently, MS Teams and Slack are supported.",
201-
"hidden": true
202-
},
203196
"multiqc_config": {
204197
"type": "string",
205198
"format": "file-path",

subworkflows/local/utils_nfcore_demo_pipeline/main.nf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ include { paramsSummaryMap } from 'plugin/nf-schema'
1313
include { samplesheetToList } from 'plugin/nf-schema'
1414
include { completionEmail } from '../../nf-core/utils_nfcore_pipeline'
1515
include { completionSummary } from '../../nf-core/utils_nfcore_pipeline'
16-
include { imNotification } from '../../nf-core/utils_nfcore_pipeline'
1716
include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline'
1817
include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline'
1918

@@ -111,7 +110,6 @@ workflow PIPELINE_COMPLETION {
111110
plaintext_email // boolean: Send plain-text email instead of HTML
112111
outdir // path: Path to output directory where results will be published
113112
monochrome_logs // boolean: Disable ANSI colour codes in log output
114-
hook_url // string: hook URL for notifications
115113
multiqc_report // string: Path to MultiQC report
116114

117115
main:
@@ -135,9 +133,6 @@ workflow PIPELINE_COMPLETION {
135133
}
136134

137135
completionSummary(monochrome_logs)
138-
if (hook_url) {
139-
imNotification(summary_params, hook_url)
140-
}
141136
}
142137

143138
workflow.onError {

subworkflows/nf-core/utils_nfcore_pipeline/main.nf

Lines changed: 0 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)