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.
createChat
Create a new chat conversation with one or more participants.
await sdk.chats.createChat(options): Promise<ChatResponse>
Parameters
Configuration for creating the chatArray of participant addresses (phone numbers or email addresses)
Initial message to send when creating the chat
method
'apple-script' | 'private-api'
Method to use for creating the chat
Service to use for the chat (defaults to iMessage)
Temporary GUID for the chat
Subject line for the chat (group chats only)
Message effect ID for the initial message
Attributed body data for rich text formatting
Returns
The newly created chat objectUnique identifier for the chat
Chat style (0 = individual, 43 = group)
Whether the chat is archived
Whether the chat is filtered
Group identifier for group chats
Array of participant handles
Most recent message in the chat
Last addressed handle in the chat
Additional chat properties
Example
import { SDK } from '@photon-ai/advanced-imessage-kit';
const sdk = SDK({ serverUrl: 'http://localhost:1234' });
// Create a 1-on-1 chat with initial message
const individualChat = await sdk.chats.createChat({
addresses: ['+1234567890'],
message: 'Hey! How are you?'
});
console.log(`Created chat: ${individualChat.guid}`);
// Create a group chat
const groupChat = await sdk.chats.createChat({
addresses: ['+1234567890', '+0987654321', 'friend@icloud.com'],
message: 'Welcome to the group!',
subject: 'Weekend Plans'
});
console.log(`Created group: ${groupChat.displayName}`);
// Create chat with SMS service
const smsChat = await sdk.chats.createChat({
addresses: ['+1234567890'],
service: 'SMS',
message: 'Sending via SMS'
});
// Create chat with message effect
const chatWithEffect = await sdk.chats.createChat({
addresses: ['+1234567890'],
message: 'Happy Birthday!',
effectId: 'com.apple.messages.effect.CKConfettiEffect'
});
// Create chat using private API
const privateApiChat = await sdk.chats.createChat({
addresses: ['+1234567890'],
message: 'Hello!',
method: 'private-api'
});