@wats/types 0.3.12 → 0.3.13
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/dist/groups.d.ts +164 -0
- package/dist/groups.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
package/dist/groups.d.ts
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Group join-approval policy. `auto_approve` (default on the wire) lets
|
|
3
|
+
* anyone with the invite link join immediately; `approval_required`
|
|
4
|
+
* routes joins through the join-request approval queue.
|
|
5
|
+
*/
|
|
6
|
+
export type GroupJoinApprovalMode = "auto_approve" | "approval_required";
|
|
7
|
+
/**
|
|
8
|
+
* Message recipient addressing dimension. The Cloud API Messages
|
|
9
|
+
* endpoint accepts `recipient_type: "individual" | "group"`; for a
|
|
10
|
+
* group send the `to` value is the opaque group id, not a phone number.
|
|
11
|
+
*/
|
|
12
|
+
export type GroupRecipientType = "individual" | "group";
|
|
13
|
+
/** A single group participant, identified by WhatsApp id (wa_id). */
|
|
14
|
+
export interface GroupParticipant {
|
|
15
|
+
/** WhatsApp id of the participant (wire: `wa_id`). */
|
|
16
|
+
waId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Group metadata as returned by `GET /<group-id>`. The business creator
|
|
20
|
+
* is the sole admin and is excluded from `totalParticipantCount`.
|
|
21
|
+
*/
|
|
22
|
+
export interface WatsGroup {
|
|
23
|
+
/** Opaque group id (wire: `id`). */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Group subject/name (wire: `subject`), max 128 chars. */
|
|
26
|
+
subject: string;
|
|
27
|
+
/** Optional group description (wire: `description`), max 2048 chars. */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Join-approval policy (wire: `join_approval_mode`). */
|
|
30
|
+
joinApprovalMode: GroupJoinApprovalMode;
|
|
31
|
+
/** Whether the group is suspended by moderation (wire: `suspended`). */
|
|
32
|
+
suspended: boolean;
|
|
33
|
+
/** UNIX creation timestamp (wire: `creation_timestamp`). */
|
|
34
|
+
creationTimestamp: number;
|
|
35
|
+
/** Participant count excluding the business (wire: `total_participant_count`). */
|
|
36
|
+
totalParticipantCount: number;
|
|
37
|
+
/** Current participants (wire: `participants`), excluding the business. */
|
|
38
|
+
participants: GroupParticipant[];
|
|
39
|
+
}
|
|
40
|
+
/** A pending group join request (wire under `GET /<group-id>/join_requests`). */
|
|
41
|
+
export interface GroupJoinRequest {
|
|
42
|
+
/** Opaque join-request id (wire: `join_request_id`). */
|
|
43
|
+
joinRequestId: string;
|
|
44
|
+
/** WhatsApp id of the requester (wire: `wa_id`). */
|
|
45
|
+
waId: string;
|
|
46
|
+
/** UNIX request creation timestamp (wire: `creation_timestamp`). */
|
|
47
|
+
creationTimestamp: number;
|
|
48
|
+
}
|
|
49
|
+
/** Group invite link (wire under `GET|POST /<group-id>/invite_link`). */
|
|
50
|
+
export interface GroupInviteLink {
|
|
51
|
+
/** Invite URL, always prefixed `https://chat.whatsapp.com/` (wire: `invite_link`). */
|
|
52
|
+
inviteLink: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `group_lifecycle_update` webhook value — group create/delete outcomes.
|
|
56
|
+
* On a successful create, `groupId` and `inviteLink` are delivered here
|
|
57
|
+
* (the create HTTP call does NOT return them synchronously).
|
|
58
|
+
*/
|
|
59
|
+
export interface WhatsAppGroupLifecycleUpdateValue {
|
|
60
|
+
messagingProduct: "whatsapp";
|
|
61
|
+
metadata: {
|
|
62
|
+
displayPhoneNumber: string;
|
|
63
|
+
phoneNumberId: string;
|
|
64
|
+
};
|
|
65
|
+
/** Lifecycle event type (wire: `type`), e.g. `group_create`, group delete. */
|
|
66
|
+
type: string;
|
|
67
|
+
/** Correlates an async outcome to the originating request (wire: `request_id`). */
|
|
68
|
+
requestId?: string;
|
|
69
|
+
groupId?: string;
|
|
70
|
+
subject?: string;
|
|
71
|
+
inviteLink?: string;
|
|
72
|
+
joinApprovalMode?: GroupJoinApprovalMode;
|
|
73
|
+
/** Present on a failed lifecycle operation. */
|
|
74
|
+
errors?: unknown[];
|
|
75
|
+
raw?: unknown;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `group_participants_update` webhook value — add (via invite link),
|
|
79
|
+
* join-request created/revoked, and remove (including a participant
|
|
80
|
+
* leaving, surfaced as a remove initiated by that user).
|
|
81
|
+
*/
|
|
82
|
+
export interface WhatsAppGroupParticipantsUpdateValue {
|
|
83
|
+
messagingProduct: "whatsapp";
|
|
84
|
+
metadata: {
|
|
85
|
+
displayPhoneNumber: string;
|
|
86
|
+
phoneNumberId: string;
|
|
87
|
+
};
|
|
88
|
+
groupId: string;
|
|
89
|
+
/**
|
|
90
|
+
* Event type (wire: `type`): `group_participants_add`,
|
|
91
|
+
* `group_join_request_created`, `group_join_request_revoked`,
|
|
92
|
+
* `group_participants_remove`.
|
|
93
|
+
*/
|
|
94
|
+
type: string;
|
|
95
|
+
/** e.g. `invite_link` for adds (wire: `reason`). */
|
|
96
|
+
reason?: string;
|
|
97
|
+
/** Who initiated a removal (wire: `initiated_by`), e.g. `business`. */
|
|
98
|
+
initiatedBy?: string;
|
|
99
|
+
requestId?: string;
|
|
100
|
+
joinRequestId?: string;
|
|
101
|
+
waId?: string;
|
|
102
|
+
addedParticipants?: GroupParticipant[];
|
|
103
|
+
removedParticipants?: {
|
|
104
|
+
input?: string;
|
|
105
|
+
waId?: string;
|
|
106
|
+
}[];
|
|
107
|
+
failedParticipants?: {
|
|
108
|
+
input?: string;
|
|
109
|
+
errors?: unknown[];
|
|
110
|
+
}[];
|
|
111
|
+
errors?: unknown[];
|
|
112
|
+
raw?: unknown;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* `group_settings_update` webhook value — per-field success/failure for
|
|
116
|
+
* subject, description, and profile photo updates.
|
|
117
|
+
*/
|
|
118
|
+
export interface WhatsAppGroupSettingsUpdateValue {
|
|
119
|
+
messagingProduct: "whatsapp";
|
|
120
|
+
metadata: {
|
|
121
|
+
displayPhoneNumber: string;
|
|
122
|
+
phoneNumberId: string;
|
|
123
|
+
};
|
|
124
|
+
groupId: string;
|
|
125
|
+
type: string;
|
|
126
|
+
groupSubject?: {
|
|
127
|
+
text?: string;
|
|
128
|
+
updateSuccessful: boolean;
|
|
129
|
+
errors?: unknown[];
|
|
130
|
+
};
|
|
131
|
+
groupDescription?: {
|
|
132
|
+
text?: string;
|
|
133
|
+
updateSuccessful: boolean;
|
|
134
|
+
errors?: unknown[];
|
|
135
|
+
};
|
|
136
|
+
profilePicture?: {
|
|
137
|
+
mimeType?: string;
|
|
138
|
+
sha256?: string;
|
|
139
|
+
updateSuccessful: boolean;
|
|
140
|
+
};
|
|
141
|
+
errors?: unknown[];
|
|
142
|
+
raw?: unknown;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* `group_status_update` webhook value — moderation lifecycle, e.g.
|
|
146
|
+
* `group_suspend` / `group_suspend_cleared`.
|
|
147
|
+
*/
|
|
148
|
+
export interface WhatsAppGroupStatusUpdateValue {
|
|
149
|
+
messagingProduct: "whatsapp";
|
|
150
|
+
metadata: {
|
|
151
|
+
displayPhoneNumber: string;
|
|
152
|
+
phoneNumberId: string;
|
|
153
|
+
};
|
|
154
|
+
groupId: string;
|
|
155
|
+
/** Status event type (wire: `type`): `group_suspend`, `group_suspend_cleared`. */
|
|
156
|
+
type: string;
|
|
157
|
+
raw?: unknown;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Documentation manifest of the public Groups type surface. Mirrors the
|
|
161
|
+
* other `WATS_TYPES_*_EXPORTS` contract arrays so external consumers can
|
|
162
|
+
* assert the documented surface without reaching into the module.
|
|
163
|
+
*/
|
|
164
|
+
export declare const WATS_TYPES_GROUPS_EXPORTS: readonly ["WatsGroup", "GroupParticipant", "GroupJoinRequest", "GroupInviteLink", "GroupJoinApprovalMode", "GroupRecipientType", "WhatsAppGroupLifecycleUpdateValue", "WhatsAppGroupParticipantsUpdateValue", "WhatsAppGroupSettingsUpdateValue", "WhatsAppGroupStatusUpdateValue"];
|
package/dist/groups.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const WATS_TYPES_GROUPS_EXPORTS = [
|
|
2
|
+
"WatsGroup",
|
|
3
|
+
"GroupParticipant",
|
|
4
|
+
"GroupJoinRequest",
|
|
5
|
+
"GroupInviteLink",
|
|
6
|
+
"GroupJoinApprovalMode",
|
|
7
|
+
"GroupRecipientType",
|
|
8
|
+
"WhatsAppGroupLifecycleUpdateValue",
|
|
9
|
+
"WhatsAppGroupParticipantsUpdateValue",
|
|
10
|
+
"WhatsAppGroupSettingsUpdateValue",
|
|
11
|
+
"WhatsAppGroupStatusUpdateValue"
|
|
12
|
+
];
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages/index.js";
|
|
|
7
7
|
export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses.js";
|
|
8
8
|
export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts.js";
|
|
9
9
|
export { WATS_TYPES_ERRORS_EXPORTS } from "./errors.js";
|
|
10
|
+
export type { WatsGroup, GroupParticipant, GroupJoinRequest, GroupInviteLink, GroupJoinApprovalMode, GroupRecipientType, WhatsAppGroupLifecycleUpdateValue, WhatsAppGroupParticipantsUpdateValue, WhatsAppGroupSettingsUpdateValue, WhatsAppGroupStatusUpdateValue } from "./groups.js";
|
|
11
|
+
export { WATS_TYPES_GROUPS_EXPORTS } from "./groups.js";
|
|
10
12
|
export type { WhatsAppMessagesFieldValue, WhatsAppAccountUpdateValue, WhatsAppTemplateStatusUpdateValue, WhatsAppAccountReviewUpdateValue, WhatsAppUserMarketingPreferencesValue, WhatsAppPhoneNumberChangeValue, WhatsAppIdentityChangeValue, WhatsAppRawWebhookValue } from "./webhook.js";
|
package/dist/index.js
CHANGED
|
@@ -5,3 +5,4 @@ export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages/index.js";
|
|
|
5
5
|
export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses.js";
|
|
6
6
|
export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts.js";
|
|
7
7
|
export { WATS_TYPES_ERRORS_EXPORTS } from "./errors.js";
|
|
8
|
+
export { WATS_TYPES_GROUPS_EXPORTS } from "./groups.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wats/types",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"./errors": {
|
|
39
39
|
"types": "./dist/errors.d.ts",
|
|
40
40
|
"import": "./dist/errors.js"
|
|
41
|
+
},
|
|
42
|
+
"./groups": {
|
|
43
|
+
"types": "./dist/groups.d.ts",
|
|
44
|
+
"import": "./dist/groups.js"
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
"files": [
|