Sistava

Email Your Employees

Forward emails to your AI employees. They read the sender, subject, and body, then act on it using their full capabilities. Fire-and-forget: you get 202 Accepted immediately, the employee processes the email in the background.

TL;DR

POST an email to /api/email/ with your API key, an employee ID, and the email fields (body is required, sender and subject are optional). The employee picks it up and acts on it. No waiting for a response.

When to Use This

Use the email channel when you want emails to trigger employee work. Set up your email provider to forward incoming messages to the endpoint, and your employees handle them automatically.

How It Works

The email endpoint accepts structured email fields and formats them into a rich prompt for the employee. The employee sees the sender, subject line, and body, giving it full context about what was sent and who sent it.

Enable the Channel

The Email channel is disabled by default. Enable it before sending emails:

  1. Go to Settings, Technical, Communications
  2. Find Email under the Inbound channels
  3. Toggle it on

Authentication

Same as all programmatic channels. Bearer token in the Authorization header.

  1. Go to Settings, Communications
  2. Expand the Programmatic group
  3. Expand any channel card
  4. Click "New Key", give it a name, hit Enter
  5. Copy the key from the green banner. It will not be shown again

Endpoint

POST /api/email/

Send an email to an AI employee.

Request body:

Field Type Required Description
employee_id UUID string Yes Which employee receives the email
body string Yes Email body content
from string No Sender email address (recommended for context)
subject string No Email subject line (recommended for context)

Request headers (optional):

Header Description
Idempotency-Key Prevents duplicate processing. If the same key is sent within 5 minutes, the request is rejected as a duplicate

Response (202 Accepted):

Field Type Description
message_id UUID string Unique ID for this email event
employee_id UUID string The employee that received it
status string Always "accepted"

What the Employee Sees

The employee receives the email formatted with full context:

[Email from jane@example.com] Subject: Q3 Report Can you summarize last quarter sales numbers?

If from is omitted, the header shows [Email]. If subject is omitted, it is skipped. The employee knows the message came from email and can adjust its response accordingly.

Error Responses

Status Meaning
400 Bad request: missing fields, invalid UUID, or malformed JSON
401 Invalid or missing API key
403 Channel not enabled, or email not verified
413 Request body exceeds 64 KB
429 Rate limit exceeded
502 Employee unreachable (infrastructure error)

Quick Start

curl

curl -X POST https://api-sistava.com/api/email/ \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "employee_id": "YOUR_EMPLOYEE_UUID",
    "from": "jane@example.com",
    "subject": "Q3 Report",
    "body": "Can you summarize last quarter sales numbers?"
  }'

Python

import requests

requests.post(
    "https://api-sistava.com/api/email/",
    headers={"Authorization": "Bearer sk-your-api-key"},
    json={
        "employee_id": "YOUR_EMPLOYEE_UUID",
        "from": "jane@example.com",
        "subject": "Q3 Report",
        "body": "Can you summarize last quarter sales numbers?",
    },
)
# 202: employee will handle it in the background

JavaScript / Node

await fetch("https://api-sistava.com/api/email/", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sk-your-api-key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    employee_id: "YOUR_EMPLOYEE_UUID",
    from: "jane@example.com",
    subject: "Q3 Report",
    body: "Can you summarize last quarter sales numbers?",
  }),
});
// 202: fire and forget

Connecting Your Email Provider

Point your email provider's inbound webhook to https://api-sistava.com/api/email/. Your middleware should extract the sender, subject, and body from the provider's format, then POST them to the endpoint.

Compatible with any provider that supports inbound email forwarding via HTTP:

Provider Feature
SendGrid Inbound Parse
Mailgun Routes
Postmark Inbound Processing
AWS SES Email Receiving (via Lambda/SNS)
Cloudflare Email Workers

Each provider has its own payload format. Build a small middleware that transforms the provider's format into the employee_id, from, subject, body fields this endpoint expects.

Outbound (Sending Emails)

Employees can send emails using the connected Gmail tool. Connect Gmail via OAuth in the employee's Tools tab, then the employee can compose and send emails as part of its workflow. This is separate from the inbound email channel described here.

Good to Know

Troubleshooting

Frequently Asked Questions

Q: Are from and subject required? A: No. Only employee_id and body are required. However, including from and subject gives the employee much better context about the email, so they are strongly recommended.

Q: Can the employee reply to the email? A: Not directly through this channel. The employee processes the email as a task. If the employee has Gmail connected as a tool, it can compose and send a reply email as part of its workflow.

Q: How do I prevent duplicate emails from being processed? A: Include an Idempotency-Key header with a unique value per email (e.g., the email's Message-ID). Duplicates within 5 minutes are rejected.

Q: Can I forward emails with attachments? A: The endpoint accepts text only (no binary attachments). Extract the text content from attachments and include it in the body field, or upload files to the employee via the web app.

Q: Does the email channel support HTML emails? A: The body field is plain text. If you are forwarding HTML emails, strip the HTML tags and send the text content. The employee works with the text, not the formatting.