@raphaelvserafim/client-api-whatsapp 1.0.6 → 1.0.8
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 +142 -0
- package/dist/WhatsApp.d.ts +27 -6
- package/dist/WhatsApp.js +79 -31
- package/dist/WhatsApp.js.map +1 -1
- package/dist/exemple.js +154 -11
- package/dist/exemple.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +152 -0
- package/dist/{model → types}/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +1 -1
- package/src/WhatsApp.ts +80 -8
- package/src/exemple.ts +154 -1
- package/src/index.ts +1 -1
- package/src/types/index.ts +190 -0
- package/dist/model/index.d.ts +0 -65
- package/dist/model/index.js.map +0 -1
- package/src/model/index.ts +0 -80
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
export interface Init {
|
|
2
|
+
server: string;
|
|
3
|
+
key: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export enum HttpMethod {
|
|
7
|
+
GET = 'GET',
|
|
8
|
+
POST = 'POST',
|
|
9
|
+
PUT = 'PUT',
|
|
10
|
+
DELETE = 'DELETE',
|
|
11
|
+
PATCH = 'PATCH',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export enum Routes {
|
|
16
|
+
INSTANCES = 'instance',
|
|
17
|
+
MESSAGES = 'message',
|
|
18
|
+
CONTACTS = 'contacts',
|
|
19
|
+
GROUPS = 'groups',
|
|
20
|
+
ACTIONS = 'actions',
|
|
21
|
+
CALL = 'call',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export enum TypeMessage {
|
|
26
|
+
PRESENCE = 'presence',
|
|
27
|
+
TEXT = 'text',
|
|
28
|
+
AUDIO = 'audio',
|
|
29
|
+
IMAGE = 'image',
|
|
30
|
+
VIDEO = 'video',
|
|
31
|
+
DOCUMENT = 'document',
|
|
32
|
+
CONTACT = 'contact',
|
|
33
|
+
LOCATION = 'location',
|
|
34
|
+
REACTION = 'reaction',
|
|
35
|
+
LINK = 'link',
|
|
36
|
+
TITLE = 'title',
|
|
37
|
+
BUTTON_REPLY = 'button_reply',
|
|
38
|
+
BUTTON_ACTION = 'button_action',
|
|
39
|
+
BUTTON_PIX = 'pix',
|
|
40
|
+
POLL = 'survey',
|
|
41
|
+
MENU = 'list',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export enum StatusPresence {
|
|
46
|
+
UNAVAILABLE = 'unavailable',
|
|
47
|
+
AVAILABLE = 'available',
|
|
48
|
+
COMPOSING = 'composing',
|
|
49
|
+
RECORDING = 'recording',
|
|
50
|
+
PAUSED = 'paused',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
export interface WebhookBody {
|
|
56
|
+
allowWebhook: boolean;
|
|
57
|
+
webhookMessage: string;
|
|
58
|
+
webhookGroup: string;
|
|
59
|
+
webhookConnection: string;
|
|
60
|
+
webhookQrCode: string;
|
|
61
|
+
webhookMessageFromMe: string;
|
|
62
|
+
webhookHistory: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface Contact {
|
|
66
|
+
fullName: string;
|
|
67
|
+
phoneNumber: string;
|
|
68
|
+
organization?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export interface Location {
|
|
73
|
+
latitude: number;
|
|
74
|
+
longitude: number;
|
|
75
|
+
address: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface Row {
|
|
79
|
+
title: string;
|
|
80
|
+
description: string;
|
|
81
|
+
rowId: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface Section {
|
|
85
|
+
title: string;
|
|
86
|
+
rows: Row[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
export interface InfoInstance {
|
|
92
|
+
status: number
|
|
93
|
+
instance: Instance
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface Instance {
|
|
97
|
+
receive_status_message: boolean
|
|
98
|
+
save_media: boolean
|
|
99
|
+
receive_presence: boolean
|
|
100
|
+
permission: number
|
|
101
|
+
mark_messages: boolean
|
|
102
|
+
blocked: boolean
|
|
103
|
+
user?: User
|
|
104
|
+
phoneConnected: boolean
|
|
105
|
+
webhook: Webhook;
|
|
106
|
+
businessProfile?: BusinessProfile;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface User {
|
|
110
|
+
id?: string;
|
|
111
|
+
lid?: string;
|
|
112
|
+
name?: string;
|
|
113
|
+
imageProfile?: string;
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface Webhook {
|
|
118
|
+
allowWebhook: boolean
|
|
119
|
+
webhookMessage: string
|
|
120
|
+
webhookGroup: string
|
|
121
|
+
webhookConnection: string
|
|
122
|
+
webhookQrCode: string
|
|
123
|
+
webhookMessageFromMe: string
|
|
124
|
+
webhookHistory: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export interface SendMessageRoot {
|
|
130
|
+
status: number
|
|
131
|
+
data: Data
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface Data {
|
|
135
|
+
key: Key
|
|
136
|
+
message: Message
|
|
137
|
+
messageTimestamp: string
|
|
138
|
+
status: string
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface Key {
|
|
142
|
+
remoteJid: string
|
|
143
|
+
fromMe: boolean
|
|
144
|
+
id: string
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface Message {
|
|
148
|
+
extendedTextMessage: ExtendedTextMessage
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface ExtendedTextMessage {
|
|
152
|
+
text: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface Connect {
|
|
156
|
+
status: number;
|
|
157
|
+
phoneConnected: boolean;
|
|
158
|
+
qrcode: string;
|
|
159
|
+
image: string;
|
|
160
|
+
user?: User;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
export interface BusinessProfile {
|
|
166
|
+
wid: string
|
|
167
|
+
description: string
|
|
168
|
+
website: any[]
|
|
169
|
+
category: string
|
|
170
|
+
business_hours: {}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
export interface Buttons {
|
|
176
|
+
type: "quick_reply" | "cta_copy" | "cta_url" | "cta_call",
|
|
177
|
+
copy_code?: string,
|
|
178
|
+
phone_number?: string,
|
|
179
|
+
url?: string,
|
|
180
|
+
id?: string,
|
|
181
|
+
text: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
export interface Items {
|
|
186
|
+
id: string,
|
|
187
|
+
name: string,
|
|
188
|
+
price: number,
|
|
189
|
+
quantity: number
|
|
190
|
+
}
|
package/dist/model/index.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export interface Init {
|
|
2
|
-
server: string;
|
|
3
|
-
key: string;
|
|
4
|
-
}
|
|
5
|
-
export declare enum HttpMethod {
|
|
6
|
-
GET = "GET",
|
|
7
|
-
POST = "POST",
|
|
8
|
-
PUT = "PUT",
|
|
9
|
-
DELETE = "DELETE",
|
|
10
|
-
PATCH = "PATCH"
|
|
11
|
-
}
|
|
12
|
-
export declare enum Routes {
|
|
13
|
-
INSTANCES = "instance",
|
|
14
|
-
MESSAGES = "message",
|
|
15
|
-
CONTACTS = "contacts",
|
|
16
|
-
GROUPS = "groups",
|
|
17
|
-
ACTIONS = "actions"
|
|
18
|
-
}
|
|
19
|
-
export declare enum TypeMessage {
|
|
20
|
-
PRESENCE = "presence",
|
|
21
|
-
TEXT = "text",
|
|
22
|
-
AUDIO = "audio",
|
|
23
|
-
IMAGE = "image",
|
|
24
|
-
VIDEO = "video",
|
|
25
|
-
DOCUMENT = "document",
|
|
26
|
-
CONTACT = "contact",
|
|
27
|
-
LOCATION = "location",
|
|
28
|
-
REACTION = "reaction",
|
|
29
|
-
LINK = "link"
|
|
30
|
-
}
|
|
31
|
-
export declare enum StatusPresence {
|
|
32
|
-
UNAVAILABLE = "unavailable",
|
|
33
|
-
AVAILABLE = "available",
|
|
34
|
-
COMPOSING = "composing",
|
|
35
|
-
RECORDING = "recording",
|
|
36
|
-
PAUSED = "paused"
|
|
37
|
-
}
|
|
38
|
-
export interface WebhookBody {
|
|
39
|
-
allowWebhook: boolean;
|
|
40
|
-
webhookMessage: string;
|
|
41
|
-
webhookGroup: string;
|
|
42
|
-
webhookConnection: string;
|
|
43
|
-
webhookQrCode: string;
|
|
44
|
-
webhookMessageFromMe: string;
|
|
45
|
-
webhookHistory: string;
|
|
46
|
-
}
|
|
47
|
-
export interface Contact {
|
|
48
|
-
fullName: string;
|
|
49
|
-
phoneNumber: string;
|
|
50
|
-
organization?: string;
|
|
51
|
-
}
|
|
52
|
-
export interface Location {
|
|
53
|
-
latitude: number;
|
|
54
|
-
longitude: number;
|
|
55
|
-
address: string;
|
|
56
|
-
}
|
|
57
|
-
export interface Row {
|
|
58
|
-
title: string;
|
|
59
|
-
description: string;
|
|
60
|
-
rowId: string;
|
|
61
|
-
}
|
|
62
|
-
export interface Section {
|
|
63
|
-
title: string;
|
|
64
|
-
rows: Row[];
|
|
65
|
-
}
|
package/dist/model/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;AAKA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,6BAAe,CAAA;AACjB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAGD,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,gCAAsB,CAAA;IACtB,8BAAoB,CAAA;IACpB,+BAAqB,CAAA;IACrB,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;AACrB,CAAC,EANW,MAAM,sBAAN,MAAM,QAMjB;AAGD,IAAY,WAWX;AAXD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;AACf,CAAC,EAXW,WAAW,2BAAX,WAAW,QAWtB;AAGD,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB","sourcesContent":["export interface Init {\n server: string;\n key: string;\n}\n\nexport enum HttpMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\n\nexport enum Routes {\n INSTANCES = 'instance',\n MESSAGES = 'message',\n CONTACTS = 'contacts',\n GROUPS = 'groups',\n ACTIONS = 'actions',\n}\n\n\nexport enum TypeMessage {\n PRESENCE = 'presence',\n TEXT = 'text',\n AUDIO = 'audio',\n IMAGE = 'image',\n VIDEO = 'video',\n DOCUMENT = 'document',\n CONTACT = 'contact',\n LOCATION = 'location',\n REACTION = 'reaction',\n LINK = 'link',\n}\n\n\nexport enum StatusPresence {\n UNAVAILABLE = 'unavailable',\n AVAILABLE = 'available',\n COMPOSING = 'composing',\n RECORDING = 'recording',\n PAUSED = 'paused',\n}\n\n\n\nexport interface WebhookBody {\n allowWebhook: boolean;\n webhookMessage: string;\n webhookGroup: string;\n webhookConnection: string;\n webhookQrCode: string;\n webhookMessageFromMe: string;\n webhookHistory: string;\n}\n\nexport interface Contact {\n fullName: string;\n phoneNumber: string;\n organization?: string;\n}\n\n\nexport interface Location {\n latitude: number;\n longitude: number;\n address: string;\n}\n\nexport interface Row {\n title: string;\n description: string;\n rowId: string;\n}\n\nexport interface Section {\n title: string;\n rows: Row[];\n}"]}
|
package/src/model/index.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
export interface Init {
|
|
2
|
-
server: string;
|
|
3
|
-
key: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export enum HttpMethod {
|
|
7
|
-
GET = 'GET',
|
|
8
|
-
POST = 'POST',
|
|
9
|
-
PUT = 'PUT',
|
|
10
|
-
DELETE = 'DELETE',
|
|
11
|
-
PATCH = 'PATCH',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export enum Routes {
|
|
16
|
-
INSTANCES = 'instance',
|
|
17
|
-
MESSAGES = 'message',
|
|
18
|
-
CONTACTS = 'contacts',
|
|
19
|
-
GROUPS = 'groups',
|
|
20
|
-
ACTIONS = 'actions',
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export enum TypeMessage {
|
|
25
|
-
PRESENCE = 'presence',
|
|
26
|
-
TEXT = 'text',
|
|
27
|
-
AUDIO = 'audio',
|
|
28
|
-
IMAGE = 'image',
|
|
29
|
-
VIDEO = 'video',
|
|
30
|
-
DOCUMENT = 'document',
|
|
31
|
-
CONTACT = 'contact',
|
|
32
|
-
LOCATION = 'location',
|
|
33
|
-
REACTION = 'reaction',
|
|
34
|
-
LINK = 'link',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export enum StatusPresence {
|
|
39
|
-
UNAVAILABLE = 'unavailable',
|
|
40
|
-
AVAILABLE = 'available',
|
|
41
|
-
COMPOSING = 'composing',
|
|
42
|
-
RECORDING = 'recording',
|
|
43
|
-
PAUSED = 'paused',
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export interface WebhookBody {
|
|
49
|
-
allowWebhook: boolean;
|
|
50
|
-
webhookMessage: string;
|
|
51
|
-
webhookGroup: string;
|
|
52
|
-
webhookConnection: string;
|
|
53
|
-
webhookQrCode: string;
|
|
54
|
-
webhookMessageFromMe: string;
|
|
55
|
-
webhookHistory: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface Contact {
|
|
59
|
-
fullName: string;
|
|
60
|
-
phoneNumber: string;
|
|
61
|
-
organization?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export interface Location {
|
|
66
|
-
latitude: number;
|
|
67
|
-
longitude: number;
|
|
68
|
-
address: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface Row {
|
|
72
|
-
title: string;
|
|
73
|
-
description: string;
|
|
74
|
-
rowId: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface Section {
|
|
78
|
-
title: string;
|
|
79
|
-
rows: Row[];
|
|
80
|
-
}
|