---
title: "Triage incoming email with your own AI model · Polpo Mail"
description: "Send each new email to your own AI classifier, then file, flag or draft a reply with the REST API: email triage you control, on your own domain."
url: https://polpomail.com/use-cases/ai-email-triage
last_updated: 2026-11-26
---

[Use cases](https://polpomail.com/use-cases)

# Triage incoming email with your own AI model

Send each new email to your own AI classifier, then file, flag or draft a reply with the REST API: email triage you control, on your own domain.

[Create your free workspace](https://polpomail.com/signup) [How webhooks work](https://polpomail.com/webhooks)

## Why automate it

Inbox rules match fixed words. An AI model can tell a complaint from a sales lead or an invoice, in any language. With a webhook and the REST API you can build that triage yourself, with the model and the prompts you choose.

How it works

## Set it up in three steps

1. 1

   ### Receive each new email

   A webhook with no filters sends every message that reaches the inbox, with its text, HTML and message id.
2. 2

   ### Classify it

   Send the subject and text to the AI model of your choice and ask for a category, an urgency level or a summary.
3. 3

   ### Act through the API

   Move the message to a folder or flag it with PATCH /api/v1/messages/{id}, or send an answer with POST /api/v1/messages/send.

Settings

## The webhook to create

In Settings › Developer, after you sign in.

|  |  |
| --- | --- |
| Format | JSON |
| From matches | empty (any sender) |
| To or Cc matches | empty (any recipient) |
| Request headers | none needed |
| Extra JSON | none needed |

- You choose the model and the prompt, and you control what data it sees.
- Webhook filters decide which mail is sent at all, for example only mail to info@.
- Every action goes through scoped access tokens you can revoke at any time.

Example

## Python: classify, then file with the REST API

Every request includes the webhook's token in `X-Polpo-Webhook-Token`; check it first. See the [payload reference](https://polpomail.com/developers#webhooks).

```
@app.post("/hooks/triage")
def triage():
    if not hmac.compare_digest(request.headers.get("X-Polpo-Webhook-Token", ""), TOKEN):
        abort(401)
    m = request.json["message"]
    label = classify(m["subject"], m["text"])   # your AI model: "Sales", "Billing", "Urgent", …
    requests.patch(f"{API}/messages/{m['id']}",
                   headers={"Authorization": f"Bearer {MODIFY_TOKEN}"},
                   json={"mailbox": label, "flagged": label == "Urgent"})
    return "", 204
```

FAQ

## Common questions

**Do you send my email to an AI service?**

No. We only send the webhook to the URL you configure. Which AI service, if any, sees the message is entirely up to the code behind your endpoint.

**Which folders can the API move messages to?**

Any folder in the mailbox, such as Archive or one you create in webmail. Create the folders first; moving to a folder that doesn't exist returns mailbox_not_found.

**Is this included in the free plan?**

Yes. Webhooks, the REST API and access tokens are included free, with up to 5 webhooks per mailbox and up to 10 mailboxes per domain.

## More use cases

[### Support tickets from support@ Send every email to support@ to your helpdesk or your own ticket system as JSON the moment it arrives, with sender, subject, body and attachments. See how →](https://polpomail.com/use-cases/support-tickets) [### Sales enquiries into your CRM Post every email to sales@ to your CRM or lead database as JSON, with your API key in a custom header, so no enquiry gets lost in an inbox. See how →](https://polpomail.com/use-cases/crm-leads) [### Supplier invoices to accounting When an invoice arrives at invoices@, your webhook gets the details and a link to download each PDF with the REST API, ready for bookkeeping or OCR. See how →](https://polpomail.com/use-cases/invoice-processing) [### Alerts in Slack, Teams or Discord Forward alert, order or VIP emails to a team chat channel: a webhook sends the email to a small function or automation that posts the message. See how →](https://polpomail.com/use-cases/chat-alerts) [### Zapier, Make and n8n without polling Use a webhook as an instant email trigger for no-code automations: point it at a Zapier Catch Hook, a Make custom webhook or an n8n Webhook node. See how →](https://polpomail.com/use-cases/no-code-automation)

## Start with one webhook.

Free business email on your own domain, with webhooks and a REST API included.

[Create your free workspace](https://polpomail.com/signup)
