Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ explicit session:

```shell
polymorfa group list --session session_123
polymorfa group view 123@g.us --session session_123
polymorfa group participants list 123@g.us --session session_123
polymorfa group invite-link 123@g.us --session session_123
polymorfa group view 750000000001 --session session_123
polymorfa group participants list 750000000001 --session session_123
polymorfa group invite-link 750000000001 --session session_123
```

Add `--json` for complete resource data and response metadata. Group and
Expand All @@ -117,30 +117,32 @@ Send text and perform the complete set of source-defined Messaging actions:
```shell
polymorfa message send text \
--session session_123 \
--to 15551234567@s.whatsapp.net \
--to +15551234567 \
--body 'Hello'

polymorfa message react message_123 \
polymorfa message react 740000000001 \
--session session_123 \
--chat 15551234567@s.whatsapp.net \
--chat +15551234567 \
--emoji '👍'

polymorfa message mark-seen message_123 \
polymorfa message mark-seen 740000000001 \
--session session_123 \
--chat 15551234567@s.whatsapp.net
--chat +15551234567

polymorfa message typing \
--session session_123 \
--chat 15551234567@s.whatsapp.net \
--chat +15551234567 \
--state typing

polymorfa message star message_123 \
polymorfa message star 740000000001 \
--session session_123 \
--chat 15551234567@s.whatsapp.net
--chat +15551234567
```

Add `--remove` to `message star` to unstar. Text sends accept repeatable
`--mention`, paired `--reply-to` and `--reply-participant`, and `--forwarded`.
`--mention` with a Polymorfa user ID, `--reply-to` with a Polymorfa message ID,
and `--forwarded`. `--to` and `--chat` accept a conversation ID, E.164 phone
number, or BSUID. The API resolves message direction and sender identity.
Every mutation accepts `--idempotency-key` for safe retry identity. Server API
keys require `messages:write`; client tokens remain subject to their live
recipient rules, allowed actions, and rate limits.
Expand Down Expand Up @@ -185,10 +187,10 @@ polymorfa label create --session session_123 --name Priority --color 5
polymorfa label update label_123 --session session_123 --name Urgent
polymorfa label delete label_123 --session session_123 --yes

polymorfa label chat list 15551234567@s.whatsapp.net \
polymorfa label chat list +15551234567 \
--session session_123

polymorfa label chat replace 15551234567@s.whatsapp.net \
polymorfa label chat replace +15551234567 \
--session session_123 \
--label priority \
--label customer
Expand Down Expand Up @@ -300,10 +302,10 @@ renew policy-governed chat observations:
polymorfa presence view --session session_123
polymorfa presence set --session session_123 --state available

polymorfa presence chat view 15551234567@s.whatsapp.net \
polymorfa presence chat view +15551234567 \
--session session_123

polymorfa presence chat subscribe 15551234567@s.whatsapp.net \
polymorfa presence chat subscribe +15551234567 \
--session session_123
```

Expand All @@ -325,24 +327,24 @@ Channels are connected-session resources and require a server API key:

```shell
polymorfa channel list --session session_123
polymorfa channel view 120363000000000000@newsletter --session session_123
polymorfa channel view 760000000001 --session session_123

polymorfa channel create \
--session session_123 \
--name 'Product updates' \
--description 'Release announcements'

polymorfa channel message list 120363000000000000@newsletter \
polymorfa channel message list 760000000001 \
--session session_123 \
--limit 25 \
--before 951

polymorfa channel message updates 120363000000000000@newsletter \
polymorfa channel message updates 760000000001 \
--session session_123 \
--since 1787212800

polymorfa channel live-updates subscribe \
120363000000000000@newsletter \
760000000001 \
--session session_123
```

Expand All @@ -353,6 +355,8 @@ does not start a listener, socket, or watch process, and the API exposes no
unsubscribe operation.

Message actions are `channel message mark-viewed` and `channel message react`.
Human output includes both the public message ID for actions and `position=N`
for the numeric `--before` and `--after` pagination arguments.
An empty reaction removes the caller's reaction. Channel-level actions are
`follow`, `unfollow`, `mute`, and `unmute`. Mutations accept
`--idempotency-key`, and deletion additionally requires `--yes`.
Expand All @@ -374,14 +378,14 @@ polymorfa contact check \
--phone +15551234567 \
--phone +15557654321

polymorfa contact view alice@lid --session session_123
polymorfa contact info alice@lid --session session_123
polymorfa contact picture alice@lid --session session_123
polymorfa contact devices alice@lid --session session_123
polymorfa contact business-profile alice@lid --session session_123
polymorfa contact view 750000000001 --session session_123
polymorfa contact info 750000000001 --session session_123
polymorfa contact picture 750000000001 --session session_123
polymorfa contact devices 750000000001 --session session_123
polymorfa contact business-profile 750000000001 --session session_123
polymorfa contact blocklist --session session_123
polymorfa contact block alice@lid --session session_123
polymorfa contact unblock alice@lid --session session_123
polymorfa contact block 750000000001 --session session_123
polymorfa contact unblock 750000000001 --session session_123
```

