Skip to content

Mailchimp Mandrill integration

Mailchimp Transactional (Mandrill) is a transactional email API that can also route inbound mail to a webhook. Orvanta has no dedicated Mailchimp/Mandrill connection type — instead, this integration works entirely through Orvanta’s generic webhook trigger, pointing Mandrill’s inbound webhook at the URL of an Orvanta script or flow.

Every script and flow exposes an autogenerated webhook URL from its Details page, which you can call from any external system without writing integration-specific backend code. Requests are authenticated with a token, passed either as an Authorization: Bearer <TOKEN> header or as a token query parameter — both work, so use whichever your sender supports.

  1. Create a script or flow whose input is shaped to receive the parsed payload (e.g. a string parameter named mandrill_events).
  2. Sign up for Mailchimp Transactional (Mandrill).
  3. Open Mandrill’s inbound routing settings.
  4. Add a domain or subdomain you control for inbound mail (e.g. inbound.example.com).
  5. Add the MX records Mandrill gives you to your DNS provider and wait for them to validate.
  6. Create a route specifying which recipient addresses should be forwarded.
  7. From your script/flow’s Details page, copy the webhook URL and generate a token if you don’t already have one.
  8. Paste the webhook URL — with the token appended, e.g. https://<your-instance>/api/w/<workspace>/jobs/run/p/<script_path>?token=<TOKEN> — into Mandrill’s “Post to URL” field.
  9. Send a test email through the route to confirm delivery end to end.

Mandrill posts the parsed message as a JSON-encoded string in the request body, not as a native JSON payload, so the first step of your flow should decode it before anything else touches the data:

export async function main(payload: string) {
return JSON.parse(payload);
}

For mail sent straight to one of your route’s addresses, Mandrill’s parsed payload is an array of message objects with sender, subject, and body already broken out. Feed the decoded array from the step above into the next step’s inputs and pull out whichever fields the rest of the flow needs.

Forwarded mail is different: Mandrill sees a single message where the sender is whoever hit “Forward”, not the original author, and the original headers end up embedded in the body text. A regex-based extraction step recovers them:

import re
def main(raw_email: str):
patterns = {
'from': r'From: .+ <(.+)>',
'subject': r'Subject: (.+)',
'date': r'Date: (.+)',
'to': r'To: <(.+)>',
'content': r'\n\n(.*)\n',
}
matches = {
key: re.search(pattern, raw_email, re.DOTALL if key == 'content' else 0)
for key, pattern in patterns.items()
}
result = {key: (m.group(1).strip() if key == 'content' else m.group(1)) if m else None
for key, m in matches.items()}
return result

A single route often receives a mix of direct and forwarded mail, so branch on a cheap signal — such as “Fwd” appearing in the subject — before deciding which parsing path to run:

export async function main(subject: string, marker: string = 'Fwd'): Promise<Output> {
const isForwarded = subject.includes(marker);
return { isForwarded };
}
interface Output {
isForwarded: boolean;
}

Wire the result into a flow branch so forwarded and direct messages hit their respective parsing step.

Once inbound mail lands as structured data in a flow, it composes with anything else Orvanta can do — a few directions worth exploring:

  • Route on parsed content (subject, sender domain, keywords) using flow branches
  • Push extracted data into a CRM connection (e.g. HubSpot, Salesforce)
  • Summarize long threads with an AI step before filing them
  • Turn invoice/receipt attachments into structured records automatically
  • Fan inbound alerts out to an incident-response flow
  • Create tracked tasks in a project-management tool from parsed requests