Supyagent
Cloud Integrations

AI Inbox

Process webhook events from connected integrations with the AI Inbox -- event-driven agent automation.

AI Inbox

The AI Inbox is a unified event stream that collects webhook events from your connected integrations. Instead of polling for new emails, messages, or issues, your agents can process events as they arrive.

How It Works

Connected Integrations
  ├─ Gmail: new email received
  ├─ Slack: new message posted
  ├─ GitHub: issue opened
  └─ ...

       v
  Supyagent Inbox (unified event stream)

       v
  Your Agent (processes events)
  1. Events arrive from connected providers via webhooks
  2. Events are stored in the Supyagent inbox with a consistent format
  3. Your agent polls the inbox or gets notified of new events
  4. Events are processed and marked as read/archived

Inbox API

List Events

Fetch unread events from your inbox:

curl -X GET "https://app.supyagent.com/api/v1/inbox/events?status=unread&limit=20" \
  -H "Authorization: Bearer sk_live_..."

Response

{
  "data": {
    "events": [
      {
        "id": "evt_abc123",
        "provider": "google",
        "service": "gmail",
        "type": "email.received",
        "summary": "New email from alice@company.com: Q4 Budget Review",
        "payload": {
          "from": "alice@company.com",
          "subject": "Q4 Budget Review",
          "snippet": "Hi, please review the attached budget..."
        },
        "status": "unread",
        "created_at": "2025-03-15T14:30:00Z"
      },
      {
        "id": "evt_def456",
        "provider": "slack",
        "service": "messages",
        "type": "message.received",
        "summary": "Bob in #engineering: Deploy script failing on staging",
        "payload": {
          "channel": "engineering",
          "author": "Bob",
          "text": "Deploy script failing on staging -- anyone know the fix?"
        },
        "status": "unread",
        "created_at": "2025-03-15T14:25:00Z"
      }
    ],
    "total": 2,
    "next_cursor": null
  }
}

Mark Events

Mark events as read or archived:

curl -X PATCH "https://app.supyagent.com/api/v1/inbox/events/evt_abc123" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"status": "read"}'

Status values: unread, read, archived

Query Parameters

ParameterTypeDefaultDescription
statusstr"unread"Filter by status: unread, read, archived, all
providerstrnullFilter by provider (e.g., google, slack)
servicestrnullFilter by service (e.g., gmail, messages)
limitint20Maximum events to return
cursorstrnullPagination cursor

Permissions

Permission IDNameTypeDescription
inbox.readRead eventsreadList and view inbox events
inbox.writeManage eventswriteMark events as read or archived

Event Types

ProviderEvent TypeDescription
Google (Gmail)email.receivedNew email received
Slackmessage.receivedNew message in a channel or DM
GitHubissue.openedNew issue created
GitHubissue.commentedNew comment on an issue
GitHubpr.openedNew pull request created
GitHubpr.reviewNew review on a pull request
Discordmessage.receivedNew message in a channel
Notionpage.updatedPage content was modified

Agent Integration

Polling Pattern

The simplest approach -- your agent periodically checks the inbox:

agents/inbox_processor.yaml
name: inbox_processor
description: "Processes incoming events from the AI inbox"
type: execution

model:
  provider: anthropic/claude-sonnet-4-5-20250929

system_prompt: |
  You are an inbox processing agent. Check the inbox for unread events,
  process each one appropriately, and mark them as read.

  For emails: summarize and draft a reply if needed.
  For Slack messages: respond if it's a question directed at the team.
  For GitHub issues: triage and add labels.

service:
  enabled: true
  url: https://app.supyagent.com

Run it periodically:

# Process inbox every 5 minutes
supyagent run inbox_processor "Check the inbox for unread events and process them"

Daemon Integration

For continuous processing, use a cron job or systemd timer:

# crontab -e
*/5 * * * * cd /path/to/project && supyagent run inbox_processor "Process unread inbox events" --quiet

Or a simple loop script:

#!/bin/bash
while true; do
  supyagent run inbox_processor "Process unread inbox events" --quiet
  sleep 300  # 5 minutes
done

Multi-Agent Routing

Use delegation to route events to specialized agents:

agents/inbox_router.yaml
name: inbox_router
description: "Routes inbox events to specialized agents"
type: execution

system_prompt: |
  You are an inbox router. Check for unread events and delegate each to
  the appropriate specialized agent:
  - Email events -> delegate to email_handler
  - Slack events -> delegate to slack_responder
  - GitHub events -> delegate to github_triager

delegates:
  - email_handler
  - slack_responder
  - github_triager

Webhook Setup

Webhooks are configured automatically when you connect an integration. For some providers, additional setup may be required:

ProviderWebhook Setup
GoogleAutomatic via push notifications
SlackAutomatic via Events API
GitHubAutomatic via webhook registration
DiscordAutomatic via Gateway events
NotionPolling-based (Notion does not support webhooks natively)

What's Next