Job Types
Complete reference for all built-in job types and their payload schemas.
Each job submitted to POST /jobs requires a type field that determines which worker handler processes it. Below are all built-in types with their expected payload shapes.
send_email
Sends transactional email via Resend. Requires RESEND_API_KEY.
{
"type": "send_email",
"payload": {
"to": "user@example.com",
"subject": "Your order is confirmed",
"body": "Thank you for your purchase!",
"from": "noreply@savannahcloud.com"
},
"max_retries": 3
}| Field | Type | Required |
|---|---|---|
to | string | Yes |
subject | string | Yes |
body | string | Yes |
from | string | No (defaults to EMAIL_FROM) |
send_sms
Sends SMS via Africa's Talking. Requires AT_API_KEY and AT_USERNAME.
{
"type": "send_sms",
"payload": {
"to": "+254712345678",
"message": "Your OTP is 123456",
"from": "SavCloud"
},
"max_retries": 3
}| Field | Type | Required |
|---|---|---|
to | string (E.164) | Yes |
message | string | Yes |
from | string | No (optional sender ID) |
webhook
Makes an HTTP POST to an external URL with a custom payload.
{
"type": "webhook",
"payload": {
"url": "https://api.example.com/events",
"payload": { "event": "order.created", "order_id": "ORD-001" }
},
"max_retries": 5
}| Field | Type | Required |
|---|---|---|
url | string (HTTPS URL) | Yes |
payload | object | Yes |
generate_pdf
Generates a PDF from a template and data object.
{
"type": "generate_pdf",
"payload": {
"template": "invoice",
"data": { "invoice_id": "INV-001", "amount": 1500 }
},
"max_retries": 1
}| Field | Type | Required |
|---|---|---|
template | string | Yes |
data | object | Yes |
compress_image
Downloads and compresses an image from a URL.
{
"type": "compress_image",
"payload": {
"url": "https://cdn.example.com/photo.jpg",
"width": 800,
"quality": 80
},
"max_retries": 2
}| Field | Type | Required |
|---|---|---|
url | string | Yes |
width | integer (px) | Yes |
quality | integer (1–100) | No (default: 80) |
ai_summarize
Summarizes text using an AI model.
{
"type": "ai_summarize",
"payload": {
"text": "Long article text goes here...",
"length": "short"
},
"max_retries": 2
}| Field | Type | Required |
|---|---|---|
text | string | Yes |
length | "short" | "medium" | "long" | No (default: "medium") |
mpesa_stk
Triggers a Safaricom M-Pesa STK Push via the Daraja API.
{
"type": "mpesa_stk",
"payload": {
"phone": "254700000000",
"amount": 500,
"ref": "INV-001"
},
"max_retries": 1
}| Field | Type | Required |
|---|---|---|
phone | string (no +) | Yes |
amount | integer (KES) | Yes |
ref | string | Yes |
slack_notify
Posts a message to a Slack channel via Incoming Webhooks.
{
"type": "slack_notify",
"payload": {
"channel": "#deployments",
"text": "Deployment to production succeeded ✓"
},
"max_retries": 3
}| Field | Type | Required |
|---|---|---|
channel | string | Yes |
text | string | Yes |
Custom Job Types
Register any handler in cmd/server/main.go:
pool.Register("my_job_type", func(payload []byte) error {
// process payload
return nil
})Then push jobs with "type": "my_job_type". See Worker Templates.