TrigRun
Use Cases

Schedule Newsletter and Email Dispatch

Trigger scheduled email newsletters and marketing campaigns via API. Use TrigRun to call your email provider (SendGrid, Postmark, Resend) on a cron schedule.

Trigger your newsletter or email campaign at a specific time every week. TrigRun calls your dispatch endpoint — your backend sends the emails through SendGrid, Postmark, Resend, or your own SMTP.

The problem

You want a weekly newsletter that goes out every Tuesday at 9 AM for your audience. Your email platform has a send API but no built-in scheduling (or its scheduling is limited). You need something to trigger the send at the right time, reliably.

How it works with TrigRun

┌─────────────┐  Tue 9 AM    ┌──────────────────┐             ┌──────────────┐
│   TrigRun   │ ────────────▶│ Your Newsletter  │ ───────────▶│  SendGrid /  │
│  Scheduler  │  POST /send  │     API          │  send email │  Resend /    │
└─────────────┘              └──────────────────┘             │  Postmark    │
       │                            │                         └──────────────┘
       ▼                            ▼                                │
  Execution log              Query subscribers                       ▼
  "sent to 2,340             Generate content                  2,340 emails
   recipients"               Call email API                    delivered

Step-by-step setup

1. Store your email API key as a secret

curl -X POST https://api.trigrun.com/v1/secrets \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "newsletter-dispatch-key", "value": "your-internal-api-key"}'

2. Create the weekly job

curl -X POST https://api.trigrun.com/v1/jobs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Weekly newsletter - Tuesday 9 AM",
    "kind": "cron",
    "schedule": {
      "cron": "0 9 * * 2"
    },
    "request": {
      "url": "https://api.yourapp.com/newsletter/dispatch",
      "method": "POST",
      "headers": {
        "Authorization": "secret://newsletter-dispatch-key",
        "Content-Type": "application/json"
      },
      "body": {
        "template": "weekly-digest",
        "segment": "active-subscribers"
      },
      "timeout_seconds": 120
    },
    "retry_policy": {
      "max_attempts": 2,
      "retry_on_statuses": [500, 502, 503]
    }
  }'

3. Add email notification on success

Get confirmation every time the newsletter actually sends:

curl -X POST https://api.trigrun.com/v1/jobs/JOB_ID/notification-rules \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "channel_id": "EMAIL_CHANNEL_ID", "event": "on_completion" }'

Expected results

Successful dispatch:

FieldExample value
Status200 OK
Duration8,420 ms
Response body{"sent": 2340, "bounced": 3, "template": "weekly-digest", "subject": "This Week in Tech - March 16"}
Next run2026-03-23T09:00:00 EDT

Failed dispatch (email API down):

FieldExample value
Status503 Service Unavailable
Attempts2 of 2
Resultfailed — Slack alert sent

Common scheduling patterns

PatternExpressionUTC tip
Weekly Tuesday 9 AM0 9 * * 2Treat this as 9 AM UTC, or convert your audience's local time to UTC before saving
Biweekly Monday0 9 * * 1 (+ skip logic in your app)Handle skip logic server-side
Daily digest0 18 * * 1-5Weekday evenings
Monthly roundup0 10 1 * *First of month

Your dispatch endpoint

# Flask example
@app.route('/newsletter/dispatch', methods=['POST'])
def dispatch_newsletter():
    data = request.json
    subscribers = get_subscribers(data['segment'])
    content = render_template(data['template'])

    result = sendgrid.send_batch(
        to=subscribers,
        subject=content.subject,
        html=content.html,
    )

    return jsonify({
        'sent': result.delivered,
        'bounced': result.bounced,
        'template': data['template'],
        'subject': content.subject,
    })

On this page