Cloudflare DNS logo
Cloudflare D1 logo
Slack logo

Workflow template

Log mail DNS changes in D1 and notify Slack

Watch a domain’s MX, SPF and DMARC records. Save each observed change in D1 and send the previous and current settings to a Slack channel.

How it works

Log mail DNS changes in D1 and notify Slack

1 Trigger · 2 Actions
Cloudflare DNS1 · Trigger

Mail routing or authentication changed

Start when the observed MX, SPF or DMARC records differ from the previous check. The first check saves a baseline.

Cloudflare D12 · Action

Record the observed change once

Run a statement with bound values, or send a batch. Each row in the results uses the column names from your query.

Slack3 · Action

Send the changed mail settings to Slack

Send text, Block Kit content, attachments, or a thread reply to a channel.

Before activation

Set up your workflow

  1. Choose the mail domain

    Connect Cloudflare, enter the zone ID and the full mail domain in the trigger. Allow the first poll to establish a baseline of the MX, SPF and DMARC settings.

  2. Create the change history table

    Run this statement once in the selected D1 database: CREATE TABLE IF NOT EXISTS dns_mail_changes (change_id TEXT PRIMARY KEY, domain TEXT NOT NULL, previous TEXT, current TEXT NOT NULL, observed_at TEXT NOT NULL). Select the same database in the workflow. Each change ID can be inserted once.

  3. Choose the destination channel

    Connect Slack, select your channel and invite the bot if the channel is private. Alerts include both sets of observed values.

  4. Check a change

    Use a test subdomain and edit one mail record after the baseline. Compare the Slack notification with the D1 row and let an unchanged poll pass. Changes between polls can be missed.