Documentation Index
Fetch the complete documentation index at: https://mintlify.com/photon-hq/advanced-imessage-kit/llms.txt
Use this file to discover all available pages before exploring further.
Method
await sdk.scheduledMessages.createScheduledMessage(options: CreateScheduledMessageOptions): Promise<ScheduledMessageData>
Schedules a message to be sent at a specific time. Supports both one-time and recurring schedules with flexible interval types.
Parameters
options
CreateScheduledMessageOptions
required
Configuration for the scheduled message
Type of scheduled action. Use "send-message" for sending messages
The message payload to send
The chat GUID to send the message to
Send method. Use "apple-script" for standard sending
Timestamp (in milliseconds) when the message should first be sent
Schedule configuration
Set to "once" for a one-time scheduled message
Set to "recurring" for repeating messages
Interval type. Options: "hourly", "daily", "weekly", "monthly", "yearly"
How many intervals between each occurrence (e.g., 1 for every day, 2 for every 2 weeks)
Returns
The created scheduled message
Unique identifier for the scheduled message
The chat GUID this message is scheduled for
The message text that will be sent
Timestamp when the message will be sent
Timestamp when the scheduled message was created
The action type (e.g., “send-message”)
The full payload configuration
Examples
One-Time Scheduled Message
// Schedule a message for 3 seconds from now
const scheduledFor = Date.now() + 3 * 1000;
const scheduled = await sdk.scheduledMessages.createScheduledMessage({
type: "send-message",
payload: {
chatGuid: "iMessage;-;+1234567890",
message: "This is a scheduled message!",
method: "apple-script",
},
scheduledFor,
schedule: { type: "once" },
});
console.log(`Scheduled message ID: ${scheduled.id}`);
console.log(`Will send at: ${new Date(scheduledFor).toLocaleString()}`);
Recurring Daily Message
// Schedule a daily good morning message starting tomorrow at 9 AM
const tomorrow9am = new Date();
tomorrow9am.setDate(tomorrow9am.getDate() + 1);
tomorrow9am.setHours(9, 0, 0, 0);
const daily = await sdk.scheduledMessages.createScheduledMessage({
type: "send-message",
payload: {
chatGuid: "iMessage;-;+1234567890",
message: "Good morning!",
method: "apple-script",
},
scheduledFor: tomorrow9am.getTime(),
schedule: {
type: "recurring",
intervalType: "daily",
interval: 1,
},
});
console.log(`Scheduled recurring message ID: ${daily.id}`);
console.log(`First occurrence: ${tomorrow9am.toLocaleString()}`);
console.log(`Repeats: every day`);
Weekly Reminder
// Schedule a weekly reminder every Monday at 8 AM
const nextMonday = new Date();
const daysUntilMonday = (1 - nextMonday.getDay() + 7) % 7 || 7;
nextMonday.setDate(nextMonday.getDate() + daysUntilMonday);
nextMonday.setHours(8, 0, 0, 0);
const weekly = await sdk.scheduledMessages.createScheduledMessage({
type: "send-message",
payload: {
chatGuid: "iMessage;-;+1234567890",
message: "Weekly team sync in 1 hour!",
method: "apple-script",
},
scheduledFor: nextMonday.getTime(),
schedule: {
type: "recurring",
intervalType: "weekly",
interval: 1,
},
});
Notes
- All timestamps are in milliseconds (use
Date.now() or new Date().getTime())
- For recurring messages,
scheduledFor sets the first occurrence time
- The interval types determine the frequency: hourly, daily, weekly, monthly, or yearly
- Use
interval to skip periods (e.g., interval: 2 with intervalType: "weekly" sends every 2 weeks)
- Scheduled messages persist until deleted or the schedule completes