`contact view` reads contact data known to the connected session. `contact info`
Expand All @@ -403,32 +407,32 @@ source tags:
```shell
polymorfa call reject call_123 \
--session session_123 \
--from caller@lid \
--from 750000000001 \
--idempotency-key reject_call_123

polymorfa lid resolve \
polymorfa identity resolve \
--session session_123 \
--phone-number +15551234567

polymorfa lid resolve \
polymorfa identity resolve \
--session session_123 \
--username alice \
--username-key 1234

polymorfa user security-code 15551234567@lid --session session_123
polymorfa user security-code 750000000001 --session session_123
```

All three require a server API key and an active Linked Device session. Call
rejection requires the incoming call ID and caller JID; it is not call accept,
placement, history, or streaming. LID resolution accepts exactly one phone
number, stable `digits@lid` ID, deprecated `--lid` alias, or username. A username
rejection requires the incoming call ID and caller's Polymorfa ID; it is not call accept,
placement, history, or streaming. Identity resolution accepts exactly one phone
number, decimal Polymorfa user ID, or username. A username
key is exactly four digits and is valid only with `--username`.

Security-code lookup accepts only a stable `digits@lid` user ID. Human output
Security-code lookup accepts only a decimal Polymorfa user ID. Human output
shows the 60-digit numeric verification code and identity, but does not dump the
base64 display QR. `--json` preserves the complete response and no-store header
metadata. The private WhatsApp verification payload is never returned by the
API. The source exposes no bulk LID resolution, call list/history, security-code
API. The source exposes no bulk identity resolution, call list/history, security-code
history/refresh, or verification-submit operation.

## Business App
Expand All @@ -440,11 +444,11 @@ separate:

```shell
polymorfa business profile view --session session_123
polymorfa business catalog view --session session_123 --jid shop@lid
polymorfa business catalog view --session session_123 --id 750000000001
polymorfa business product view product_123 \
--session session_123 \
--jid shop@lid
polymorfa business collection list --session session_123 --jid shop@lid
--id 750000000001
polymorfa business collection list --session session_123 --id 750000000001
polymorfa business compliance view --session session_123
polymorfa business accounts view --session session_123
polymorfa business eligibility view --session session_123
Expand Down Expand Up @@ -506,7 +510,6 @@ polymorfa audit-log list --action key.revoked --resource api-key --limit 100
polymorfa session-ban list --active
polymorfa security-incident list
polymorfa security-incident acknowledge incident_123
polymorfa operation view operation_123
polymorfa project-token list --project project_123
polymorfa widget view --project project_123
polymorfa widget update --project project_123 --input widget-patch.json
Expand All @@ -523,8 +526,8 @@ this route. Security-incident acknowledgement is repeatable and sends no body.

Audit filters are exact matches, and `--limit` is bounded to 1 through 500.
These list operations return complete arrays and expose no cursor. Project-token
listing requires one explicit project ID. `operation view` is a single durable
state read; it does not wait, watch, stream, list, or cancel operations.
listing requires one explicit project ID. Operation inspection is console-only;
the CLI does not expose operation polling or cancellation.

Member invite, role update, and removal remain dashboard-session routes and are
not exposed through server-key commands. The API also exposes no compatible
Expand Down Expand Up @@ -571,11 +574,8 @@ polymorfa campaign requeue campaign_123 \
```

Launch, pause, resume, and stop return accepted durable work; they do not wait
for the state transition. Poll the returned operation explicitly:

```shell
polymorfa operation view operation_123 --surface messaging
```
for the state transition. Check the campaign with `polymorfa campaign view`.
Operation inspection is console-only; the CLI has no operation-polling command.

