meta-cloud-api 0.2.12 → 0.2.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/README.md +5 -2
- package/dist/api/index.d.mts +495 -27
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/chunk-KZQQJAPX.mjs +2 -0
- package/dist/chunk-KZQQJAPX.mjs.map +1 -0
- package/dist/chunk-N7A7DQDX.mjs +2 -0
- package/dist/chunk-N7A7DQDX.mjs.map +1 -0
- package/dist/chunk-QE4PKOSW.mjs +2 -0
- package/dist/chunk-QE4PKOSW.mjs.map +1 -0
- package/dist/chunk-R4CFE2XP.mjs +2 -0
- package/dist/chunk-R4CFE2XP.mjs.map +1 -0
- package/dist/chunk-XVYL7ZTG.mjs +2 -0
- package/dist/chunk-XVYL7ZTG.mjs.map +1 -0
- package/dist/index.d.mts +142 -43
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +512 -19
- package/dist/types/index.mjs +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/index.d.mts +70 -21
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/waba-RRlZTQUG.d.mts +2229 -0
- package/dist/{types/whatsapp.d.ts → whatsapp-BNHXjrds.d.mts} +2 -17
- package/package.json +52 -18
- package/dist/api/base.d.mts +0 -15
- package/dist/api/base.d.ts +0 -15
- package/dist/api/base.js +0 -2
- package/dist/api/base.js.map +0 -1
- package/dist/api/base.mjs +0 -2
- package/dist/api/base.mjs.map +0 -1
- package/dist/api/businessProfile.d.mts +0 -145
- package/dist/api/businessProfile.d.ts +0 -145
- package/dist/api/businessProfile.js +0 -2
- package/dist/api/businessProfile.js.map +0 -1
- package/dist/api/businessProfile.mjs +0 -2
- package/dist/api/businessProfile.mjs.map +0 -1
- package/dist/api/encryption.d.mts +0 -15
- package/dist/api/encryption.d.ts +0 -15
- package/dist/api/encryption.js +0 -2
- package/dist/api/encryption.js.map +0 -1
- package/dist/api/encryption.mjs +0 -2
- package/dist/api/encryption.mjs.map +0 -1
- package/dist/api/flow.d.mts +0 -126
- package/dist/api/flow.d.ts +0 -126
- package/dist/api/flow.js +0 -2
- package/dist/api/flow.js.map +0 -1
- package/dist/api/flow.mjs +0 -2
- package/dist/api/flow.mjs.map +0 -1
- package/dist/api/index.d.ts +0 -28
- package/dist/api/index.js +0 -2
- package/dist/api/index.js.map +0 -1
- package/dist/api/media.d.mts +0 -17
- package/dist/api/media.d.ts +0 -17
- package/dist/api/media.js +0 -2
- package/dist/api/media.js.map +0 -1
- package/dist/api/media.mjs +0 -2
- package/dist/api/media.mjs.map +0 -1
- package/dist/api/messages.d.mts +0 -193
- package/dist/api/messages.d.ts +0 -193
- package/dist/api/messages.js +0 -2
- package/dist/api/messages.js.map +0 -1
- package/dist/api/messages.mjs +0 -2
- package/dist/api/messages.mjs.map +0 -1
- package/dist/api/phoneNumber.d.mts +0 -17
- package/dist/api/phoneNumber.d.ts +0 -17
- package/dist/api/phoneNumber.js +0 -2
- package/dist/api/phoneNumber.js.map +0 -1
- package/dist/api/phoneNumber.mjs +0 -2
- package/dist/api/phoneNumber.mjs.map +0 -1
- package/dist/api/qrCode.d.mts +0 -18
- package/dist/api/qrCode.d.ts +0 -18
- package/dist/api/qrCode.js +0 -2
- package/dist/api/qrCode.js.map +0 -1
- package/dist/api/qrCode.mjs +0 -2
- package/dist/api/qrCode.mjs.map +0 -1
- package/dist/api/registration.d.mts +0 -14
- package/dist/api/registration.d.ts +0 -14
- package/dist/api/registration.js +0 -2
- package/dist/api/registration.js.map +0 -1
- package/dist/api/registration.mjs +0 -2
- package/dist/api/registration.mjs.map +0 -1
- package/dist/api/template.d.mts +0 -18
- package/dist/api/template.d.ts +0 -18
- package/dist/api/template.js +0 -2
- package/dist/api/template.js.map +0 -1
- package/dist/api/template.mjs +0 -2
- package/dist/api/template.mjs.map +0 -1
- package/dist/api/twoStepVerification.d.mts +0 -13
- package/dist/api/twoStepVerification.d.ts +0 -13
- package/dist/api/twoStepVerification.js +0 -2
- package/dist/api/twoStepVerification.js.map +0 -1
- package/dist/api/twoStepVerification.mjs +0 -2
- package/dist/api/twoStepVerification.mjs.map +0 -1
- package/dist/api/waba.d.mts +0 -16
- package/dist/api/waba.d.ts +0 -16
- package/dist/api/waba.js +0 -2
- package/dist/api/waba.js.map +0 -1
- package/dist/api/waba.mjs +0 -2
- package/dist/api/waba.mjs.map +0 -1
- package/dist/enums-CI7vzKhn.d.mts +0 -687
- package/dist/enums-CI7vzKhn.d.ts +0 -687
- package/dist/httpsClient.d.mts +0 -22
- package/dist/httpsClient.d.ts +0 -22
- package/dist/httpsClient.js +0 -2
- package/dist/httpsClient.js.map +0 -1
- package/dist/httpsClient.mjs +0 -2
- package/dist/httpsClient.mjs.map +0 -1
- package/dist/index.d.ts +0 -46
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/request.d.mts +0 -25
- package/dist/request.d.ts +0 -25
- package/dist/request.js +0 -2
- package/dist/request.js.map +0 -1
- package/dist/request.mjs +0 -2
- package/dist/request.mjs.map +0 -1
- package/dist/types/base.d.mts +0 -8
- package/dist/types/base.d.ts +0 -8
- package/dist/types/base.js +0 -2
- package/dist/types/base.js.map +0 -1
- package/dist/types/base.mjs +0 -1
- package/dist/types/base.mjs.map +0 -1
- package/dist/types/businessProfile.d.mts +0 -153
- package/dist/types/businessProfile.d.ts +0 -153
- package/dist/types/businessProfile.js +0 -2
- package/dist/types/businessProfile.js.map +0 -1
- package/dist/types/businessProfile.mjs +0 -1
- package/dist/types/businessProfile.mjs.map +0 -1
- package/dist/types/config.d.mts +0 -62
- package/dist/types/config.d.ts +0 -62
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
- package/dist/types/config.mjs +0 -1
- package/dist/types/config.mjs.map +0 -1
- package/dist/types/encryption.d.mts +0 -13
- package/dist/types/encryption.d.ts +0 -13
- package/dist/types/encryption.js +0 -2
- package/dist/types/encryption.js.map +0 -1
- package/dist/types/encryption.mjs +0 -1
- package/dist/types/encryption.mjs.map +0 -1
- package/dist/types/enums.d.mts +0 -1
- package/dist/types/enums.d.ts +0 -1
- package/dist/types/enums.js +0 -2
- package/dist/types/enums.js.map +0 -1
- package/dist/types/enums.mjs +0 -2
- package/dist/types/enums.mjs.map +0 -1
- package/dist/types/flow.d.mts +0 -404
- package/dist/types/flow.d.ts +0 -404
- package/dist/types/flow.js +0 -2
- package/dist/types/flow.js.map +0 -1
- package/dist/types/flow.mjs +0 -2
- package/dist/types/flow.mjs.map +0 -1
- package/dist/types/httpsClient.d.mts +0 -19
- package/dist/types/httpsClient.d.ts +0 -19
- package/dist/types/httpsClient.js +0 -2
- package/dist/types/httpsClient.js.map +0 -1
- package/dist/types/httpsClient.mjs +0 -1
- package/dist/types/httpsClient.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -20
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/logger.d.mts +0 -9
- package/dist/types/logger.d.ts +0 -9
- package/dist/types/logger.js +0 -2
- package/dist/types/logger.js.map +0 -1
- package/dist/types/logger.mjs +0 -1
- package/dist/types/logger.mjs.map +0 -1
- package/dist/types/media.d.mts +0 -31
- package/dist/types/media.d.ts +0 -31
- package/dist/types/media.js +0 -2
- package/dist/types/media.js.map +0 -1
- package/dist/types/media.mjs +0 -1
- package/dist/types/media.mjs.map +0 -1
- package/dist/types/messages.d.mts +0 -558
- package/dist/types/messages.d.ts +0 -558
- package/dist/types/messages.js +0 -2
- package/dist/types/messages.js.map +0 -1
- package/dist/types/messages.mjs +0 -1
- package/dist/types/messages.mjs.map +0 -1
- package/dist/types/phoneNumber.d.mts +0 -82
- package/dist/types/phoneNumber.d.ts +0 -82
- package/dist/types/phoneNumber.js +0 -2
- package/dist/types/phoneNumber.js.map +0 -1
- package/dist/types/phoneNumber.mjs +0 -1
- package/dist/types/phoneNumber.mjs.map +0 -1
- package/dist/types/qrCode.d.mts +0 -27
- package/dist/types/qrCode.d.ts +0 -27
- package/dist/types/qrCode.js +0 -2
- package/dist/types/qrCode.js.map +0 -1
- package/dist/types/qrCode.mjs +0 -1
- package/dist/types/qrCode.mjs.map +0 -1
- package/dist/types/registration.d.mts +0 -14
- package/dist/types/registration.d.ts +0 -14
- package/dist/types/registration.js +0 -2
- package/dist/types/registration.js.map +0 -1
- package/dist/types/registration.mjs +0 -1
- package/dist/types/registration.mjs.map +0 -1
- package/dist/types/request.d.mts +0 -50
- package/dist/types/request.d.ts +0 -50
- package/dist/types/request.js +0 -2
- package/dist/types/request.js.map +0 -1
- package/dist/types/request.mjs +0 -1
- package/dist/types/request.mjs.map +0 -1
- package/dist/types/template.d.mts +0 -106
- package/dist/types/template.d.ts +0 -106
- package/dist/types/template.js +0 -2
- package/dist/types/template.js.map +0 -1
- package/dist/types/template.mjs +0 -1
- package/dist/types/template.mjs.map +0 -1
- package/dist/types/twoStepVerification.d.mts +0 -11
- package/dist/types/twoStepVerification.d.ts +0 -11
- package/dist/types/twoStepVerification.js +0 -2
- package/dist/types/twoStepVerification.js.map +0 -1
- package/dist/types/twoStepVerification.mjs +0 -1
- package/dist/types/twoStepVerification.mjs.map +0 -1
- package/dist/types/waba.d.mts +0 -78
- package/dist/types/waba.d.ts +0 -78
- package/dist/types/waba.js +0 -2
- package/dist/types/waba.js.map +0 -1
- package/dist/types/waba.mjs +0 -2
- package/dist/types/waba.mjs.map +0 -1
- package/dist/types/webhook.d.mts +0 -486
- package/dist/types/webhook.d.ts +0 -486
- package/dist/types/webhook.js +0 -2
- package/dist/types/webhook.js.map +0 -1
- package/dist/types/webhook.mjs +0 -2
- package/dist/types/webhook.mjs.map +0 -1
- package/dist/types/whatsapp.d.mts +0 -61
- package/dist/types/whatsapp.js +0 -2
- package/dist/types/whatsapp.js.map +0 -1
- package/dist/types/whatsapp.mjs +0 -1
- package/dist/types/whatsapp.mjs.map +0 -1
- package/dist/utils/buildFieldsQueryString.d.mts +0 -3
- package/dist/utils/buildFieldsQueryString.d.ts +0 -3
- package/dist/utils/buildFieldsQueryString.js +0 -2
- package/dist/utils/buildFieldsQueryString.js.map +0 -1
- package/dist/utils/buildFieldsQueryString.mjs +0 -2
- package/dist/utils/buildFieldsQueryString.mjs.map +0 -1
- package/dist/utils/filters.d.mts +0 -144
- package/dist/utils/filters.d.ts +0 -144
- package/dist/utils/filters.js +0 -2
- package/dist/utils/filters.js.map +0 -1
- package/dist/utils/filters.mjs +0 -2
- package/dist/utils/filters.mjs.map +0 -1
- package/dist/utils/flowTypeGuards.d.mts +0 -46
- package/dist/utils/flowTypeGuards.d.ts +0 -46
- package/dist/utils/flowTypeGuards.js +0 -2
- package/dist/utils/flowTypeGuards.js.map +0 -1
- package/dist/utils/flowTypeGuards.mjs +0 -2
- package/dist/utils/flowTypeGuards.mjs.map +0 -1
- package/dist/utils/generateXHub256Sig.d.mts +0 -3
- package/dist/utils/generateXHub256Sig.d.ts +0 -3
- package/dist/utils/generateXHub256Sig.js +0 -2
- package/dist/utils/generateXHub256Sig.js.map +0 -1
- package/dist/utils/generateXHub256Sig.mjs +0 -2
- package/dist/utils/generateXHub256Sig.mjs.map +0 -1
- package/dist/utils/importConfig.d.mts +0 -21
- package/dist/utils/importConfig.d.ts +0 -21
- package/dist/utils/importConfig.js +0 -2
- package/dist/utils/importConfig.js.map +0 -1
- package/dist/utils/importConfig.mjs +0 -2
- package/dist/utils/importConfig.mjs.map +0 -1
- package/dist/utils/index.d.ts +0 -22
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/isMetaError.d.mts +0 -21
- package/dist/utils/isMetaError.d.ts +0 -21
- package/dist/utils/isMetaError.js +0 -2
- package/dist/utils/isMetaError.js.map +0 -1
- package/dist/utils/isMetaError.mjs +0 -2
- package/dist/utils/isMetaError.mjs.map +0 -1
- package/dist/utils/logger.d.mts +0 -13
- package/dist/utils/logger.d.ts +0 -13
- package/dist/utils/logger.js +0 -2
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/logger.mjs +0 -2
- package/dist/utils/logger.mjs.map +0 -1
- package/dist/utils/objectToQueryString.d.mts +0 -3
- package/dist/utils/objectToQueryString.d.ts +0 -3
- package/dist/utils/objectToQueryString.js +0 -2
- package/dist/utils/objectToQueryString.js.map +0 -1
- package/dist/utils/objectToQueryString.mjs +0 -2
- package/dist/utils/objectToQueryString.mjs.map +0 -1
- package/dist/webhook.d.mts +0 -123
- package/dist/webhook.d.ts +0 -123
- package/dist/webhook.js +0 -3
- package/dist/webhook.js.map +0 -1
- package/dist/webhook.mjs +0 -3
- package/dist/webhook.mjs.map +0 -1
- package/dist/whatsapp.d.mts +0 -58
- package/dist/whatsapp.d.ts +0 -58
- package/dist/whatsapp.js +0 -2
- package/dist/whatsapp.js.map +0 -1
- package/dist/whatsapp.mjs +0 -2
- package/dist/whatsapp.mjs.map +0 -1
package/dist/types/webhook.d.ts
DELETED
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
import { M as MessageTypesEnum } from '../enums-CI7vzKhn.js';
|
|
2
|
-
|
|
3
|
-
interface WebhookContact {
|
|
4
|
-
/**
|
|
5
|
-
* WhatsApp ID of the contact. Business can respond to this contact using this ID.
|
|
6
|
-
*/
|
|
7
|
-
wa_id: string;
|
|
8
|
-
/**
|
|
9
|
-
* Additional unique, alphanumeric identifier for a WhatsApp user
|
|
10
|
-
*/
|
|
11
|
-
user_id?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Profile of Whatsapp user
|
|
14
|
-
*/
|
|
15
|
-
profile: {
|
|
16
|
-
/**
|
|
17
|
-
* The display name of the contact
|
|
18
|
-
*/
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Represents a message received through the webhook
|
|
24
|
-
* Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
|
|
25
|
-
*/
|
|
26
|
-
interface WebhookMessage {
|
|
27
|
-
/**
|
|
28
|
-
* The message ID
|
|
29
|
-
*/
|
|
30
|
-
id: string;
|
|
31
|
-
/**
|
|
32
|
-
* The sender's phone number
|
|
33
|
-
*/
|
|
34
|
-
from: string;
|
|
35
|
-
/**
|
|
36
|
-
* The timestamp of the message
|
|
37
|
-
*/
|
|
38
|
-
timestamp: string;
|
|
39
|
-
/**
|
|
40
|
-
* The type of message (text, image, etc.)
|
|
41
|
-
*/
|
|
42
|
-
type: MessageTypesEnum;
|
|
43
|
-
/**
|
|
44
|
-
* The phone number ID that received the message
|
|
45
|
-
*/
|
|
46
|
-
phoneNumberId: string;
|
|
47
|
-
/**
|
|
48
|
-
* The display phone number that received the message
|
|
49
|
-
*/
|
|
50
|
-
displayPhoneNumber: string;
|
|
51
|
-
/**
|
|
52
|
-
* The profile name of the sender
|
|
53
|
-
*/
|
|
54
|
-
profileName: string;
|
|
55
|
-
/**
|
|
56
|
-
* Text object for text messages
|
|
57
|
-
*/
|
|
58
|
-
text?: {
|
|
59
|
-
/**
|
|
60
|
-
* The text content of the message
|
|
61
|
-
*/
|
|
62
|
-
body: string;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Image object for image messages
|
|
66
|
-
*/
|
|
67
|
-
image?: {
|
|
68
|
-
/**
|
|
69
|
-
* The image caption (if provided)
|
|
70
|
-
*/
|
|
71
|
-
caption?: string;
|
|
72
|
-
/**
|
|
73
|
-
* The SHA256 hash of the image
|
|
74
|
-
*/
|
|
75
|
-
sha256?: string;
|
|
76
|
-
/**
|
|
77
|
-
* The ID for the image
|
|
78
|
-
*/
|
|
79
|
-
id: string;
|
|
80
|
-
/**
|
|
81
|
-
* The MIME type of the image
|
|
82
|
-
*/
|
|
83
|
-
mime_type: string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Video object for video messages
|
|
87
|
-
*/
|
|
88
|
-
video?: {
|
|
89
|
-
/**
|
|
90
|
-
* The video caption (if provided)
|
|
91
|
-
*/
|
|
92
|
-
caption?: string;
|
|
93
|
-
/**
|
|
94
|
-
* The SHA256 hash of the video
|
|
95
|
-
*/
|
|
96
|
-
sha256?: string;
|
|
97
|
-
/**
|
|
98
|
-
* The ID for the video
|
|
99
|
-
*/
|
|
100
|
-
id: string;
|
|
101
|
-
/**
|
|
102
|
-
* The MIME type of the video
|
|
103
|
-
*/
|
|
104
|
-
mime_type: string;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Audio object for audio messages
|
|
108
|
-
*/
|
|
109
|
-
audio?: {
|
|
110
|
-
/**
|
|
111
|
-
* The ID for the audio file
|
|
112
|
-
*/
|
|
113
|
-
id: string;
|
|
114
|
-
/**
|
|
115
|
-
* The MIME type of the audio file
|
|
116
|
-
*/
|
|
117
|
-
mime_type: string;
|
|
118
|
-
/**
|
|
119
|
-
* Whether the audio is a voice message
|
|
120
|
-
*/
|
|
121
|
-
voice?: boolean;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Document object for document messages
|
|
125
|
-
*/
|
|
126
|
-
document?: {
|
|
127
|
-
/**
|
|
128
|
-
* The document caption (if provided)
|
|
129
|
-
*/
|
|
130
|
-
caption?: string;
|
|
131
|
-
/**
|
|
132
|
-
* The document filename
|
|
133
|
-
*/
|
|
134
|
-
filename: string;
|
|
135
|
-
/**
|
|
136
|
-
* The SHA256 hash of the document
|
|
137
|
-
*/
|
|
138
|
-
sha256?: string;
|
|
139
|
-
/**
|
|
140
|
-
* The ID for the document
|
|
141
|
-
*/
|
|
142
|
-
id: string;
|
|
143
|
-
/**
|
|
144
|
-
* The MIME type of the document
|
|
145
|
-
*/
|
|
146
|
-
mime_type: string;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Sticker object for sticker messages
|
|
150
|
-
*/
|
|
151
|
-
sticker?: {
|
|
152
|
-
/**
|
|
153
|
-
* The ID for the sticker
|
|
154
|
-
*/
|
|
155
|
-
id: string;
|
|
156
|
-
/**
|
|
157
|
-
* Whether this is an animated sticker
|
|
158
|
-
*/
|
|
159
|
-
animated: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* The MIME type of the sticker
|
|
162
|
-
*/
|
|
163
|
-
mime_type: string;
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Reaction object for reaction messages
|
|
167
|
-
*/
|
|
168
|
-
reaction?: {
|
|
169
|
-
/**
|
|
170
|
-
* The ID of the message being reacted to
|
|
171
|
-
*/
|
|
172
|
-
message_id: string;
|
|
173
|
-
/**
|
|
174
|
-
* Emoji used for the reaction
|
|
175
|
-
*/
|
|
176
|
-
emoji: string;
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Contacts object for contact messages
|
|
180
|
-
*/
|
|
181
|
-
contacts?: Array<{
|
|
182
|
-
/**
|
|
183
|
-
* The contact's name
|
|
184
|
-
*/
|
|
185
|
-
name: {
|
|
186
|
-
formatted_name: string;
|
|
187
|
-
first_name?: string;
|
|
188
|
-
last_name?: string;
|
|
189
|
-
middle_name?: string;
|
|
190
|
-
suffix?: string;
|
|
191
|
-
prefix?: string;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* The contact's phone numbers
|
|
195
|
-
*/
|
|
196
|
-
phones?: Array<{
|
|
197
|
-
phone: string;
|
|
198
|
-
type?: string;
|
|
199
|
-
wa_id?: string;
|
|
200
|
-
}>;
|
|
201
|
-
/**
|
|
202
|
-
* The contact's emails
|
|
203
|
-
*/
|
|
204
|
-
emails?: Array<{
|
|
205
|
-
email: string;
|
|
206
|
-
type?: string;
|
|
207
|
-
}>;
|
|
208
|
-
/**
|
|
209
|
-
* The contact's addresses
|
|
210
|
-
*/
|
|
211
|
-
addresses?: Array<{
|
|
212
|
-
street?: string;
|
|
213
|
-
city?: string;
|
|
214
|
-
state?: string;
|
|
215
|
-
zip?: string;
|
|
216
|
-
country?: string;
|
|
217
|
-
country_code?: string;
|
|
218
|
-
type?: string;
|
|
219
|
-
}>;
|
|
220
|
-
/**
|
|
221
|
-
* The contact's organizations
|
|
222
|
-
*/
|
|
223
|
-
org?: {
|
|
224
|
-
company?: string;
|
|
225
|
-
department?: string;
|
|
226
|
-
title?: string;
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* The contact's URLs
|
|
230
|
-
*/
|
|
231
|
-
urls?: Array<{
|
|
232
|
-
url: string;
|
|
233
|
-
type?: string;
|
|
234
|
-
}>;
|
|
235
|
-
/**
|
|
236
|
-
* The contact's birthday (YYYY-MM-DD format)
|
|
237
|
-
*/
|
|
238
|
-
birthday?: string;
|
|
239
|
-
}>;
|
|
240
|
-
/**
|
|
241
|
-
* Location object for location messages
|
|
242
|
-
*/
|
|
243
|
-
location?: {
|
|
244
|
-
/**
|
|
245
|
-
* Latitude of the location
|
|
246
|
-
*/
|
|
247
|
-
latitude: number;
|
|
248
|
-
/**
|
|
249
|
-
* Longitude of the location
|
|
250
|
-
*/
|
|
251
|
-
longitude: number;
|
|
252
|
-
/**
|
|
253
|
-
* Name of the location
|
|
254
|
-
*/
|
|
255
|
-
name?: string;
|
|
256
|
-
/**
|
|
257
|
-
* Address of the location
|
|
258
|
-
*/
|
|
259
|
-
address?: string;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Interactive object for interactive messages
|
|
263
|
-
*/
|
|
264
|
-
interactive?: {
|
|
265
|
-
/**
|
|
266
|
-
* Type of the interactive message
|
|
267
|
-
* Can be: button_reply, list_reply, flow, nfm_reply, etc.
|
|
268
|
-
*/
|
|
269
|
-
type: string;
|
|
270
|
-
/**
|
|
271
|
-
* ID for the button that was clicked
|
|
272
|
-
*/
|
|
273
|
-
button_reply?: {
|
|
274
|
-
id: string;
|
|
275
|
-
title: string;
|
|
276
|
-
};
|
|
277
|
-
/**
|
|
278
|
-
* ID for the list item that was selected
|
|
279
|
-
*/
|
|
280
|
-
list_reply?: {
|
|
281
|
-
id: string;
|
|
282
|
-
title: string;
|
|
283
|
-
description?: string;
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
* NFM (No-Code Flow Message) reply data
|
|
287
|
-
*/
|
|
288
|
-
nfm_reply?: {
|
|
289
|
-
/**
|
|
290
|
-
* Response data in JSON format
|
|
291
|
-
*/
|
|
292
|
-
response_json: string;
|
|
293
|
-
/**
|
|
294
|
-
* Body text of the reply
|
|
295
|
-
*/
|
|
296
|
-
body: string;
|
|
297
|
-
/**
|
|
298
|
-
* Name of the flow
|
|
299
|
-
*/
|
|
300
|
-
name: string;
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
* System object for system messages (like user phone number changes)
|
|
305
|
-
*/
|
|
306
|
-
system?: {
|
|
307
|
-
/**
|
|
308
|
-
* The type of system update
|
|
309
|
-
*/
|
|
310
|
-
type: string;
|
|
311
|
-
/**
|
|
312
|
-
* User's identity if the update is a customer identity change
|
|
313
|
-
*/
|
|
314
|
-
identity?: string;
|
|
315
|
-
/**
|
|
316
|
-
* Old and new phone numbers if the update is a phone number change
|
|
317
|
-
*/
|
|
318
|
-
customer?: {
|
|
319
|
-
/**
|
|
320
|
-
* The previous phone number
|
|
321
|
-
*/
|
|
322
|
-
previous_wa_id: string;
|
|
323
|
-
/**
|
|
324
|
-
* The new phone number
|
|
325
|
-
*/
|
|
326
|
-
wa_id: string;
|
|
327
|
-
};
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* Order object for order messages
|
|
331
|
-
*/
|
|
332
|
-
order?: {
|
|
333
|
-
/**
|
|
334
|
-
* Catalog ID
|
|
335
|
-
*/
|
|
336
|
-
catalog_id: string;
|
|
337
|
-
/**
|
|
338
|
-
* Product items in the order
|
|
339
|
-
*/
|
|
340
|
-
product_items: Array<{
|
|
341
|
-
/**
|
|
342
|
-
* Product ID
|
|
343
|
-
*/
|
|
344
|
-
product_retailer_id: string;
|
|
345
|
-
/**
|
|
346
|
-
* Quantity of the product
|
|
347
|
-
*/
|
|
348
|
-
quantity: number;
|
|
349
|
-
/**
|
|
350
|
-
* Item price
|
|
351
|
-
*/
|
|
352
|
-
item_price: number;
|
|
353
|
-
/**
|
|
354
|
-
* Currency code
|
|
355
|
-
*/
|
|
356
|
-
currency: string;
|
|
357
|
-
}>;
|
|
358
|
-
/**
|
|
359
|
-
* Text message included with the order
|
|
360
|
-
*/
|
|
361
|
-
text?: string;
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* Context object, included when a user replies or interacts
|
|
365
|
-
*/
|
|
366
|
-
context?: {
|
|
367
|
-
/**
|
|
368
|
-
* ID of the message
|
|
369
|
-
*/
|
|
370
|
-
id?: string;
|
|
371
|
-
/**
|
|
372
|
-
* ID of the sender
|
|
373
|
-
*/
|
|
374
|
-
from?: string;
|
|
375
|
-
/**
|
|
376
|
-
* ID of the message being replied to or interacted with
|
|
377
|
-
*/
|
|
378
|
-
message_id: string;
|
|
379
|
-
/**
|
|
380
|
-
* ID of the forwarded message, if applicable
|
|
381
|
-
*/
|
|
382
|
-
forwarded?: boolean;
|
|
383
|
-
/**
|
|
384
|
-
* Frequently forwarded status
|
|
385
|
-
*/
|
|
386
|
-
frequently_forwarded?: boolean;
|
|
387
|
-
/**
|
|
388
|
-
* Original message information if the message was referred
|
|
389
|
-
*/
|
|
390
|
-
referred_product?: {
|
|
391
|
-
/**
|
|
392
|
-
* Catalog ID
|
|
393
|
-
*/
|
|
394
|
-
catalog_id: string;
|
|
395
|
-
/**
|
|
396
|
-
* Product ID
|
|
397
|
-
*/
|
|
398
|
-
product_retailer_id: string;
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Errors array, if the message had errors
|
|
403
|
-
*/
|
|
404
|
-
errors?: Array<{
|
|
405
|
-
/**
|
|
406
|
-
* Error code
|
|
407
|
-
*/
|
|
408
|
-
code: number;
|
|
409
|
-
/**
|
|
410
|
-
* Error title
|
|
411
|
-
*/
|
|
412
|
-
title: string;
|
|
413
|
-
/**
|
|
414
|
-
* Error message
|
|
415
|
-
*/
|
|
416
|
-
message: string;
|
|
417
|
-
/**
|
|
418
|
-
* Error details object
|
|
419
|
-
*/
|
|
420
|
-
error_data?: {
|
|
421
|
-
/**
|
|
422
|
-
* Describes the error details
|
|
423
|
-
*/
|
|
424
|
-
details: string;
|
|
425
|
-
};
|
|
426
|
-
}>;
|
|
427
|
-
/**
|
|
428
|
-
* Button object for button messages
|
|
429
|
-
*/
|
|
430
|
-
button?: {
|
|
431
|
-
/**
|
|
432
|
-
* The payload for the button
|
|
433
|
-
*/
|
|
434
|
-
payload: string;
|
|
435
|
-
/**
|
|
436
|
-
* Button text
|
|
437
|
-
*/
|
|
438
|
-
text: string;
|
|
439
|
-
};
|
|
440
|
-
/**
|
|
441
|
-
* The original message data as received from the webhook
|
|
442
|
-
*/
|
|
443
|
-
originalData: any;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Represents a non-message event received through the webhook
|
|
447
|
-
*/
|
|
448
|
-
interface WebhookEvent {
|
|
449
|
-
/**
|
|
450
|
-
* The field type of the event
|
|
451
|
-
*/
|
|
452
|
-
field: string;
|
|
453
|
-
/**
|
|
454
|
-
* The event data
|
|
455
|
-
*/
|
|
456
|
-
value: any;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Handler function for processing messages
|
|
460
|
-
*/
|
|
461
|
-
type MessageHandler = (message: WebhookMessage) => void | Promise<void>;
|
|
462
|
-
/**
|
|
463
|
-
* Handler function for processing events
|
|
464
|
-
*/
|
|
465
|
-
type EventHandler = (event: WebhookEvent) => void | Promise<void>;
|
|
466
|
-
/**
|
|
467
|
-
* Statuses that can be received in status updates
|
|
468
|
-
*/
|
|
469
|
-
declare enum MessageStatus {
|
|
470
|
-
DELIVERED = "delivered",
|
|
471
|
-
READ = "read",
|
|
472
|
-
SENT = "sent"
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Event fields that can be received through the webhook
|
|
476
|
-
*/
|
|
477
|
-
declare enum EventField {
|
|
478
|
-
MESSAGES = "messages",
|
|
479
|
-
STATUSES = "statuses",
|
|
480
|
-
MESSAGE_TEMPLATE_STATUS_UPDATE = "message_template_status_update",
|
|
481
|
-
PHONE_NUMBER_QUALITY_UPDATE = "phone_number_quality_update",
|
|
482
|
-
PHONE_NUMBER_NAME_UPDATE = "phone_number_name_update",
|
|
483
|
-
UNKNOWN = "unknown"
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
export { EventField, type EventHandler, type MessageHandler, MessageStatus, type WebhookContact, type WebhookEvent, type WebhookMessage };
|
package/dist/types/webhook.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var _=(r,t)=>{for(var s in t)g(r,s,{get:t[s],enumerable:!0})},y=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!p.call(r,n)&&n!==s&&g(r,n,{get:()=>t[n],enumerable:!(e=m(t,n))||e.enumerable});return r};var u=r=>y(g({},"__esModule",{value:!0}),r);var l={};_(l,{EventField:()=>o,MessageStatus:()=>a});module.exports=u(l);var a=(e=>(e.DELIVERED="delivered",e.READ="read",e.SENT="sent",e))(a||{}),o=(i=>(i.MESSAGES="messages",i.STATUSES="statuses",i.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",i.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",i.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",i.UNKNOWN="unknown",i))(o||{});0&&(module.exports={EventField,MessageStatus});
|
|
2
|
-
//# sourceMappingURL=webhook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["import { MessageTypesEnum } from './enums';\n\nexport interface WebhookContact {\n /**\n * WhatsApp ID of the contact. Business can respond to this contact using this ID.\n */\n wa_id: string;\n /**\n * Additional unique, alphanumeric identifier for a WhatsApp user\n */\n user_id?: string;\n /**\n * Profile of Whatsapp user\n */\n profile: {\n /**\n * The display name of the contact\n */\n name: string;\n };\n}\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * The display phone number that received the message\n */\n displayPhoneNumber: string;\n\n /**\n * The profile name of the sender\n */\n profileName: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Reaction object for reaction messages\n */\n reaction?: {\n /**\n * The ID of the message being reacted to\n */\n message_id: string;\n /**\n * Emoji used for the reaction\n */\n emoji: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n * Can be: button_reply, list_reply, flow, nfm_reply, etc.\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n\n /**\n * NFM (No-Code Flow Message) reply data\n */\n nfm_reply?: {\n /**\n * Response data in JSON format\n */\n response_json: string;\n /**\n * Body text of the reply\n */\n body: string;\n /**\n * Name of the flow\n */\n name: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message\n */\n id?: string;\n /**\n * ID of the sender\n */\n from?: string;\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GAifO,IAAKG,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAD,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["webhook_exports","__export","EventField","MessageStatus","__toCommonJS"]}
|
package/dist/types/webhook.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=(r=>(r.DELIVERED="delivered",r.READ="read",r.SENT="sent",r))(e||{}),i=(t=>(t.MESSAGES="messages",t.STATUSES="statuses",t.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",t.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",t.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",t.UNKNOWN="unknown",t))(i||{});export{i as EventField,e as MessageStatus};
|
|
2
|
-
//# sourceMappingURL=webhook.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["import { MessageTypesEnum } from './enums';\n\nexport interface WebhookContact {\n /**\n * WhatsApp ID of the contact. Business can respond to this contact using this ID.\n */\n wa_id: string;\n /**\n * Additional unique, alphanumeric identifier for a WhatsApp user\n */\n user_id?: string;\n /**\n * Profile of Whatsapp user\n */\n profile: {\n /**\n * The display name of the contact\n */\n name: string;\n };\n}\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * The display phone number that received the message\n */\n displayPhoneNumber: string;\n\n /**\n * The profile name of the sender\n */\n profileName: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Reaction object for reaction messages\n */\n reaction?: {\n /**\n * The ID of the message being reacted to\n */\n message_id: string;\n /**\n * Emoji used for the reaction\n */\n emoji: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n * Can be: button_reply, list_reply, flow, nfm_reply, etc.\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n\n /**\n * NFM (No-Code Flow Message) reply data\n */\n nfm_reply?: {\n /**\n * Response data in JSON format\n */\n response_json: string;\n /**\n * Body text of the reply\n */\n body: string;\n /**\n * Name of the flow\n */\n name: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message\n */\n id?: string;\n /**\n * ID of the sender\n */\n from?: string;\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"AAifO,IAAKA,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAC,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["MessageStatus","EventField"]}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { BusinessProfileClass } from './businessProfile.mjs';
|
|
2
|
-
import { EncryptionClass } from './encryption.mjs';
|
|
3
|
-
import { FlowClass } from './flow.mjs';
|
|
4
|
-
import { MediaClass } from './media.mjs';
|
|
5
|
-
import { MessagesClass } from './messages.mjs';
|
|
6
|
-
import { PhoneNumberClass } from './phoneNumber.mjs';
|
|
7
|
-
import { QrCodeClass } from './qrCode.mjs';
|
|
8
|
-
import { RegistrationClass } from './registration.mjs';
|
|
9
|
-
import { TemplateClass } from './template.mjs';
|
|
10
|
-
import { TwoStepVerificationClass } from './twoStepVerification.mjs';
|
|
11
|
-
import { WABAClass } from './waba.mjs';
|
|
12
|
-
import '../enums-CI7vzKhn.mjs';
|
|
13
|
-
import './request.mjs';
|
|
14
|
-
import 'http';
|
|
15
|
-
import './base.mjs';
|
|
16
|
-
import './config.mjs';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
20
|
-
* All rights reserved.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
type WhatsAppConfig = {
|
|
27
|
-
accessToken: string;
|
|
28
|
-
appId?: string;
|
|
29
|
-
appSecret?: string;
|
|
30
|
-
phoneNumberId?: number;
|
|
31
|
-
businessAcctId?: string;
|
|
32
|
-
apiVersion?: string;
|
|
33
|
-
webhookEndpoint?: string;
|
|
34
|
-
webhookVerificationToken?: string;
|
|
35
|
-
listenerPort?: number;
|
|
36
|
-
debug?: boolean;
|
|
37
|
-
maxRetriesAfterWait?: number;
|
|
38
|
-
requestTimeout?: number;
|
|
39
|
-
privatePem?: string;
|
|
40
|
-
passphrase?: string;
|
|
41
|
-
};
|
|
42
|
-
declare class WhatsAppClass {
|
|
43
|
-
constructor(config?: WhatsAppConfig);
|
|
44
|
-
readonly messages: MessagesClass;
|
|
45
|
-
readonly templates: TemplateClass;
|
|
46
|
-
readonly phoneNumber: PhoneNumberClass;
|
|
47
|
-
readonly qrCode: QrCodeClass;
|
|
48
|
-
readonly encryption: EncryptionClass;
|
|
49
|
-
readonly twoStepVerification: TwoStepVerificationClass;
|
|
50
|
-
readonly registration: RegistrationClass;
|
|
51
|
-
readonly media: MediaClass;
|
|
52
|
-
readonly waba: WABAClass;
|
|
53
|
-
readonly flow: FlowClass;
|
|
54
|
-
readonly businessProfile: BusinessProfileClass;
|
|
55
|
-
updateTimeout(ms: number): boolean;
|
|
56
|
-
updatePhoneNumberId(phoneNumberId: number): boolean;
|
|
57
|
-
updateAccessToken(accessToken: string): boolean;
|
|
58
|
-
updateWabaId(wabaId: string): boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { WhatsAppClass, type WhatsAppConfig };
|
package/dist/types/whatsapp.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var p=(s,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!l.call(s,o)&&o!==n&&a(s,o,{get:()=>e[o],enumerable:!(r=t(e,o))||r.enumerable});return s};var m=s=>p(a({},"__esModule",{value:!0}),s);var d={};module.exports=m(d);
|
|
2
|
-
//# sourceMappingURL=whatsapp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/whatsapp.ts"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed under the license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { BusinessProfileClass } from './businessProfile';\nimport { EncryptionClass } from './encryption';\nimport { FlowClass } from './flow';\nimport { MediaClass } from './media';\nimport { MessagesClass } from './messages';\nimport { PhoneNumberClass } from './phoneNumber';\nimport { QrCodeClass } from './qrCode';\nimport { RegistrationClass } from './registration';\nimport { TemplateClass } from './template';\nimport { TwoStepVerificationClass } from './twoStepVerification';\nimport { WABAClass } from './waba';\n\nexport type WhatsAppConfig = {\n accessToken: string;\n appId?: string;\n appSecret?: string;\n phoneNumberId?: number;\n businessAcctId?: string;\n apiVersion?: string;\n webhookEndpoint?: string;\n webhookVerificationToken?: string;\n listenerPort?: number;\n debug?: boolean;\n maxRetriesAfterWait?: number;\n requestTimeout?: number;\n privatePem?: string;\n passphrase?: string;\n};\n\nexport declare class WhatsAppClass {\n constructor(config?: WhatsAppConfig);\n readonly messages: MessagesClass;\n readonly templates: TemplateClass;\n readonly phoneNumber: PhoneNumberClass;\n readonly qrCode: QrCodeClass;\n readonly encryption: EncryptionClass;\n readonly twoStepVerification: TwoStepVerificationClass;\n readonly registration: RegistrationClass;\n readonly media: MediaClass;\n readonly waba: WABAClass;\n readonly flow: FlowClass;\n readonly businessProfile: BusinessProfileClass;\n updateTimeout(ms: number): boolean;\n updatePhoneNumberId(phoneNumberId: number): boolean;\n updateAccessToken(accessToken: string): boolean;\n updateWabaId(wabaId: string): boolean;\n}\n"],"mappings":"+WAAA,IAAAA,EAAA,kBAAAC,EAAAD","names":["whatsapp_exports","__toCommonJS"]}
|
package/dist/types/whatsapp.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=whatsapp.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var o=(i,r)=>{for(var e in r)a(i,e,{get:r[e],enumerable:!0})},f=(i,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of u(r))!l.call(i,t)&&t!==e&&a(i,t,{get:()=>r[t],enumerable:!(n=s(r,t))||n.enumerable});return i};var g=i=>f(a({},"__esModule",{value:!0}),i);var y={};o(y,{buildFieldsQueryString:()=>j});module.exports=g(y);function j(i){if(!i)return"";let r="";return Array.isArray(i)?r=i.join(","):r=Object.entries(i).filter(([e,n])=>n).map(([e])=>e).join(","),r?`?fields=${r}`:""}0&&(module.exports={buildFieldsQueryString});
|
|
2
|
-
//# sourceMappingURL=buildFieldsQueryString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/buildFieldsQueryString.ts"],"sourcesContent":["export function buildFieldsQueryString(fields?: string[]): string {\n if (!fields) return '';\n\n let fieldParams = '';\n\n if (Array.isArray(fields)) {\n fieldParams = fields.join(',');\n } else {\n fieldParams = Object.entries(fields)\n .filter(([_, value]) => value)\n .map(([key]) => key)\n .join(',');\n }\n\n return fieldParams ? `?fields=${fieldParams}` : '';\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4BAAAE,IAAA,eAAAC,EAAAH,GAAO,SAASE,EAAuBE,EAA2B,CAC9D,GAAI,CAACA,EAAQ,MAAO,GAEpB,IAAIC,EAAc,GAElB,OAAI,MAAM,QAAQD,CAAM,EACpBC,EAAcD,EAAO,KAAK,GAAG,EAE7BC,EAAc,OAAO,QAAQD,CAAM,EAC9B,OAAO,CAAC,CAACE,EAAGC,CAAK,IAAMA,CAAK,EAC5B,IAAI,CAAC,CAACC,CAAG,IAAMA,CAAG,EAClB,KAAK,GAAG,EAGVH,EAAc,WAAWA,CAAW,GAAK,EACpD","names":["buildFieldsQueryString_exports","__export","buildFieldsQueryString","__toCommonJS","fields","fieldParams","_","value","key"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/buildFieldsQueryString.ts"],"sourcesContent":["export function buildFieldsQueryString(fields?: string[]): string {\n if (!fields) return '';\n\n let fieldParams = '';\n\n if (Array.isArray(fields)) {\n fieldParams = fields.join(',');\n } else {\n fieldParams = Object.entries(fields)\n .filter(([_, value]) => value)\n .map(([key]) => key)\n .join(',');\n }\n\n return fieldParams ? `?fields=${fieldParams}` : '';\n}\n"],"mappings":"AAAO,SAASA,EAAuBC,EAA2B,CAC9D,GAAI,CAACA,EAAQ,MAAO,GAEpB,IAAIC,EAAc,GAElB,OAAI,MAAM,QAAQD,CAAM,EACpBC,EAAcD,EAAO,KAAK,GAAG,EAE7BC,EAAc,OAAO,QAAQD,CAAM,EAC9B,OAAO,CAAC,CAACE,EAAGC,CAAK,IAAMA,CAAK,EAC5B,IAAI,CAAC,CAACC,CAAG,IAAMA,CAAG,EAClB,KAAK,GAAG,EAGVH,EAAc,WAAWA,CAAW,GAAK,EACpD","names":["buildFieldsQueryString","fields","fieldParams","_","value","key"]}
|