latestSwagger 2.02026-08-101561322.2 MB

3e4029d19684

Scheduled Email Campaigns

Schedule new email campaign

<a class="try-sandbox-link" href="https://sandbox.textmagic.com/#/undefined/scheduleEmailCampaign" target="_blank">Try in sandbox</a><br>Creates a new scheduled email campaign that will be sent at a specified time or according to a recurring schedule.

post/api/v2/email-campaigns/schedule

Request body

emailSenderIdinteger required

Email sender ID from your configured senders.

subjectstring required

Email subject line.

messagestring required

HTML email content.

fromNamestring nullable

Optional custom sender name.

replyToEmailstring email nullable

Optional custom reply-to email address.

Example request

{
  "emailSenderId": 123,
  "subject": "Weekly Newsletter - Week of December 4th",
  "message": "<html><body><h1>This Week's Updates</h1><p>Here are the latest news and updates...</p></body></html>",
  "fromName": "Newsletter Team",
  "replyToEmail": "newsletter@company.com",
  "recipients": {
    "contactIds": [
      101,
      102,
      103
    ],
    "emails": [
      "user1@example.com",
      "user2@example.com"
    ],
    "groupIds": [
      456,
      789
    ]
  },
  "scheduleParams": {
    "startDateTime": "2023-12-04T09:00:00Z",
    "timezone": "America/New_York",
    "rrule": "FREQ=WEEKLY;BYDAY=MO"
  }
}

Response

Email campaign scheduled successfully.

costnumber float required

Estimated cost for sending this campaign.

Example response

{
  "campaign": {
    "id": 12345,
    "status": "scheduled",
    "emailSenderId": 123,
    "startAt": "2023-12-04T14:00:00Z",
    "endAt": "2024-12-04T14:00:00Z",
    "nextSendAt": "2023-12-04T14:00:00Z",
    "createdBy": {
      "id": 456,
      "firstName": "John",
      "lastName": "Smith",
      "avatarUrl": "https://example.com/avatar.jpg",
      "email": "john.smith@example.com"
    },
    "createdAt": "2023-12-01T10:30:00Z",
    "updatedAt": "2023-12-01T10:30:00Z",
    "type": "weekly",
    "fromName": "Newsletter Team",
    "fromEmail": "noreply@company.com",
    "replyToEmail": "newsletter@company.com",
    "subject": "Weekly Newsletter - Week of December 4th",
    "html": "<html><body><h1>This Week's Updates</h1><p>Here are the latest news and updates...</p></body></html>",
    "recipientsCount": 1250,
    "sendingTimezone": "America/New_York",
    "rrule": "FREQ=WEEKLY;BYDAY=MO",
    "occurrenceSummary": "Weekly on Monday"
  },
  "cost": 12.5
}