@photon-ai/advanced-imessage-kit 1.13.0 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -51
- package/dist/index.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -18,40 +18,41 @@ Advanced iMessage Kit is a full-featured iMessage SDK for **reading**, **sending
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
-
| Feature | Description | Method | Example
|
|
22
|
-
| ---------------------------------------------------------- | --------------------------------------------- | -------------------------------------------- |
|
|
23
|
-
| [Send Messages](#send-messages) | Send text messages to any contact | `messages.sendMessage()` | [message-send.ts](./examples/message-send.ts)
|
|
24
|
-
| [Reply to Messages](#send-messages) | Reply inline to a specific message | `messages.sendMessage()` | [message-reply.ts](./examples/message-reply.ts)
|
|
25
|
-
| [Message Effects](#send-messages) | Send with effects (confetti, fireworks, etc.) | `messages.sendMessage()` | [message-effects.ts](./examples/message-effects.ts)
|
|
26
|
-
| [
|
|
27
|
-
| [
|
|
28
|
-
| [
|
|
29
|
-
| [
|
|
30
|
-
| [
|
|
21
|
+
| Feature | Description | Method | Example |
|
|
22
|
+
| ---------------------------------------------------------- | --------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
23
|
+
| [Send Messages](#send-messages) | Send text messages to any contact | `messages.sendMessage()` | [message-send.ts](./examples/message-send.ts) |
|
|
24
|
+
| [Reply to Messages](#send-messages) | Reply inline to a specific message | `messages.sendMessage()` | [message-reply.ts](./examples/message-reply.ts) |
|
|
25
|
+
| [Message Effects](#send-messages) | Send with effects (confetti, fireworks, etc.) | `messages.sendMessage()` | [message-effects.ts](./examples/message-effects.ts) |
|
|
26
|
+
| [Send Rich Links](#send-messages) | Send URLs with rich link previews | `messages.sendMessage()` | [message-rich-link.ts](./examples/message-rich-link.ts) |
|
|
27
|
+
| [Schedule Messages](#scheduled-messages) | Send once or on a recurring schedule | `scheduledMessages.createScheduledMessage()` | [scheduled-message-once.ts](./examples/scheduled-message-once.ts) |
|
|
28
|
+
| [Unsend Messages](#unsend-messages) | Retract a sent message | `messages.unsendMessage()` | [message-unsend.ts](./examples/message-unsend.ts) |
|
|
29
|
+
| [Edit Messages](#edit-messages) | Edit a sent message | `messages.editMessage()` | [message-edit.ts](./examples/message-edit.ts) |
|
|
30
|
+
| [Send Tapbacks](#send-tapbacks) | React with ❤️ 👍 👎 😂 ‼️ ❓ | `messages.sendReaction()` | [message-reaction.ts](./examples/message-reaction.ts) |
|
|
31
|
+
| [Query Messages](#query-messages) | Search and filter message history | `messages.getMessages()` | [message-search.ts](./examples/message-search.ts) |
|
|
31
32
|
| [Destination Caller ID](#query-messages) | See which of your addresses sent/received | `messages.getMessages()` | [message-destination-caller-id.ts](./examples/message-destination-caller-id.ts) |
|
|
32
|
-
| [Message History](#get-chat-messages) | View messages, reactions, polls, stickers | `chats.getChatMessages()` | [message-history.ts](./examples/message-history.ts)
|
|
33
|
-
| [Send Attachments](#send-attachments) | Send images, files, documents | `attachments.sendAttachment()` | [message-attachment.ts](./examples/message-attachment.ts)
|
|
34
|
-
| [Send Audio Messages](#send-audio-messages) | Send voice messages | `attachments.sendAttachment()` | [message-audio.ts](./examples/message-audio.ts)
|
|
35
|
-
| [Send Stickers](#send-stickers) | Send sticker as standalone message | `attachments.sendSticker()` | [message-sticker.ts](./examples/message-sticker.ts)
|
|
36
|
-
| [Reply Stickers](#send-stickers) | Attach sticker to a message bubble | `attachments.sendSticker()` | [message-reply-sticker.ts](./examples/message-reply-sticker.ts)
|
|
37
|
-
| [Download Attachments](#download-attachments) | Download received files and media | `attachments.downloadAttachment()` | [attachment-download.ts](./examples/attachment-download.ts)
|
|
38
|
-
| [Get Chats](#get-chats) | List all conversations | `chats.getChats()` | [chat-fetch.ts](./examples/chat-fetch.ts)
|
|
39
|
-
| [Get Chat Participants](#get-chat-participants) | View group chat participants | `chats.getChat()` | [chat-participants.ts](./examples/chat-participants.ts)
|
|
40
|
-
| [Manage Group Chats](#manage-group-chats) | Add/remove members, rename groups | `chats.addParticipant()` | [chat-group.ts](./examples/chat-group.ts)
|
|
41
|
-
| [Typing Indicators](#typing-indicators) | Show "typing..." status | `chats.startTyping()` | [message-typing.ts](./examples/message-typing.ts)
|
|
42
|
-
| [Get Contacts](#get-contacts) | Fetch device contacts | `contacts.getContacts()` | [contact-list.ts](./examples/contact-list.ts)
|
|
43
|
-
| [Share Contact Card](#share-contact-card) | Share your contact info in chat | `contacts.shareContactCard()` | [message-contact-card.ts](./examples/message-contact-card.ts)
|
|
44
|
-
| [Check iMessage Availability](#check-service-availability) | Verify if contact uses iMessage | `handles.getHandleAvailability()` | [service-check.ts](./examples/service-check.ts)
|
|
45
|
-
| [Server Info](#get-server-info) | Get server status and config | `server.getServerInfo()` | [server-info.ts](./examples/server-info.ts)
|
|
46
|
-
| [Message Statistics](#message-statistics) | Get message counts and analytics | `server.getMessageStats()` | [message-stats.ts](./examples/message-stats.ts)
|
|
47
|
-
| [Create Polls](#create-polls) | Create interactive polls in chat | `polls.create()` | [poll-create.ts](./examples/poll-create.ts)
|
|
48
|
-
| [Vote on Polls](#vote-on-polls) | Vote or unvote on poll options | `polls.vote()` | [poll-vote.ts](./examples/poll-vote.ts)
|
|
49
|
-
| [Add Poll Options](#add-poll-options) | Add options to existing polls | `polls.addOption()` | [poll-add-option.ts](./examples/poll-add-option.ts)
|
|
50
|
-
| [Find My Friends](#find-my-friends) | Get friends' locations | `icloud.refreshFindMyFriends()` | [findmy-friends.ts](./examples/findmy-friends.ts)
|
|
51
|
-
| [Set Chat Background](#chat-background) | Set custom background image for chat | `chats.setBackground()` | [background-set.ts](./examples/background-set.ts)
|
|
52
|
-
| [Remove Chat Background](#chat-background) | Remove background from chat | `chats.removeBackground()` | [background-remove.ts](./examples/background-remove.ts)
|
|
53
|
-
| [Real-time Events](#real-time-events) | Listen for new messages, typing, etc. | `sdk.on()` | [listen-simple.ts](./examples/listen-simple.ts)
|
|
54
|
-
| [Auto Reply](#real-time-events) | Build automated reply bots | `sdk.on()` | [auto-reply-hey.ts](./examples/auto-reply-hey.ts)
|
|
33
|
+
| [Message History](#get-chat-messages) | View messages, reactions, polls, stickers | `chats.getChatMessages()` | [message-history.ts](./examples/message-history.ts) |
|
|
34
|
+
| [Send Attachments](#send-attachments) | Send images, files, documents | `attachments.sendAttachment()` | [message-attachment.ts](./examples/message-attachment.ts) |
|
|
35
|
+
| [Send Audio Messages](#send-audio-messages) | Send voice messages | `attachments.sendAttachment()` | [message-audio.ts](./examples/message-audio.ts) |
|
|
36
|
+
| [Send Stickers](#send-stickers) | Send sticker as standalone message | `attachments.sendSticker()` | [message-sticker.ts](./examples/message-sticker.ts) |
|
|
37
|
+
| [Reply Stickers](#send-stickers) | Attach sticker to a message bubble | `attachments.sendSticker()` | [message-reply-sticker.ts](./examples/message-reply-sticker.ts) |
|
|
38
|
+
| [Download Attachments](#download-attachments) | Download received files and media | `attachments.downloadAttachment()` | [attachment-download.ts](./examples/attachment-download.ts) |
|
|
39
|
+
| [Get Chats](#get-chats) | List all conversations | `chats.getChats()` | [chat-fetch.ts](./examples/chat-fetch.ts) |
|
|
40
|
+
| [Get Chat Participants](#get-chat-participants) | View group chat participants | `chats.getChat()` | [chat-participants.ts](./examples/chat-participants.ts) |
|
|
41
|
+
| [Manage Group Chats](#manage-group-chats) | Add/remove members, rename groups | `chats.addParticipant()` | [chat-group.ts](./examples/chat-group.ts) |
|
|
42
|
+
| [Typing Indicators](#typing-indicators) | Show "typing..." status | `chats.startTyping()` | [message-typing.ts](./examples/message-typing.ts) |
|
|
43
|
+
| [Get Contacts](#get-contacts) | Fetch device contacts | `contacts.getContacts()` | [contact-list.ts](./examples/contact-list.ts) |
|
|
44
|
+
| [Share Contact Card](#share-contact-card) | Share your contact info in chat | `contacts.shareContactCard()` | [message-contact-card.ts](./examples/message-contact-card.ts) |
|
|
45
|
+
| [Check iMessage Availability](#check-service-availability) | Verify if contact uses iMessage | `handles.getHandleAvailability()` | [service-check.ts](./examples/service-check.ts) |
|
|
46
|
+
| [Server Info](#get-server-info) | Get server status and config | `server.getServerInfo()` | [server-info.ts](./examples/server-info.ts) |
|
|
47
|
+
| [Message Statistics](#message-statistics) | Get message counts and analytics | `server.getMessageStats()` | [message-stats.ts](./examples/message-stats.ts) |
|
|
48
|
+
| [Create Polls](#create-polls) | Create interactive polls in chat | `polls.create()` | [poll-create.ts](./examples/poll-create.ts) |
|
|
49
|
+
| [Vote on Polls](#vote-on-polls) | Vote or unvote on poll options | `polls.vote()` | [poll-vote.ts](./examples/poll-vote.ts) |
|
|
50
|
+
| [Add Poll Options](#add-poll-options) | Add options to existing polls | `polls.addOption()` | [poll-add-option.ts](./examples/poll-add-option.ts) |
|
|
51
|
+
| [Find My Friends](#find-my-friends) | Get friends' locations | `icloud.refreshFindMyFriends()` | [findmy-friends.ts](./examples/findmy-friends.ts) |
|
|
52
|
+
| [Set Chat Background](#chat-background) | Set custom background image for chat | `chats.setBackground()` | [background-set.ts](./examples/background-set.ts) |
|
|
53
|
+
| [Remove Chat Background](#chat-background) | Remove background from chat | `chats.removeBackground()` | [background-remove.ts](./examples/background-remove.ts) |
|
|
54
|
+
| [Real-time Events](#real-time-events) | Listen for new messages, typing, etc. | `sdk.on()` | [listen-simple.ts](./examples/listen-simple.ts) |
|
|
55
|
+
| [Auto Reply](#real-time-events) | Build automated reply bots | `sdk.on()` | [auto-reply-hey.ts](./examples/auto-reply-hey.ts) |
|
|
55
56
|
|
|
56
57
|
---
|
|
57
58
|
|
|
@@ -135,7 +136,7 @@ interface ClientConfig {
|
|
|
135
136
|
|
|
136
137
|
## Messages
|
|
137
138
|
|
|
138
|
-
> Examples: [message-send.ts](./examples/message-send.ts) | [message-unsend.ts](./examples/message-unsend.ts) | [message-edit.ts](./examples/message-edit.ts) | [message-reaction.ts](./examples/message-reaction.ts) | [message-search.ts](./examples/message-search.ts)
|
|
139
|
+
> Examples: [message-send.ts](./examples/message-send.ts) | [message-unsend.ts](./examples/message-unsend.ts) | [message-edit.ts](./examples/message-edit.ts) | [message-reaction.ts](./examples/message-reaction.ts) | [message-rich-link.ts](./examples/message-rich-link.ts) | [message-search.ts](./examples/message-search.ts)
|
|
139
140
|
|
|
140
141
|
### Send Messages
|
|
141
142
|
|
|
@@ -160,6 +161,13 @@ await sdk.messages.sendMessage({
|
|
|
160
161
|
message: "This is a reply",
|
|
161
162
|
selectedMessageGuid: "original-message-guid",
|
|
162
163
|
});
|
|
164
|
+
|
|
165
|
+
// Send a rich link preview
|
|
166
|
+
await sdk.messages.sendMessage({
|
|
167
|
+
chatGuid: "iMessage;-;+1234567890",
|
|
168
|
+
message: "https://photon.codes/",
|
|
169
|
+
richLink: true,
|
|
170
|
+
});
|
|
163
171
|
```
|
|
164
172
|
|
|
165
173
|
**Message Effects**:
|
|
@@ -329,7 +337,7 @@ const updated = await sdk.scheduledMessages.updateScheduledMessage(
|
|
|
329
337
|
},
|
|
330
338
|
scheduledFor: Date.now() + 10 * 60 * 1000,
|
|
331
339
|
schedule: { type: "once" },
|
|
332
|
-
}
|
|
340
|
+
}
|
|
333
341
|
);
|
|
334
342
|
|
|
335
343
|
await sdk.scheduledMessages.deleteScheduledMessage("scheduled-id");
|
|
@@ -486,11 +494,18 @@ if (bgInfo.hasBackground) {
|
|
|
486
494
|
console.log(`Image URL: ${bgInfo.imageUrl}`);
|
|
487
495
|
}
|
|
488
496
|
|
|
489
|
-
// Set a background image
|
|
497
|
+
// Set a background image (using file path)
|
|
490
498
|
await sdk.chats.setBackground("chat-guid", {
|
|
491
499
|
filePath: "/path/to/image.png",
|
|
492
500
|
});
|
|
493
501
|
|
|
502
|
+
// Set a background image (using base64)
|
|
503
|
+
import fs from "node:fs";
|
|
504
|
+
const imageBuffer = fs.readFileSync("/path/to/image.png");
|
|
505
|
+
await sdk.chats.setBackground("chat-guid", {
|
|
506
|
+
fileData: imageBuffer.toString("base64"),
|
|
507
|
+
});
|
|
508
|
+
|
|
494
509
|
// Remove background
|
|
495
510
|
await sdk.chats.removeBackground("chat-guid");
|
|
496
511
|
```
|
|
@@ -580,8 +595,9 @@ const buffer = await sdk.attachments.downloadAttachment("attachment-guid", {
|
|
|
580
595
|
});
|
|
581
596
|
|
|
582
597
|
// Download Live Photo video
|
|
583
|
-
const liveBuffer =
|
|
584
|
-
|
|
598
|
+
const liveBuffer = await sdk.attachments.downloadAttachmentLive(
|
|
599
|
+
"attachment-guid"
|
|
600
|
+
);
|
|
585
601
|
|
|
586
602
|
// Get blurhash (for placeholders)
|
|
587
603
|
const blurhash = await sdk.attachments.getAttachmentBlurhash("attachment-guid");
|
|
@@ -670,11 +686,11 @@ Check if a phone/email supports iMessage or FaceTime:
|
|
|
670
686
|
// First parameter is the address (phone or email), not handle guid
|
|
671
687
|
const hasIMessage = await sdk.handles.getHandleAvailability(
|
|
672
688
|
"+1234567890",
|
|
673
|
-
"imessage"
|
|
689
|
+
"imessage"
|
|
674
690
|
);
|
|
675
691
|
const hasFaceTime = await sdk.handles.getHandleAvailability(
|
|
676
692
|
"+1234567890",
|
|
677
|
-
"facetime"
|
|
693
|
+
"facetime"
|
|
678
694
|
);
|
|
679
695
|
|
|
680
696
|
// Choose service based on availability
|
|
@@ -854,10 +870,10 @@ const locations = await sdk.icloud.refreshFindMyFriends();
|
|
|
854
870
|
const friend = locations.find((loc) => loc.handle === "+1234567890");
|
|
855
871
|
if (friend) {
|
|
856
872
|
console.log(
|
|
857
|
-
`Coordinates: ${friend.coordinates[0]}, ${friend.coordinates[1]}
|
|
873
|
+
`Coordinates: ${friend.coordinates[0]}, ${friend.coordinates[1]}`
|
|
858
874
|
);
|
|
859
875
|
console.log(
|
|
860
|
-
`Maps: https://maps.google.com/?q=${friend.coordinates[0]},${friend.coordinates[1]}
|
|
876
|
+
`Maps: https://maps.google.com/?q=${friend.coordinates[0]},${friend.coordinates[1]}`
|
|
861
877
|
);
|
|
862
878
|
if (friend.long_address) console.log(`Address: ${friend.long_address}`);
|
|
863
879
|
}
|
|
@@ -1061,15 +1077,15 @@ bun run examples/<filename>.ts
|
|
|
1061
1077
|
|
|
1062
1078
|
### Message Operations
|
|
1063
1079
|
|
|
1064
|
-
| File
|
|
1065
|
-
|
|
|
1066
|
-
| [message-reply.ts](./examples/message-reply.ts)
|
|
1067
|
-
| [message-unsend.ts](./examples/message-unsend.ts)
|
|
1068
|
-
| [message-edit.ts](./examples/message-edit.ts)
|
|
1069
|
-
| [message-reaction.ts](./examples/message-reaction.ts)
|
|
1070
|
-
| [message-effects.ts](./examples/message-effects.ts)
|
|
1071
|
-
| [message-search.ts](./examples/message-search.ts)
|
|
1072
|
-
| [message-history.ts](./examples/message-history.ts)
|
|
1080
|
+
| File | Description |
|
|
1081
|
+
| ------------------------------------------------------------------------------- | --------------------- |
|
|
1082
|
+
| [message-reply.ts](./examples/message-reply.ts) | Reply to messages |
|
|
1083
|
+
| [message-unsend.ts](./examples/message-unsend.ts) | Unsend messages |
|
|
1084
|
+
| [message-edit.ts](./examples/message-edit.ts) | Edit messages |
|
|
1085
|
+
| [message-reaction.ts](./examples/message-reaction.ts) | Send Tapbacks |
|
|
1086
|
+
| [message-effects.ts](./examples/message-effects.ts) | Message effects |
|
|
1087
|
+
| [message-search.ts](./examples/message-search.ts) | Search messages |
|
|
1088
|
+
| [message-history.ts](./examples/message-history.ts) | Message history |
|
|
1073
1089
|
| [message-destination-caller-id.ts](./examples/message-destination-caller-id.ts) | Destination caller ID |
|
|
1074
1090
|
|
|
1075
1091
|
### Chats & Groups
|
package/dist/index.cjs
CHANGED
|
@@ -410,7 +410,19 @@ var ChatModule = class {
|
|
|
410
410
|
return response.data.data;
|
|
411
411
|
}
|
|
412
412
|
async setBackground(chatGuid, options) {
|
|
413
|
-
|
|
413
|
+
let body;
|
|
414
|
+
if (typeof options === "string") {
|
|
415
|
+
body = { imageUrl: options };
|
|
416
|
+
} else if (options.filePath) {
|
|
417
|
+
const fileBuffer = await promises.readFile(options.filePath);
|
|
418
|
+
body = { fileData: fileBuffer.toString("base64") };
|
|
419
|
+
} else if (options.fileData) {
|
|
420
|
+
body = { fileData: options.fileData };
|
|
421
|
+
} else if (options.imageUrl) {
|
|
422
|
+
body = { imageUrl: options.imageUrl };
|
|
423
|
+
} else {
|
|
424
|
+
throw new Error("Either filePath, fileData, or imageUrl must be provided");
|
|
425
|
+
}
|
|
414
426
|
await this.http.post(`/api/v1/chat/${encodeURIComponent(chatGuid)}/background`, body);
|
|
415
427
|
}
|
|
416
428
|
async removeBackground(chatGuid) {
|