Unipile as a Provider in this use case acts as a bridge between your email accounts and the MindFlight server.
It takes care of:
Metaphor:
Think of Unipile as your AI mailroom assistant: it fetches new letters, sorts them, alerts the server when something new arrives, and helps draft replies automatically.
Of course, Unipile offers a long list of services and around 500 additional endpoints, all of which are available to AI agents and tasks driven by the MFO server. Messaging, calendar, email and LinkedIn making Unipile central to many interactions in your business processes.
With Unipile's complete OpenAPI documentation converted into an MFO provider, you have an indispensable Swiss army knife for automatically connecting 11 platforms.
Feature | What it does |
---|---|
Sync Jobs | Runs in the background to synchronize email accounts regularly. |
Email Webhook Handling | Receives notifications when a new email arrives. |
API Exposure | Provides endpoints to list emails, send new messages, and process email content. |
Internal Event Dispatch | Fires internal events like unipile.email.received to trigger workflows automatically. |
The Unipile Provider registers a background job that runs at intervals to sync emails. This ensures the server always has the latest data.
Example:
- Every 5 minutes, the job checks Unipile for new emails and updates the database.
Not all services provide a webhook feature to send the events they manage in real time. Sync jobs can compensate for this shortcoming. The MFO server checks periodically to see if any information is available.
When a new email arrives, Unipile sends a message to the webhook to MFO. This is handled by the email_webhook_handler.go
file.
Flow:
/webhooks/unipile/notify
.unipile.email.received
.The Unipile platform allows you to dynamically create targeted webhooks. It takes care of checking for new messages on the 11 platforms it coordinates.
The Unipile Provider registers its tools so you can:
Example API Tool: unipile_list_emails
You can call this via the /api/tools/unipile_list_emails
endpoint to fetch recent messages.
One of the strengths of MFO Client is how it triggers internal workflows using events.
Event Name | Purpose |
---|---|
unipile.email.received | Fired when a new email is ingested successfully. |
This event allows you to chain custom workflows. For example, when unipile.email.received
is triggered, the MFO server might automatically:
When the server starts, the Unipile Provider registers:
This happens via the Init()
function in the Unipile provider code, which tells the server:
/webhooks/unipile/notify
).Metaphor:
It's like the provider checks into the server and says: "Here's my toolbox, here's where to send me notifications, and here's what I'll do in the background."
Let's see what happens step by step when a new email arrives.
1️⃣ 📬 Email Received:
A new email lands in your inbox (e.g., via Gmail).
2️⃣ 🚀 Webhook Sent:
Unipile sends a notification's webhook to your MindFlight server.
3️⃣ 🛂 Webhook Processed:
The server's webhook route /webhooks/unipile/notify
receives and MFO Client validates the email data.
4️⃣ 🔔 Event Triggered:
The MFO Client fires the unipile.email.received
event.
5️⃣ 🤖 Workflow Activated:
A background job starts to process the email (for example, drafting a reply).
6️⃣ 📡 Notification Sent:
If you have subscribed to email.processed
notifications, your app gets a webhook saying the email has been handled.
sequenceDiagram
participant EmailService as Email Service (Gmail, etc.)
participant Unipile as Unipile Provider
participant Server as MindFlight AI Server
participant Client as Client App
EmailService->>Unipile: New email arrives
Unipile->>Server: Send webhook (/webhooks/unipile/notify)
Server->>Server: Process webhook & validate
Server->>Server: Fire event (unipile.email.received)
Server->>Server: Start job (e.g., draft reply)
Server->>Client: Notify via webhook (email.processed)
Step | Action |
---|---|
1. Sync | Background sync job checks for new emails. |
2. Webhook Handling | Webhooks trigger immediate ingestion of new emails. |
3. Internal Event | Fires unipile.email.received to signal new email processing. |
4. API Tools | Use /api/tools/unipile_* endpoints to interact with your mailbox. |