im.scheduledMessages lets you create messages that the server will send at a specified time. You can update or delete them before they fire, execute them immediately, and stream lifecycle events.
Create a scheduled message
CreateScheduledMessageOptions
| Field | Type | Required | Description |
|---|---|---|---|
chat | ChatGuid | Yes | Destination conversation |
projectId | string | Yes | Project namespace |
scheduledFor | Date | Yes | When to send the message |
text | string | No | Message text |
service | "iMessage" | "SMS" | "RCS" | No | Service to use |
subject | string | No | Subject line |
effectId | string | No | Send effect ID |
attachmentPath | string | No | Path to an attachment |
attachmentName | string | No | Attachment display name |
clientMessageId | string | No | Idempotency key |
schedule | { type: "once" } | { type: "recurring"; intervalSeconds: number } | No | Single or recurring schedule |
Get a scheduled message
List scheduled messages
list() takes no parameters and returns a plain array of all scheduled messages:
Update a scheduled message
Only pass the fields you want to change. Returns the updatedScheduledMessage.
Delete a scheduled message
Delete all scheduled messages
Execute immediately
Trigger a scheduled message before its scheduled time:Execute all due messages
Execute all scheduled messages that have passed theirscheduledFor time:
Real-time schedule events
ScheduleEvent actions
| Action | When it fires |
|---|---|
created | A new scheduled message was created |
updated | A scheduled message was modified |
deleted | A scheduled message was removed |
sent | The server sent the message successfully |
failed | The server failed to send the message |
ScheduledMessage shape
ScheduledMessageStatus values
| Value | Description |
|---|---|
"pending" | Waiting to be sent |
"inProgress" | Currently being processed |
"complete" | Sent successfully |
"failed" | Failed to send (check errorMessage) |