Pro Feature
How to Send Contact Form 7 Submissions to Slack
Learn how to send real-time Slack notifications for Contact Form 7 (CF7) submissions. Covers both a no-code setup using settings only and a manual implementation using an Incoming Webhook, along with common pitfalls.
Email notifications get missed. If multiple people are handling inquiries, sending Contact Form 7 (CF7) submissions to Slack in real time is the more reliable approach. Everyone sees new submissions immediately, and nothing falls through the cracks. This article covers both a no-code setup using the settings screen and a manual implementation where you write the code yourself.
Why email notifications alone let inquiries slip through
CF7’s default notification is a single email to the administrator. But inboxes get cluttered, messages get caught by spam filters, and if the person in charge is out, no one notices. In production, this is exactly how important leads get dropped. With Slack, everyone’s timeline gets an instant notification, and you can assign follow-up directly in the thread.
Method 1: Set it up entirely from the settings screen (no code, recommended)
You can implement Slack notifications entirely through the WordPress admin settings, without touching functions.php at all. Using Frontierline Forms’ notification integration feature, you can finish the setup in four steps below. There’s no code to maintain and no dependency on your theme.
Steps
- Generate a Webhook URL: Create an app at Slack API, enable “Incoming Webhooks,” choose the destination channel, and obtain a Webhook URL (in the format
https://hooks.slack.com/services/...). - Paste it into the settings field: In the plugin’s notification settings, select Slack and enter the Webhook URL and destination channel.
- Specify the notification content: Choose which form fields to include in the subject and body directly on screen, with no code required.
- Send a test submission: Submit the form and confirm that the notification arrives in the channel with the correct field values.
Because form fields are selected through the GUI, your notification settings won’t drift out of sync when you edit the form. You can also set up conditional branching to route notifications to different channels based on inquiry type, all from the settings screen. This scales cleanly across multiple forms and multiple sites without becoming unmanageable.
Method 2: Manual implementation with an Incoming Webhook (advanced)
If you’d rather write the code yourself, you can implement this using Slack’s Incoming Webhook together with CF7’s wpcf7_mail_sent hook.
Prepare a Webhook URL
As in step 1 of Method 1, generate an Incoming Webhook URL (Slack API → create an app → enable Incoming Webhooks → choose a channel).
Add the hook to functions.php
add_action('wpcf7_mail_sent', function ($form) {
$submission = WPCF7_Submission::get_instance();
$data = $submission ? $submission->get_posted_data() : [];
$text = "New inquiry\n"
. "Name: " . ($data['your-name'] ?? '') . "\n"
. "Email: " . ($data['your-email'] ?? '') . "\n"
. "Message: " . ($data['your-message'] ?? '');
wp_remote_post('https://hooks.slack.com/services/XXXX/YYYY/ZZZZ', [
'headers' => ['Content-Type' => 'application/json'],
'body' => wp_json_encode(['text' => $text]),
]);
});
Replace the field names (such as your-name) with the ones actually used in your form definition.
Common pitfalls with the manual implementation
- Code multiplies per form: If you have separate forms for inquiries, recruiting, and document requests, the branching logic using
$form->id()grows quickly. - Field names become a maintenance burden: Every time you edit a form, you also have to update the field names in
functions.php, and any mismatch results in blank notifications. - Maintenance is tied to the theme: Code can be lost during a theme change or handover, and the risk compounds as you roll this out across more sites.
For one or two sites, a manual implementation is manageable. But as the number of projects grows, writing and maintaining this every time becomes inefficient. That’s exactly why the settings-only Method 1 is the more practical choice.
Email vs. Slack: which should you use?
| Email notification | Slack notification | |
|---|---|---|
| Likelihood of noticing | Gets buried or caught by spam filters | Instant delivery to everyone |
| Assigning follow-up | Requires manual forwarding | Handled directly in a thread |
| Routing multiple contact points | Filter setup gets complicated | Clear separation by channel |
You don’t need to abandon email entirely. Using email and Slack together is a practical approach — treating Slack as the primary channel speeds up your response time.
Summary
Since CF7 alone has no Slack integration, you’ll need either a notification plugin configured through settings, or a custom implementation using an Incoming Webhook. If you’re maintaining multiple forms or multiple projects, the settings-only approach is dramatically faster and avoids becoming dependent on a single person’s knowledge. If you’re just getting started, Method 1 is the one to try first.
If you’d like Slack notifications for CF7 alongside Chatwork and Google Sheets integration, database storage of submission logs, and full CSV export — all configurable without code — consider adopting Frontierline Forms.
Frontierline Forms
This setup takes just a checkbox in the admin.
Add alerts, submission logging, CSV export and multi-step forms without writing code — all from the settings screen. The 5-site / unlimited license lets agencies cover form maintenance across many client projects at once. Your license key is issued instantly on payment.