From 810f96fcb45a1e2e5685049c9fa059450e4d693a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 08:41:02 +0000 Subject: [PATCH] docs: update advanced-imessage-ts documentation for v1.0.0 --- .../advanced-kits/imessage/messages.mdx.vel | 46 +++++++++++++++++++ package.json | 2 +- pnpm-lock.yaml | 45 +++++++++++++----- 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/docs-src/advanced-kits/imessage/messages.mdx.vel b/docs-src/advanced-kits/imessage/messages.mdx.vel index ae37ced..770e437 100644 --- a/docs-src/advanced-kits/imessage/messages.mdx.vel +++ b/docs-src/advanced-kits/imessage/messages.mdx.vel @@ -23,6 +23,7 @@ Get a `chat.guid` before calling message APIs. `chat.guid` is the server's chat | Format text | `formatting: [...]` | | Send an attachment | Upload with `im.attachments.upload(...)`, then call `im.messages.sendAttachment(...)` | | Send a card that opens your iMessage extension | `im.messages.sendCustomizedMiniApp(chat.guid, message)` | +| Update a sent mini app card | `im.messages.updateCustomizedMiniApp(session, message)` | | Reply to a message | `replyTo` on `sendText(...)`, `sendAttachment(...)`, or `sendMultipart(...)` | | Send multipart content | `im.messages.sendMultipart(...)` | | Add or remove a reaction | `im.messages.setReaction(...)` | @@ -216,6 +217,7 @@ console.log(sent.guid); | `extensionBundleId` | Bundle identifier of the iMessage extension target inside your app. | | `url` | Absolute URL delivered to your extension when the recipient taps the card. | | `layout` | What the card looks like in the conversation, covered in [Card Layout](#card-layout) below. | +| `live` | Optional. When `true`, renders the installed extension's live UI (`MSMessageLiveLayout`) when available. Defaults to `false`. | This call does not accept `replyTo`, message effects, or `subject`. The only option you can pass in the final argument is `clientMessageId`, used as an idempotency key for job retries. @@ -246,6 +248,50 @@ The server enforces these rules at send time: `layout.image` must be JPEG bytes. The server checks the JPEG SOI marker (`FF D8`) and rejects any other format. Convert PNG, WebP, HEIC, or anything else to JPEG before calling. +### Live Layout + +Set `live: true` to render the installed extension's live UI when available. When the recipient has your extension installed, Messages.app uses `MSMessageLiveLayout` to display the extension's live view instead of the static card. + +```ts +const sent = await im.messages.sendCustomizedMiniApp(chat.guid, { + appName: "MyGame", + teamId: "ABCDE12345", + extensionBundleId: "com.example.mygame.MessagesExtension", + url: "https://mygame.example.com/level/7", + live: true, + layout: { + caption: "Level 7", + subcaption: "Your turn", + }, +}); +``` + +The static `layout` is still required — it serves as the fallback for recipients who do not have the extension installed or on surfaces that cannot render live content. + +### Update Mini App Cards + +`updateCustomizedMiniApp(...)` updates a previously sent mini app card in place. Pass the `miniAppCardSession` returned by `sendCustomizedMiniApp(...)` or by a previous update. + +```ts +const result = await im.messages.sendCustomizedMiniApp(chat.guid, { + appName: "MyGame", + teamId: "ABCDE12345", + extensionBundleId: "com.example.mygame.MessagesExtension", + url: "https://mygame.example.com/level/7", + layout: { caption: "Level 7", subcaption: "Waiting..." }, +}); + +const updated = await im.messages.updateCustomizedMiniApp(result.miniAppCardSession, { + appName: "MyGame", + teamId: "ABCDE12345", + extensionBundleId: "com.example.mygame.MessagesExtension", + url: "https://mygame.example.com/level/7", + layout: { caption: "Level 7", subcaption: "Your turn" }, +}); +``` + +The update call takes the same message fields as `sendCustomizedMiniApp(...)` — `appName`, `teamId`, `extensionBundleId`, `url`, `layout`, and optionally `appStoreId` and `live`. + ## Reply to a Message To reply to a message, pass the target message GUID as `replyTo`: diff --git a/package.json b/package.json index da2f51e..4bb67d0 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^4.19.0", - "@photon-ai/advanced-imessage": "^0.11.2", + "@photon-ai/advanced-imessage": "^1.0.0", "@photon-ai/advanced-imessage-kit": "^1.14.3", "@photon-ai/imessage-kit": "^2.1.2", "@photon-ai/whatsapp-business": "^0.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11734b2..04aed18 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^4.19.0 version: 4.19.0(@typescript-eslint/rule-tester@8.58.1(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(@typescript-eslint/typescript-estree@8.58.2(typescript@5.9.3))(@typescript-eslint/utils@8.58.2(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(@vue/compiler-sfc@3.5.32)(eslint-plugin-format@2.0.1(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3) '@photon-ai/advanced-imessage': - specifier: ^0.11.2 - version: 0.11.2 + specifier: ^1.0.0 + version: 1.0.0 '@photon-ai/advanced-imessage-kit': specifier: ^1.14.3 version: 1.14.3(typescript@5.9.3) @@ -927,6 +927,10 @@ packages: resolution: {integrity: sha512-3mjzy1IIBtsCQK6kAB8dbFCK0np7hS256wwW+nqNL8vKz0W5nRhu1iKAwyZxP8Z470dtNX5RjNgcl9I4wZeuTA==} engines: {node: '>=18.17'} + '@photon-ai/advanced-imessage@1.0.0': + resolution: {integrity: sha512-X5xaXy0SqPa9AuLxD0d/XI04e7WMO2rpXlT94TTMbtVkW0mTlb88fnp3SCwZKl/zEpCC3wQkuEfpNAM2Xgnyww==} + engines: {node: '>=18.17'} + '@photon-ai/imessage-kit@2.1.2': resolution: {integrity: sha512-xteMkPqqWkPLv40M9gA1HJGS/fHXIWzzXNCwRfnC4+bj120KMXMacT9zOSoEcGk4MA0pGXcUMQPE16MdB+Bf/g==} engines: {node: '>=18.0.0'} @@ -2341,8 +2345,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - nanoid@3.3.14: - resolution: {integrity: sha512-U9kYi5bpVMEI31yC8iw4bJJp0avcHXA0W8/wNfLfnvJYzihQo2ZRPYPvpAAd570HAcCBjCTN7vnr+v4StKl1IQ==} + nanoid@3.3.15: + resolution: {integrity: sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -2464,6 +2468,10 @@ packages: resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} engines: {node: '>=12'} + picomatch@4.0.5: + resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==} + engines: {node: '>=12'} + pkg-types@1.3.1: resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} @@ -2481,8 +2489,8 @@ packages: resolution: {integrity: sha512-orRsuYpJVw8LdAwqqLykBj9ecS5/cRHlI5+nvTo8LcCKmzDmqVORXtOIYEEQuL9D4BxtA1lm5isAqzQZCoQ6Eg==} engines: {node: '>=4'} - postcss@8.5.15: - resolution: {integrity: sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==} + postcss@8.5.16: + resolution: {integrity: sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==} engines: {node: ^10 || ^12 || >=14} prebuild-install@7.1.3: @@ -3489,6 +3497,13 @@ snapshots: nice-grpc: 2.1.16 nice-grpc-common: 2.0.3 + '@photon-ai/advanced-imessage@1.0.0': + dependencies: + '@bufbuild/protobuf': 2.12.0 + '@grpc/grpc-js': 1.14.4 + nice-grpc: 2.1.16 + nice-grpc-common: 2.0.3 + '@photon-ai/imessage-kit@2.1.2': dependencies: node-typedstream: 1.4.1 @@ -3919,7 +3934,7 @@ snapshots: '@vue/shared': 3.5.32 estree-walker: 2.0.2 magic-string: 0.30.21 - postcss: 8.5.15 + postcss: 8.5.16 source-map-js: 1.2.1 '@vue/compiler-ssr@3.5.32': @@ -4637,6 +4652,10 @@ snapshots: optionalDependencies: picomatch: 4.0.4 + fdir@6.5.0(picomatch@4.0.5): + optionalDependencies: + picomatch: 4.0.5 + file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -5217,7 +5236,7 @@ snapshots: ms@2.1.3: {} - nanoid@3.3.14: {} + nanoid@3.3.15: {} napi-build-utils@2.0.0: optional: true @@ -5379,6 +5398,8 @@ snapshots: picomatch@4.0.4: {} + picomatch@4.0.5: {} + pkg-types@1.3.1: dependencies: confbox: 0.1.8 @@ -5402,9 +5423,9 @@ snapshots: cssesc: 3.0.0 util-deprecate: 1.0.2 - postcss@8.5.15: + postcss@8.5.16: dependencies: - nanoid: 3.3.14 + nanoid: 3.3.15 picocolors: 1.1.1 source-map-js: 1.2.1 @@ -5693,8 +5714,8 @@ snapshots: tinyglobby@0.2.17: dependencies: - fdir: 6.5.0(picomatch@4.0.4) - picomatch: 4.0.4 + fdir: 6.5.0(picomatch@4.0.5) + picomatch: 4.0.5 tinypool@2.1.0: {}