Launch times accept epoch milliseconds or timezone-qualified ISO 8601
instants. List returns one complete newest-first array with no cursor. Requeue
Expand Down
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"dependencies": {
"@napi-rs/keyring": "1.3.0",
"@oclif/core": "^4.13.5",
"@polymorfa/sdk": "github:polymorfa/sdks#bf5969e68eda2c0cf5541076bd2c55eb51f09f13"
"@polymorfa/sdk": "github:polymorfa/sdks#da65b22a8c4bf79aa378cf1848d2b7cc765ba326"
},
"devDependencies": {
"@eslint/js": "^9.39.5",
Expand Down Expand Up @@ -133,8 +133,8 @@
"label:chat": {
"description": "Manage the complete label set assigned to a chat."
},
"lid": {
"description": "Resolve WhatsApp identities to stable LIDs."
"identity": {
"description": "Resolve phone numbers and usernames to Polymorfa user IDs."
},
"message": {
"description": "Send messages and perform message actions."
Expand Down
2 changes: 1 addition & 1 deletion src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Command, Flags, type Interfaces} from '@oclif/core'
import {
PolymorfaConfigurationError,
type MessagingClient,
type PlatformClient,
type Client as PlatformClient,
} from '@polymorfa/sdk'

import {resolveCommandEnvironment} from './context/environment.js'
Expand Down
4 changes: 2 additions & 2 deletions src/commands/auth/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {createAuthService} from '../../config/auth-service.js'
import {
PolymorfaConfigurationError,
validateMessagingCredential,
validatePlatformApiKey,
validateOrganizationApiKey,
} from '@polymorfa/sdk'

export default class AuthStatus extends BaseCommand {
Expand Down Expand Up @@ -59,7 +59,7 @@ function environmentStatus(
)
}

if (apiKey !== undefined) validatePlatformApiKey(apiKey)
if (apiKey !== undefined) validateOrganizationApiKey(apiKey)
if (clientToken !== undefined) {
validateMessagingCredential({type: 'clientToken', value: clientToken})
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/business/catalog/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default class BusinessCatalogView extends BaseCommand {
max: 1024,
min: 1,
}),
jid: Flags.string({
description: 'Business account user or LID JID.',
id: Flags.string({
description: 'Polymorfa business user ID.',
required: true,
}),
limit: Flags.integer({
Expand All @@ -44,7 +44,7 @@ export default class BusinessCatalogView extends BaseCommand {
await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}),
flags.session,
{
jid: flags.jid,
id: flags.id,
...(flags.after === undefined ? {} : {after: flags.after}),
...(flags.limit === undefined ? {} : {limit: flags.limit}),
...(flags.width === undefined ? {} : {width: flags.width}),
Expand Down
6 changes: 3 additions & 3 deletions src/commands/business/collection/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default class BusinessCollectionList extends BaseCommand {
max: 100,
min: 1,
}),
jid: Flags.string({
description: 'Business account user or LID JID.',
id: Flags.string({
description: 'Polymorfa business user ID.',
required: true,
}),
session: Flags.string({
Expand All @@ -49,7 +49,7 @@ export default class BusinessCollectionList extends BaseCommand {
await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}),
flags.session,
{
jid: flags.jid,
id: flags.id,
...(flags.after === undefined ? {} : {after: flags.after}),
...(flags['collection-limit'] === undefined
? {}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/business/collection/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default class BusinessCollectionView extends BaseCommand {
max: 1024,
min: 1,
}),
jid: Flags.string({
description: 'Business account user or LID JID.',
id: Flags.string({
description: 'Polymorfa business user ID.',
required: true,
}),
limit: Flags.integer({
Expand All @@ -53,7 +53,7 @@ export default class BusinessCollectionView extends BaseCommand {
flags.session,
args.collection,
{
jid: flags.jid,
id: flags.id,
...(flags.after === undefined ? {} : {after: flags.after}),
...(flags.limit === undefined ? {} : {limit: flags.limit}),
...(flags.width === undefined ? {} : {width: flags.width}),
Expand Down
6 changes: 3 additions & 3 deletions src/commands/business/product/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default class BusinessProductView extends BaseCommand {
static override description = 'View one business product.'

static override flags = {
jid: Flags.string({
description: 'Business account user or LID JID.',
id: Flags.string({
description: 'Polymorfa business user ID.',
required: true,
}),
session: Flags.string({
Expand All @@ -30,7 +30,7 @@ export default class BusinessProductView extends BaseCommand {
await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}),
flags.session,
args.product,
{jid: flags.jid},
{id: flags.id},
)
this.writeValue(result, renderBusinessProduct(result.data), flags)
}
Expand Down
5 changes: 4 additions & 1 deletion src/commands/call/reject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export default class CallReject extends BaseCommand {
static override description = 'Reject an incoming Linked Device call.'

static override flags = {
from: Flags.string({description: 'Incoming caller JID.', required: true}),
from: Flags.string({
description: 'Incoming caller Polymorfa ID.',
required: true,
}),
'idempotency-key': Flags.string({
description: 'Safely identify retries of this call rejection.',
}),
Expand Down
Loading