Example: Slack Notifications for New Posts to a Group Email
This walkthrough shows how to use Conduit to forward every email sent to a
shared group address — such as team@mail.yourcompany.com — to a Slack
channel as a formatted notification.
Overview
Sender → SMTP → Conduit → Webhook endpoint (Slack incoming webhook)
Whenever someone emails team@mail.yourcompany.com, Conduit receives the
message and immediately posts a notification to your chosen Slack channel.
Prerequisites
- A Conduit account. See Getting Started.
- A domain verified in Conduit, or use of a shared public domain. See Using a Custom Domain.
- A Slack workspace where you have permission to add apps.
Step 1 — Create a Slack incoming webhook
- Go to api.slack.com/apps and click Create New App → From scratch.
- Name the app (e.g. "Conduit Email Notifier") and select your workspace.
- Under Add features and functionality, click Incoming Webhooks and toggle Activate Incoming Webhooks on.
- Click Add New Webhook to Workspace, choose the target channel
(e.g.
#team-notifications), and click Allow. - Copy the webhook URL — it looks like:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX
Step 2 — Create the Conduit webhook
Conduit posts the raw email payload to your Slack webhook URL. Because Slack
expects a specific JSON shape ({"text": "..."}) rather than Conduit's default
email payload, use a payload template to transform the message.
Using the web UI
- Go to Webhooks (
/app/webhooks) and click + New. - Set the address to
team@mail.yourcompany.com. - Set the target URL to your Slack incoming webhook URL.
- Click Create webhook.
- On the webhook detail page, click Edit.
- In the Payload template field, enter:
{"text": "*New email to team@mail.yourcompany.com*\nFrom: {{.From}}\nSubject: {{.Subject}}\n\n{{.TextBody}}"} - Click Save changes.
Using the API
POST /api/v1/webhooks
Authorization: Bearer <access_token>
Content-Type: application/json
{
"address": "team@mail.yourcompany.com",
"target_url": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXX",
"payload_template": "{\"text\": \"*New email to team@mail.yourcompany.com*\\nFrom: {{.From}}\\nSubject: {{.Subject}}\\n\\n{{.TextBody}}\"}"
}
Save the secret from the response — you will need it if you later add
signature verification to an intermediary service.
Payload template explained
The payload_template field is a Go text/template
rendered against the parsed email. Commonly used fields:
| Template variable | Description |
|---|---|
{{.From}} |
Envelope sender address |
{{.Subject}} |
Email subject line |
{{.TextBody}} |
Plain-text body |
{{.HTMLBody}} |
HTML body |
{{.To}} |
List of recipient addresses |
The rendered output must be valid JSON that Slack's incoming webhook accepts.
Step 3 — Test the integration
Send an email to team@mail.yourcompany.com from any mail client. Within
seconds you should see a message in your Slack channel similar to:
New email to team@mail.yourcompany.com From: alice@example.com Subject: Q3 planning sync
Hi team, let's meet Thursday at 2pm...
Step 4 — Review delivery logs
If the Slack notification does not appear, check the delivery log for errors.
Using the web UI
Open Webhooks → team@mail.yourcompany.com → Logs (/app/webhooks/{id}/logs).
Using the API
GET /api/v1/webhooks/wh_01HX.../logs
Authorization: Bearer <access_token>
Common issues:
| Error | Resolution |
|---|---|
http_status: 400 from Slack |
The payload template is invalid JSON. Test the rendered output against Slack's API. |
http_status: 403 from Slack |
The Slack webhook URL has been revoked. Generate a new one in the Slack app settings. |
| No log entries | The email was not delivered to the SMTP gateway. Check your MX record or test with swaks. |
Optional: restrict senders with an SMTP security policy
To ensure only mail from your company domain reaches the Slack channel, attach an SMTP security policy that requires a valid DKIM signature from your domain.
Using the web UI
- Go to Policies (
/app/smtp-policies) and click + New. - Name the policy (e.g. "company-domain-only"), enable Require DKIM, and
set Allowed DKIM domains to
yourcompany.com. - Click Create policy.
- Open the webhook's Edit form (
/app/webhooks/{id}/edit), select the new policy in the Security policy dropdown, and click Save.
Using the API
POST /api/v1/smtp-policies
Authorization: Bearer <access_token>
Content-Type: application/json
{
"name": "company-domain-only",
"require_dkim": true,
"allowed_dkim_domains": "yourcompany.com"
}
Then attach it to the webhook:
PUT /api/v1/webhooks/wh_01HX...
Authorization: Bearer <access_token>
Content-Type: application/json
{
"smtp_security_policy_id": "pol_01HX..."
}
Mail from senders that do not carry a valid DKIM signature for
yourcompany.com will be rejected at the SMTP level before Conduit attempts
delivery to Slack.
See Configuring an SMTP Security Policy for more details.
Optional: rate-limit the webhook
If the group address receives high traffic, protect the Slack channel from being flooded by setting a rate limit via the API:
PUT /api/v1/webhooks/wh_01HX...
Authorization: Bearer <access_token>
Content-Type: application/json
{
"rate_limit": 10
}
This allows a maximum of 10 emails per minute. Senders that exceed the limit
receive a 450 transient rejection and their mail server will retry
automatically — no emails are lost.