@wats/types 0.3.13 → 0.3.15

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 CHANGED
@@ -10,6 +10,113 @@ export type GroupJoinApprovalMode = "auto_approve" | "approval_required";
10
10
  * group send the `to` value is the opaque group id, not a phone number.
11
11
  */
12
12
  export type GroupRecipientType = "individual" | "group";
13
+ export interface WhatsAppMessageRecipient {
14
+ recipientType: GroupRecipientType;
15
+ to: string;
16
+ }
17
+ export type GroupWebhookField = "group_lifecycle_update" | "group_participants_update" | "group_settings_update" | "group_status_update";
18
+ export type GroupLifecycleUpdateType = "group_create" | "group_delete";
19
+ export type GroupParticipantsUpdateType = "group_participants_add" | "group_join_request_created" | "group_join_request_revoked" | "group_participants_remove";
20
+ export type GroupSettingsUpdateType = "group_settings_update";
21
+ export type GroupStatusUpdateType = "group_suspend" | "group_suspend_cleared";
22
+ export interface GroupWebhookWireMetadata {
23
+ display_phone_number: string;
24
+ phone_number_id: string;
25
+ }
26
+ export interface GroupWebhookWireError {
27
+ code: number;
28
+ message: string;
29
+ title: string;
30
+ error_data?: {
31
+ details?: string;
32
+ };
33
+ href?: string;
34
+ }
35
+ export interface GroupWireParticipant {
36
+ wa_id: string;
37
+ }
38
+ export interface GroupWireInputParticipant {
39
+ input: string;
40
+ }
41
+ export type GroupWireParticipantRef = GroupWireParticipant | GroupWireInputParticipant;
42
+ export interface GroupLifecycleUpdateWireGroup {
43
+ timestamp: string;
44
+ group_id: string;
45
+ type: GroupLifecycleUpdateType;
46
+ request_id?: string;
47
+ subject?: string;
48
+ description?: string;
49
+ invite_link?: string;
50
+ join_approval_mode?: GroupJoinApprovalMode;
51
+ errors?: readonly GroupWebhookWireError[];
52
+ }
53
+ export interface GroupLifecycleUpdateWireValue {
54
+ messaging_product: "whatsapp";
55
+ metadata: GroupWebhookWireMetadata;
56
+ groups: readonly GroupLifecycleUpdateWireGroup[];
57
+ }
58
+ export type GroupLifecycleUpdateWebhookValue = WhatsAppGroupLifecycleUpdateValue;
59
+ export interface GroupFailedWireParticipant {
60
+ wa_id?: string;
61
+ input?: string;
62
+ errors?: readonly GroupWebhookWireError[];
63
+ }
64
+ export interface GroupParticipantsUpdateWireGroup {
65
+ timestamp: string;
66
+ group_id: string;
67
+ type: GroupParticipantsUpdateType;
68
+ request_id?: string;
69
+ reason?: string;
70
+ added_participants?: readonly GroupWireParticipant[];
71
+ removed_participants?: readonly GroupWireParticipantRef[];
72
+ failed_participants?: readonly GroupFailedWireParticipant[];
73
+ initiated_by?: string;
74
+ join_request_id?: string;
75
+ wa_id?: string;
76
+ errors?: readonly GroupWebhookWireError[];
77
+ }
78
+ export interface GroupParticipantsUpdateWireValue {
79
+ messaging_product: "whatsapp";
80
+ metadata: GroupWebhookWireMetadata;
81
+ groups: readonly GroupParticipantsUpdateWireGroup[];
82
+ }
83
+ export type GroupParticipantsUpdateWebhookValue = WhatsAppGroupParticipantsUpdateValue;
84
+ export interface GroupSettingsUpdateWireResult {
85
+ update_successful: boolean;
86
+ text?: string;
87
+ mime_type?: string;
88
+ sha256?: string;
89
+ errors?: readonly GroupWebhookWireError[];
90
+ }
91
+ export interface GroupSettingsUpdateWireGroup {
92
+ timestamp: string;
93
+ group_id: string;
94
+ type: GroupSettingsUpdateType;
95
+ request_id?: string;
96
+ profile_picture?: GroupSettingsUpdateWireResult;
97
+ group_subject?: GroupSettingsUpdateWireResult;
98
+ group_description?: GroupSettingsUpdateWireResult;
99
+ errors?: readonly GroupWebhookWireError[];
100
+ }
101
+ export interface GroupSettingsUpdateWireValue {
102
+ messaging_product: "whatsapp";
103
+ metadata: GroupWebhookWireMetadata;
104
+ groups: readonly GroupSettingsUpdateWireGroup[];
105
+ }
106
+ export type GroupSettingsUpdateWebhookValue = WhatsAppGroupSettingsUpdateValue;
107
+ export interface GroupStatusUpdateWireGroup {
108
+ timestamp: string;
109
+ group_id: string;
110
+ type: GroupStatusUpdateType;
111
+ request_id?: string;
112
+ errors?: readonly GroupWebhookWireError[];
113
+ }
114
+ export interface GroupStatusUpdateWireValue {
115
+ messaging_product: "whatsapp";
116
+ metadata: GroupWebhookWireMetadata;
117
+ groups: readonly GroupStatusUpdateWireGroup[];
118
+ }
119
+ export type GroupStatusUpdateWebhookValue = WhatsAppGroupStatusUpdateValue;
13
120
  /** A single group participant, identified by WhatsApp id (wa_id). */
