Setting Up a Mailhook Trigger
Give your workflow its own email address. Any message sent to it starts a run.
Overview
A mailhook trigger generates a unique email address for your workflow, for example mh-x7k2m9qf4a3vbn8c@mailhook.spojit.com. Whenever an email arrives at that address, the workflow runs with the parsed message (sender, subject, body, attachment list) as its input. Think of it as a webhook, but for email: there is no endpoint to host and no mailbox to connect. The address itself is the integration: unguessable, single-purpose, and easy to revoke.
Mailhooks are push-based, so runs start within seconds of the email arriving. That makes them a good fit whenever you control where the mail is sent: vendor notification settings, forwarding rules in your mail client, reports emailed by third-party systems, or any tool with a "send results to this address" field.
Mailhook or Email Trigger?
Spojit has two email-based triggers. Pick by where the mail naturally goes:
- Mailhook - You can choose the destination address. Spojit generates one for you, and nothing else is needed. Push delivery, near-instant.
- Email - The mail already lands in a Gmail or Outlook mailbox you own and need to keep. Requires an OAuth connection, and Spojit polls the mailbox on an interval.
Configuration
- Click the Trigger node on your canvas.
- Set the trigger type to Mailhook.
- Optionally enter an address prefix (lowercase letters, digits, hyphens). If you leave it empty, the default
mhis used. - Click Generate email address. The address appears immediately with a copy button.
- Point mail at the address: paste it into a vendor's notification settings or create a forwarding rule in your mail client.
- Optionally add a from allowlist or subject regex filter.
- Save the workflow.
The trigger is live as soon as the address is generated. Use the Active toggle to pause it without losing the address.
Available Data
The message is exposed downstream as {{ input }} with these fields:
{{ input.from }}- Sender address.{{ input.to }},{{ input.cc }},{{ input.replyTo }}- Recipient and reply-to addresses.{{ input.subject }}- Subject line.{{ input.text }}- Plain-text body.{{ input.html }}- HTML body.{{ input.attachments }}- Array of attachments (id, filename, content type); the file bytes are fetched on demand by nodes that use them.{{ input.receivedAt }}- Arrival timestamp.
Example: Vendor Invoice Intake
Generate a mailhook address with the prefix invoices, paste it into your vendor portal's "billing notifications" setting, and add a from allowlist of @vendor.com. Each invoice email fires the workflow, which pipes {{ input.subject }} and {{ input.text }} into a Connector node that records the invoice in your accounting system.
Tips
- Use one mailhook per source. Separate addresses for different vendors cost nothing, keep filters simple, and let you rotate one address without disturbing the others.
- Pick a recognizable prefix (for example
support-intake) so the address is easy to spot in forwarding rules and logs. - The address is unguessable, but anyone who knows it can fire the workflow. Treat it like a secret and regenerate it if it spreads further than intended.
- For testing, email the address from your own account and watch the run appear in the monitoring view.
Common Pitfalls
- Expecting a reply - Mailhooks never respond to the sender. If you want to reply, add a Send Email node in the workflow and send to
{{ input.replyTo }}. - Filters silently dropping mail - Messages that fail the from allowlist or subject regex are discarded without an error. If runs are not firing, loosen the filters first.
- Stale forwarding after regenerating - Regenerating the address invalidates the old one immediately. Update every forwarding rule and vendor setting right after rotating.
- Very large bodies - Message bodies are truncated past 256 KB (the input carries a
truncatedflag). Keep oversized content in attachments rather than inline.
Related Articles
- Changing Your Mailhook Email Address
- Filtering Mailhook Emails
- Webhook vs Mailhook: Which Trigger Should I Use?
- Setting Up an Email Trigger
- Setting Up a Webhook Trigger
- Setting Up a Manual Trigger
- Using Send Email Nodes