resend

GitHub 作者 maton

Resend API integration with managed authentication. Send transactional emails, manage domains, contacts, templates, and broadcasts. Use this skill when users want to send emails, manage email templates, create contact lists, or set up email broadcasts. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install github:LeoYeAI~openclaw-master-skills~resend-api
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/github%3ALeoYeAI~openclaw-master-skills~resend-api/file -o resend-api.md
# Resend

Access the Resend API with managed authentication. Send transactional emails, manage domains, contacts, templates, broadcasts, and webhooks.

## Quick Start

```bash
# List sent emails
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/resend/emails')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

## Base URL

```
https://gateway.maton.ai/resend/{endpoint}
```

The gateway proxies requests to `api.resend.com` and automatically injects your API key.

## Authentication

All requests require the Maton API key in the Authorization header:

```
Authorization: Bearer $MATON_API_KEY
```

**Environment Variable:** Set your API key as `MATON_API_KEY`:

```bash
export MATON_API_KEY="YOUR_API_KEY"
```

### Getting Your API Key

1. Sign in or create an account at [maton.ai](https://maton.ai)
2. Go to [maton.ai/settings](https://maton.ai/settings)
3. Copy your API key

## Connection Management

Manage your Resend connections at `https://ctrl.maton.ai`.

### List Connections

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=resend&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

### Create Connection

```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'resend'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

### Get Connection

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

**Response:**
```json
{
  "connection": {
    "connection_id": "528c8f70-23f4-46d5-bd9f-01d0d043e573",
    "status": "ACTIVE",
    "creation_time": "2026-03-13T00:19:36.809599Z",
    "last_updated_time": "2026-03-13T09:59:08.443568Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "resend",
    "metadata": {},
    "method": "API_KEY"
  }
}
```

### Delete Connection

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

### Specifying Connection

If you have multiple Resend connections, specify which one to use with the `Maton-Connection` header:

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/resend/emails')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '528c8f70-23f4-46d5-bd9f-01d0d043e573')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

If omitted, the gateway uses the default (oldest) active connection.

## API Reference

### Emails

Send and manage transactional emails.

#### Send Email

```bash
POST /resend/emails
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
    'from': 'you@yourdomain.com',
    'to': ['recipient@example.com'],
    'subject': 'Hello from Resend',
    'html': '<p>Welcome to our service!</p>'
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/resend/emails', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

**Request Body:**
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `from` | string | Yes | Sender email (must be from verified domain) |
| `to` | string[] | Yes | Recipient email addresses |
| `subject` | string | Yes | Email subject |
| `html` | string | No | HTML content |
| `text` | string | No | Plain text content |
| `cc` | string[] | No | CC recipients |
| `bcc` | string[] | No | BCC recipients |
| `reply_to` | string[] | No | Reply-to addresses |
| `attachments` | object[] | No | File attachments |
| `tags` | object[] | No | Email tags for tracking |
| `scheduled_at` | string | No | ISO 8601 datetime for scheduled send |

**Response:**
```json
{
  "id": "a52ac168-338f-4fbc-9354-e6049b193d99"
}
```

#### Send Batch Emails

```bash
POST /resend/emails/batch
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps([
    {'from': 'you@yourdomain.com', 'to': ['a@example.com'], 'subject': 'Email 1', 'text': 'Content 1'},
    {'from': 'you@yourdomain.com', 'to': ['b@example.com'], 'subject': 'Email 2', 'text': 'Content 2'}
]).encode()
req = urllib.request.Request('https://gateway.maton.ai/resend/emails/batch', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

#### List Emails

```bash
GET /resend/emails
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/resend/emails')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

**Response:**
```json
{
  "data": [
    {
      "id": "a52ac168-338f-4fbc-9354-e6049b193d99",
      "from": "you@yourdomain.com",
      "to": ["recipient@example.com"],
      "subject": "Hello from Resend",
      "created_at": "2026-03-13T10:00:00.000Z"
    }
  ]
}
```

#### Get Email

```bash
GET /resend/emails/{email_id}
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/resend/emails/{email_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

#### Update Email

```bash
PATCH /resend/emails/{email_id}
```

#### Cancel Scheduled Email

```bash
DELETE /resend/emails/{email_id}
```

### Domains

Manage sending domains.

#### List Domains

```bash
GET /resend/domains
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/resend/domains')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

**Response:**
```json
{
  "data": [
    {
      "id": "5eb93a2e-e849-40a1-81b7-ed0fb574ddd8",
      "name": "yourdomain.com",
      "status": "verified",
      "created_at": "2026-03-13T10:00:00.000Z"
    }
  ]
}
```

#### Create Domain

```bash
POST /resend/domains
```

**Example:**

```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'name': 'yourdomain.com'}).encode()
req = urllib.request.Request('https://gateway.maton.ai/resend/domains', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

**Response:**
```json
{
  "id": "5eb93a2e-e849-40a1-81b7-ed0fb574ddd8",
  "name": "yourdomain.com",
  "status": "pending",
  "records": [
    {"type": "MX", "name": "...", "value": "..."},
    {"type": "TXT", "name": "...", "value": "..."}
  ]
}
```

#### Get Domain

```bash
GET /resend/domains/{domain_id}
`