14
121
  export interface GroupParticipant {
15
122
  /** WhatsApp id of the participant (wire: `wa_id`). */
@@ -63,11 +170,12 @@ export interface WhatsAppGroupLifecycleUpdateValue {
63
170
  phoneNumberId: string;
64
171
  };
65
172
  /** Lifecycle event type (wire: `type`), e.g. `group_create`, group delete. */
66
- type: string;
173
+ type: GroupLifecycleUpdateType;
67
174
  /** Correlates an async outcome to the originating request (wire: `request_id`). */
68
175
  requestId?: string;
69
176
  groupId?: string;
70
177
  subject?: string;
178
+ description?: string;
71
179
  inviteLink?: string;
72
180
  joinApprovalMode?: GroupJoinApprovalMode;
73
181
  /** Present on a failed lifecycle operation. */
@@ -91,7 +199,7 @@ export interface WhatsAppGroupParticipantsUpdateValue {
91
199
  * `group_join_request_created`, `group_join_request_revoked`,
92
200
  * `group_participants_remove`.
93
201
  */
94
- type: string;
202
+ type: GroupParticipantsUpdateType;
95
203
  /** e.g. `invite_link` for adds (wire: `reason`). */
96
204
  reason?: string;
97
205
  /** Who initiated a removal (wire: `initiated_by`), e.g. `business`. */
@@ -106,6 +214,7 @@ export interface WhatsAppGroupParticipantsUpdateValue {
106
214
  }[];
107
215
  failedParticipants?: {
108
216
  input?: string;
217
+ waId?: string;
109
218
  errors?: unknown[];
110
219
  }[];
111
220
  errors?: unknown[];
@@ -122,7 +231,7 @@ export interface WhatsAppGroupSettingsUpdateValue {
122
231
  phoneNumberId: string;
123
232
  };
124
233
  groupId: string;
125
- type: string;
234
+ type: GroupSettingsUpdateType;
126
235
  groupSubject?: {
127
236
  text?: string;
128
237
  updateSuccessful: boolean;
@@ -137,6 +246,7 @@ export interface WhatsAppGroupSettingsUpdateValue {
137
246
  mimeType?: string;
138
247
  sha256?: string;
139
248
  updateSuccessful: boolean;
249
+ errors?: unknown[];
140
250
  };
141
251
  errors?: unknown[];
142
252
  raw?: unknown;
@@ -153,7 +263,7 @@ export interface WhatsAppGroupStatusUpdateValue {
153
263
  };
154
264
  groupId: string;
155
265
  /** Status event type (wire: `type`): `group_suspend`, `group_suspend_cleared`. */
156
- type: string;
266
+ type: GroupStatusUpdateType;
157
267
  raw?: unknown;
158
268
  }
159
269
  /**
@@ -161,4 +271,4 @@ export interface WhatsAppGroupStatusUpdateValue {
161
271
  * other `WATS_TYPES_*_EXPORTS` contract arrays so external consumers can
162
272
  * assert the documented surface without reaching into the module.
163
273
  */
164
- export declare const WATS_TYPES_GROUPS_EXPORTS: readonly ["WatsGroup", "GroupParticipant", "GroupJoinRequest", "GroupInviteLink", "GroupJoinApprovalMode", "GroupRecipientType", "WhatsAppGroupLifecycleUpdateValue", "WhatsAppGroupParticipantsUpdateValue", "WhatsAppGroupSettingsUpdateValue", "WhatsAppGroupStatusUpdateValue"];
274
+ export declare const WATS_TYPES_GROUPS_EXPORTS: readonly ["WatsGroup", "GroupParticipant", "GroupJoinRequest", "GroupInviteLink", "GroupJoinApprovalMode", "GroupRecipientType", "WhatsAppMessageRecipient", "GroupWebhookField", "GroupLifecycleUpdateType", "GroupParticipantsUpdateType", "GroupSettingsUpdateType", "GroupStatusUpdateType", "GroupLifecycleUpdateWireValue", "GroupLifecycleUpdateWebhookValue", "GroupParticipantsUpdateWireValue", "GroupParticipantsUpdateWebhookValue", "GroupSettingsUpdateWireValue", "GroupSettingsUpdateWebhookValue", "GroupStatusUpdateWireValue", "GroupStatusUpdateWebhookValue", "WhatsAppGroupLifecycleUpdateValue", "WhatsAppGroupParticipantsUpdateValue", "WhatsAppGroupSettingsUpdateValue", "WhatsAppGroupStatusUpdateValue"];
package/dist/groups.js CHANGED
@@ -5,6 +5,20 @@ export const WATS_TYPES_GROUPS_EXPORTS = [
5
5
  "GroupInviteLink",
6
6
  "GroupJoinApprovalMode",
7
7
  "GroupRecipientType",
8
+ "WhatsAppMessageRecipient",
9
+ "GroupWebhookField",
10
+ "GroupLifecycleUpdateType",
11
+ "GroupParticipantsUpdateType",
12
+ "GroupSettingsUpdateType",
13
+ "GroupStatusUpdateType",
14
+ "GroupLifecycleUpdateWireValue",
15
+ "GroupLifecycleUpdateWebhookValue",
16
+ "GroupParticipantsUpdateWireValue",
17
+ "GroupParticipantsUpdateWebhookValue",
18
+ "GroupSettingsUpdateWireValue",
19
+ "GroupSettingsUpdateWebhookValue",
20
+ "GroupStatusUpdateWireValue",
21
+ "GroupStatusUpdateWebhookValue",
8
22
  "WhatsAppGroupLifecycleUpdateValue",
9
23
  "WhatsAppGroupParticipantsUpdateValue",
10
24
  "WhatsAppGroupSettingsUpdateValue",
package/dist/index.d.ts CHANGED
@@ -7,6 +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";
10
+ export type { WatsGroup, GroupParticipant, GroupJoinRequest, GroupInviteLink, GroupJoinApprovalMode, GroupRecipientType, WhatsAppMessageRecipient, GroupWebhookField, GroupLifecycleUpdateType, GroupLifecycleUpdateWireValue, GroupLifecycleUpdateWebhookValue, GroupParticipantsUpdateType, GroupParticipantsUpdateWireValue, GroupParticipantsUpdateWebhookValue, GroupSettingsUpdateType, GroupSettingsUpdateWireValue, GroupSettingsUpdateWebhookValue, GroupStatusUpdateType, GroupStatusUpdateWireValue, GroupStatusUpdateWebhookValue, WhatsAppGroupLifecycleUpdateValue, WhatsAppGroupParticipantsUpdateValue, WhatsAppGroupSettingsUpdateValue, WhatsAppGroupStatusUpdateValue } from "./groups.js";
11
11
  export { WATS_TYPES_GROUPS_EXPORTS } from "./groups.js";
12
12
  export type { WhatsAppMessagesFieldValue, WhatsAppAccountUpdateValue, WhatsAppTemplateStatusUpdateValue, WhatsAppAccountReviewUpdateValue, WhatsAppUserMarketingPreferencesValue, WhatsAppPhoneNumberChangeValue, WhatsAppIdentityChangeValue, WhatsAppRawWebhookValue } from "./webhook.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wats/types",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",