ScheduledMessages

Schedule a message

Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor.

POST
/v1/messages/scheduled

Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Requires messages:create or the send permission of the channel it sends on, such as email:send. Optional timezone is validated IANA display metadata only and never changes the execution instant.

Authorization

apiKey
headerx-api-key<token>

Header Parameters

idempotency-key?string
Length1 <= length <= 255

Request Body

application/json
  1. body
send*||
scheduledFor*string
timezone?IanaTimezone|null
referenceId?string|null

Response Body

Success

application/json
  1. response
id*ScheduledMessageId
Match^sched_[0-9a-hjkmnp-tv-z]{16,24}$
status*string
Value in"pending""dispatching""paused""dispatched""cancelled""failed"
scheduledFor*string
timezone*string
send*||
messageId*|null
idempotencyKey*string|null
referenceId*string|null
failureReason*string|null
attempts*number
createdBy*string|null
actorEmail*string
memberRole*string
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.scheduledMessages.create({  "send": {    "channel": "email",    "to": [      {        "contactId": "example"      }    ],    "email": {}  },  "scheduledFor": "example"});
Example Response
{  "id": "string",  "status": "pending",  "scheduledFor": "string",  "timezone": "string",  "send": {    "conversationId": "string",    "metadata": {      "property1": "string",      "property2": "string"    },    "channel": "email",    "to": [      {        "contactId": "string"      }    ],    "cc": [      {        "contactId": "string"      }    ],    "bcc": [      {        "contactId": "string"      }    ],    "from": {      "email": "string",      "name": "string"    },    "email": {      "subject": "string",      "html": "string",      "text": "string",      "attachments": [        {          "filename": "string",          "content": "string",          "mediaId": "string",          "contentType": "string",          "size": 1        }      ],      "publicationId": "string",      "inputContractId": "string",      "templateId": "string",      "templateSlug": "string",      "templateData": {        "property1": "string",        "property2": "string"      },      "locale": "string",      "timeZone": "string",      "inReplyToMessageId": "string",      "replyTo": [        "string"      ],      "topicId": "string",      "tracking": {        "opens": true,        "clicks": true      },      "footer": {        "enabled": true      },      "headers": {        "property1": "string",        "property2": "string"      }    }  },  "messageId": "string",  "idempotencyKey": "string",  "referenceId": "string",  "failureReason": "string",  "attempts": 0,  "createdBy": "string",  "actorEmail": "string",  "memberRole": "string",  "createdAt": "string",  "updatedAt": "string"}

Related documentation