Skip to main content

Advanced

Notifications

Post a run summary to Slack, Microsoft Teams, Discord, or email after each test run. Notifications fire after the PDF is written and do not affect your test run.

Overview

Configure one or more channels under the notify key. Each channel has its own enabled flag and on trigger, so you can send Slack on every run and email only on failure from the same config.

ts
reporter: [['@reportforge/playwright-pdf', {  notify: {    slack:   { url: process.env.SLACK_WEBHOOK_URL,   enabled: true, on: 'failure' },    teams:   { url: process.env.TEAMS_WEBHOOK_URL,   enabled: true, on: 'always'  },    discord: { url: process.env.DISCORD_WEBHOOK_URL, enabled: true, on: 'failure' },    email:   { to: ['team@company.com'],             enabled: true, on: 'failure' },  },}]]

Store webhook URLs and API keys as CI secrets — never commit them to source control.

Slack

Create an Incoming Webhook at api.slack.com/apps and copy the URL. The reporter sends a Block Kit message with status, pass rate, test counts, and duration.

ts
notify: {  slack: {    url: process.env.SLACK_WEBHOOK_URL,    enabled: true,    on: 'failure',  },}

Microsoft Teams

Create a workflow webhook in Teams (Workflows app → Post to a channel when a webhook request is received). The reporter sends an Adaptive Card payload.

ts
notify: {  teams: {    url: process.env.TEAMS_WEBHOOK_URL,    enabled: true,    on: 'always',  },}

Legacy Office 365 Connector webhooks work but are being deprecated by Microsoft. Use Workflows webhooks for new integrations.

Discord

Create a webhook in Discord (Server Settings → Integrations → Webhooks) and paste the URL directly — no /slack suffix needed. The reporter sends a native Discord embed with a color-coded status bar.

ts
notify: {  discord: {    url: process.env.DISCORD_WEBHOOK_URL,    enabled: true,    on: 'failure',  },}

Email

Send an HTML email summary via Resend. Optionally attach the generated PDF.

ts
notify: {  email: {    to: ['team@company.com', 'qa@company.com'],    enabled: true,    on: 'failure',    attachPdf: false, // set true to attach the PDF (default: false)  },}

Required environment variable

VariablePurpose
RESEND_API_KEYResend API key — required. Get one at resend.com.
RESEND_FROMSender address (optional). Defaults to noreply@reportforge.org.

If RESEND_API_KEY is absent, the reporter logs a warning and skips the email — your test run and PDF are unaffected.

Trigger options

Every channel (webhook and email) shares the same on trigger.

KeyType / DefaultDescription
urlstring · requiredWebhook URL. Applies to slack, teams, discord.
tostring[] · requiredRecipient addresses. Applies to email only.
enabledboolean · falseMust be true to send. Lets you store config without activating it.
onenum · 'always''always' · 'failure' · 'success'. Failure = at least one test failed, timed out, or interrupted.
attachPdfboolean · falseAttach the generated PDF. Applies to email only.