Custom Webhooks
Forward emails as JSON payloads to any external service using webhooks. You can use built-in templates for popular platforms or define your own custom payload format.
How It Works
When MailFellow receives an email, it can send the email data as an HTTP POST request to one or more webhook URLs. This is useful for:
- Sending notifications to services without a native MailFellow integration
- Feeding email data into automation tools (Zapier, Make, n8n)
- Logging emails to external databases or CRMs
- Triggering workflows in custom applications
Creating a Webhook
- Go to Settings > Webhooks
- Click Create Webhook
- Fill in the details:
- URL:the endpoint that will receive the POST request
- Platform type:select a built-in template or "Custom"
- Click Save
Built-in Platform Templates
MailFellow includes pre-built payload templates for these platforms:
| Platform | Format |
|---|---|
| Microsoft Teams | Adaptive Card format for Teams incoming webhooks |
| Telegram | Telegram Bot API sendMessage format (Markdown) |
| Mattermost | Slack-compatible incoming webhook format |
| Custom | Raw JSON with all email fields |
When you select a platform type, MailFellow automatically formats the payload to match that platform's expected format. For "Custom", the full email data is sent as JSON.
Webhook Payload
The default JSON payload includes these fields:
{
"event": "new_email",
"subject": "Meeting Tomorrow",
"sender_name": "John Doe",
"sender_email": "john@example.com",
"body": "Full email body text...",
"snippet": "Short preview of the email...",
"thread_id": "thread_abc123",
"timestamp": "2024-01-15T10:30:00Z",
"cc_list": [
{"name": "Jane", "email": "jane@example.com"}
],
"account_id": "acc_123"
}Custom Template Variables
If you write a custom template, you can use these Go template variables:
| Variable | Description |
|---|---|
{{.Subject}} | Email subject line |
{{.SenderName}} | Sender's display name |
{{.SenderEmail}} | Sender's email address |
{{.Body}} | Full email body (plain text) |
{{.Snippet}} | Short preview/summary of the email |
{{.ThreadID}} | Email thread identifier |
{{.Timestamp}} | When the email was received |
{{.AccountID}} | The connected email account ID |
Testing a Webhook
- Go to Settings > Webhooks
- Find your webhook in the list
- Click Test
- MailFellow sends a sample payload to your URL
- Check that your endpoint received it correctly
Using Webhooks with Routing Rules
You can combine webhooks with routing rules to send specific emails to specific webhooks. For example:
- Route all invoices to an accounting webhook
- Route support emails to a ticketing system webhook
- Route VIP emails to a Slack webhook for a special channel
When creating a routing rule, set the webhook URL as the destination instead of (or in addition to) a channel.
Deleting a Webhook
- Go to Settings > Webhooks
- Click Delete next to the webhook
Any routing rules pointing to this webhook will stop forwarding to it, but the rules themselves are not deleted.