@photon-ai/advanced-imessage-kit 1.6.1 → 1.7.0
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 +38 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ Advanced iMessage Kit is a full-featured iMessage SDK for **reading**, **sending
|
|
|
34
34
|
| [Reply Stickers](#send-stickers) | Attach sticker to a message bubble | `attachments.sendSticker()` | [message-reply-sticker.ts](./examples/message-reply-sticker.ts) |
|
|
35
35
|
| [Download Attachments](#download-attachments) | Download received files and media | `attachments.downloadAttachment()` | [attachment-download.ts](./examples/attachment-download.ts) |
|
|
36
36
|
| [Get Chats](#get-chats) | List all conversations | `chats.getChats()` | [chat-fetch.ts](./examples/chat-fetch.ts) |
|
|
37
|
+
| [Get Chat Participants](#get-chat-participants) | View group chat participants | `chats.getChat()` | [chat-participants.ts](./examples/chat-participants.ts) |
|
|
37
38
|
| [Manage Group Chats](#manage-group-chats) | Add/remove members, rename groups | `chats.addParticipant()` | [chat-group.ts](./examples/chat-group.ts) |
|
|
38
39
|
| [Typing Indicators](#typing-indicators) | Show "typing..." status | `chats.startTyping()` | [message-typing.ts](./examples/message-typing.ts) |
|
|
39
40
|
| [Get Contacts](#get-contacts) | Fetch device contacts | `contacts.getContacts()` | [contact-list.ts](./examples/contact-list.ts) |
|
|
@@ -291,6 +292,37 @@ const chat = await sdk.chats.getChat("chat-guid", {
|
|
|
291
292
|
});
|
|
292
293
|
```
|
|
293
294
|
|
|
295
|
+
### Get Chat Participants
|
|
296
|
+
|
|
297
|
+
Get participants from group chats and display them with contact names:
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
const chats = await sdk.chats.getChats();
|
|
301
|
+
const groups = chats.filter((chat) => chat.style === 43); // Filter group chats
|
|
302
|
+
|
|
303
|
+
// Get contacts for name mapping
|
|
304
|
+
const contacts = await sdk.contacts.getContacts();
|
|
305
|
+
const nameMap = new Map<string, string>();
|
|
306
|
+
for (const c of contacts) {
|
|
307
|
+
const name = c.displayName || c.firstName || "";
|
|
308
|
+
if (!name) continue;
|
|
309
|
+
for (const p of c.phoneNumbers || []) nameMap.set(p.address, name);
|
|
310
|
+
for (const e of c.emails || []) nameMap.set(e.address, name);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Display participants
|
|
314
|
+
groups.forEach((group) => {
|
|
315
|
+
console.log(`Group: ${group.displayName || group.chatIdentifier}`);
|
|
316
|
+
group.participants?.forEach((p) => {
|
|
317
|
+
const name = nameMap.get(p.address);
|
|
318
|
+
const display = name ? `${name} <${p.address}>` : p.address;
|
|
319
|
+
console.log(` - ${display} (${p.service})`);
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
> Example: [chat-participants.ts](./examples/chat-participants.ts)
|
|
325
|
+
|
|
294
326
|
### Create Chat
|
|
295
327
|
|
|
296
328
|
```typescript
|
|
@@ -926,11 +958,12 @@ bun run examples/<filename>.ts
|
|
|
926
958
|
|
|
927
959
|
### Chats & Groups
|
|
928
960
|
|
|
929
|
-
| File
|
|
930
|
-
|
|
|
931
|
-
| [chat-fetch.ts](./examples/chat-fetch.ts)
|
|
932
|
-
| [chat-
|
|
933
|
-
| [
|
|
961
|
+
| File | Description |
|
|
962
|
+
| ------------------------------------------------------- | ---------------------- |
|
|
963
|
+
| [chat-fetch.ts](./examples/chat-fetch.ts) | Get chat list |
|
|
964
|
+
| [chat-participants.ts](./examples/chat-participants.ts) | Get group participants |
|
|
965
|
+
| [chat-group.ts](./examples/chat-group.ts) | Manage groups |
|
|
966
|
+
| [message-typing.ts](./examples/message-typing.ts) | Typing indicators |
|
|
934
967
|
|
|
935
968
|
### Contacts & Services
|
|
936
969
|
|