@vraksha/bottender 1.6.1-beta.2 → 1.6.1-beta.4
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/initializeServer.js +9 -8
- package/dist/initializeServer.js.map +1 -1
- package/dist/shared/getChannelSchema.js +2 -2
- package/dist/shared/getChannelSchema.js.map +1 -1
- package/dist/shared/getClient.d.ts +3 -2
- package/dist/shared/getClient.d.ts.map +1 -1
- package/dist/shared/getClient.js +9 -8
- package/dist/shared/getClient.js.map +1 -1
- package/dist/types.d.ts +18 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -2
- package/dist/types.js.map +1 -1
- package/dist/whatsapp-business/MetaClient.d.ts +297 -0
- package/dist/whatsapp-business/MetaClient.d.ts.map +1 -0
- package/dist/whatsapp-business/MetaClient.js +74 -0
- package/dist/whatsapp-business/MetaClient.js.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessBot.d.ts +15 -0
- package/dist/whatsapp-business/WhatsappBusinessBot.d.ts.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessBot.js +27 -0
- package/dist/whatsapp-business/WhatsappBusinessBot.js.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessConnector.d.ts +59 -0
- package/dist/whatsapp-business/WhatsappBusinessConnector.d.ts.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessConnector.js +130 -0
- package/dist/whatsapp-business/WhatsappBusinessConnector.js.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessContext.d.ts +45 -0
- package/dist/whatsapp-business/WhatsappBusinessContext.d.ts.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessContext.js +49 -0
- package/dist/whatsapp-business/WhatsappBusinessContext.js.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessEvent.d.ts +26 -0
- package/dist/whatsapp-business/WhatsappBusinessEvent.d.ts.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessEvent.js +61 -0
- package/dist/whatsapp-business/WhatsappBusinessEvent.js.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessTypes.d.ts +236 -0
- package/dist/whatsapp-business/WhatsappBusinessTypes.d.ts.map +1 -0
- package/dist/whatsapp-business/WhatsappBusinessTypes.js +3 -0
- package/dist/whatsapp-business/WhatsappBusinessTypes.js.map +1 -0
- package/dist/whatsapp-business/routes.d.ts +20 -0
- package/dist/whatsapp-business/routes.d.ts.map +1 -0
- package/dist/whatsapp-business/routes.js +33 -0
- package/dist/whatsapp-business/routes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { RequestContext } from '../types';
|
|
2
|
+
type WhatsappRequestBody = {
|
|
3
|
+
object: 'whatsapp_business_account';
|
|
4
|
+
entry: Array<WhatsAppEntry>;
|
|
5
|
+
};
|
|
6
|
+
interface WhatsAppEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
changes: Array<WhatsAppChange>;
|
|
9
|
+
}
|
|
10
|
+
type WhatsAppEventType = 'contacts' | 'messages' | 'statuses';
|
|
11
|
+
interface WhatsAppChange {
|
|
12
|
+
value: WhatsAppWebhookValue;
|
|
13
|
+
field: WhatsAppEventType;
|
|
14
|
+
}
|
|
15
|
+
interface WhatsAppWebhookValue {
|
|
16
|
+
messaging_product: 'whatsapp';
|
|
17
|
+
metadata: WhatsAppEventMetadata;
|
|
18
|
+
contacts?: WhatsAppContactPayload[];
|
|
19
|
+
messages?: WhatsAppMessagePayload[];
|
|
20
|
+
statuses?: WhatsAppStatusPayload[];
|
|
21
|
+
}
|
|
22
|
+
interface WhatsAppEventMetadata {
|
|
23
|
+
display_phone_number: string;
|
|
24
|
+
phone_number_id: string;
|
|
25
|
+
}
|
|
26
|
+
interface WhatsAppContactPayload {
|
|
27
|
+
profile: {
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
wa_id: string;
|
|
31
|
+
}
|
|
32
|
+
type WhatsAppMessagePayload = TextMessage | ReactionMessage | MediaMessage | StickerMessage | UnknownMessage | LocationMessage | ContactMessage | ButtonMessage | ListMessage | ReferralMessage | ProductInquiryMessage | OrderMessage | SystemMessage;
|
|
33
|
+
interface BaseMessage {
|
|
34
|
+
from: string;
|
|
35
|
+
id: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
}
|
|
38
|
+
interface TextMessage extends BaseMessage {
|
|
39
|
+
type: 'text';
|
|
40
|
+
text: {
|
|
41
|
+
body: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface ReactionMessage extends BaseMessage {
|
|
45
|
+
type: 'reaction';
|
|
46
|
+
reaction: {
|
|
47
|
+
message_id: string;
|
|
48
|
+
emoji: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface MediaMessage extends BaseMessage {
|
|
52
|
+
type: 'image' | 'video' | 'audio' | 'document';
|
|
53
|
+
image?: MediaDetail;
|
|
54
|
+
video?: MediaDetail;
|
|
55
|
+
audio?: MediaDetail;
|
|
56
|
+
document?: MediaDetail;
|
|
57
|
+
}
|
|
58
|
+
interface MediaDetail {
|
|
59
|
+
caption?: string;
|
|
60
|
+
mime_type: string;
|
|
61
|
+
sha256: string;
|
|
62
|
+
id: string;
|
|
63
|
+
}
|
|
64
|
+
interface StickerMessage extends BaseMessage {
|
|
65
|
+
type: 'sticker';
|
|
66
|
+
sticker: {
|
|
67
|
+
mime_type: string;
|
|
68
|
+
sha256: string;
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
interface UnknownMessage extends BaseMessage {
|
|
73
|
+
type: 'unknown' | 'unsupported';
|
|
74
|
+
errors: ErrorDetail[];
|
|
75
|
+
}
|
|
76
|
+
interface ErrorDetail {
|
|
77
|
+
code: number;
|
|
78
|
+
details: string;
|
|
79
|
+
title: string;
|
|
80
|
+
}
|
|
81
|
+
interface LocationMessage extends BaseMessage {
|
|
82
|
+
type: 'location';
|
|
83
|
+
location: {
|
|
84
|
+
latitude: number;
|
|
85
|
+
longitude: number;
|
|
86
|
+
name?: string;
|
|
87
|
+
address?: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface ContactMessage extends BaseMessage {
|
|
91
|
+
type: 'contacts';
|
|
92
|
+
contacts: ContactDetail[];
|
|
93
|
+
}
|
|
94
|
+
interface ContactDetail {
|
|
95
|
+
addresses?: Address[];
|
|
96
|
+
birthday?: string;
|
|
97
|
+
emails?: Email[];
|
|
98
|
+
name: Name;
|
|
99
|
+
org?: Organization;
|
|
100
|
+
phones?: Phone[];
|
|
101
|
+
urls?: URL[];
|
|
102
|
+
}
|
|
103
|
+
interface Address {
|
|
104
|
+
city?: string;
|
|
105
|
+
country?: string;
|
|
106
|
+
country_code?: string;
|
|
107
|
+
state?: string;
|
|
108
|
+
street?: string;
|
|
109
|
+
type?: string;
|
|
110
|
+
zip?: string;
|
|
111
|
+
}
|
|
112
|
+
interface Email {
|
|
113
|
+
email: string;
|
|
114
|
+
type?: string;
|
|
115
|
+
}
|
|
116
|
+
interface Name {
|
|
117
|
+
formatted_name: string;
|
|
118
|
+
first_name?: string;
|
|
119
|
+
last_name?: string;
|
|
120
|
+
middle_name?: string;
|
|
121
|
+
suffix?: string;
|
|
122
|
+
prefix?: string;
|
|
123
|
+
}
|
|
124
|
+
interface Organization {
|
|
125
|
+
company?: string;
|
|
126
|
+
department?: string;
|
|
127
|
+
title?: string;
|
|
128
|
+
}
|
|
129
|
+
interface Phone {
|
|
130
|
+
phone: string;
|
|
131
|
+
wa_id?: string;
|
|
132
|
+
type?: string;
|
|
133
|
+
}
|
|
134
|
+
interface URL {
|
|
135
|
+
url: string;
|
|
136
|
+
type?: string;
|
|
137
|
+
}
|
|
138
|
+
interface ButtonMessage extends BaseMessage {
|
|
139
|
+
type: 'button';
|
|
140
|
+
button: {
|
|
141
|
+
text: string;
|
|
142
|
+
payload: string;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
interface ListMessage extends BaseMessage {
|
|
146
|
+
type: 'interactive';
|
|
147
|
+
interactive: {
|
|
148
|
+
list_reply: {
|
|
149
|
+
id: string;
|
|
150
|
+
title: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
};
|
|
153
|
+
type: 'list_reply';
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
interface ReferralMessage extends BaseMessage {
|
|
157
|
+
type: 'text';
|
|
158
|
+
text: {
|
|
159
|
+
body: string;
|
|
160
|
+
};
|
|
161
|
+
referral: ReferralDetail;
|
|
162
|
+
}
|
|
163
|
+
interface ReferralDetail {
|
|
164
|
+
source_url: string;
|
|
165
|
+
source_id: string;
|
|
166
|
+
source_type: string;
|
|
167
|
+
headline: string;
|
|
168
|
+
body: string;
|
|
169
|
+
media_type: string;
|
|
170
|
+
image_url?: string;
|
|
171
|
+
video_url?: string;
|
|
172
|
+
thumbnail_url?: string;
|
|
173
|
+
ctwa_clid?: string;
|
|
174
|
+
}
|
|
175
|
+
interface ProductInquiryMessage extends BaseMessage {
|
|
176
|
+
type: 'text';
|
|
177
|
+
text: {
|
|
178
|
+
body: string;
|
|
179
|
+
};
|
|
180
|
+
context: {
|
|
181
|
+
from: string;
|
|
182
|
+
id: string;
|
|
183
|
+
referred_product: {
|
|
184
|
+
catalog_id: string;
|
|
185
|
+
product_retailer_id: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
interface OrderMessage extends BaseMessage {
|
|
190
|
+
type: 'order';
|
|
191
|
+
order: {
|
|
192
|
+
catalog_id: string;
|
|
193
|
+
product_items: ProductItem[];
|
|
194
|
+
text: string;
|
|
195
|
+
};
|
|
196
|
+
context: {
|
|
197
|
+
from: string;
|
|
198
|
+
id: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
interface ProductItem {
|
|
202
|
+
product_retailer_id: string;
|
|
203
|
+
quantity: string;
|
|
204
|
+
item_price: string;
|
|
205
|
+
currency: string;
|
|
206
|
+
}
|
|
207
|
+
interface SystemMessage extends BaseMessage {
|
|
208
|
+
type: 'system';
|
|
209
|
+
system: {
|
|
210
|
+
body: string;
|
|
211
|
+
new_wa_id?: string;
|
|
212
|
+
type: 'user_changed_number';
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
interface WhatsAppStatusPayload {
|
|
216
|
+
id: string;
|
|
217
|
+
status: 'sent' | 'delivered' | 'read' | 'failed';
|
|
218
|
+
timestamp: string;
|
|
219
|
+
recipient_id: string;
|
|
220
|
+
conversation?: {
|
|
221
|
+
id: string;
|
|
222
|
+
expiration_timestamp?: string;
|
|
223
|
+
origin: {
|
|
224
|
+
type: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
pricing?: {
|
|
228
|
+
billable: boolean;
|
|
229
|
+
pricing_model: string;
|
|
230
|
+
category: string;
|
|
231
|
+
};
|
|
232
|
+
errors?: ErrorDetail[];
|
|
233
|
+
}
|
|
234
|
+
type WhatsappRequestContext = RequestContext<WhatsappRequestBody>;
|
|
235
|
+
export { WhatsAppEventType, WhatsappRequestBody, WhatsappRequestContext, WhatsAppContactPayload, WhatsAppMessagePayload, WhatsAppStatusPayload, WhatsAppChange, WhatsAppEntry, WhatsAppEventMetadata, };
|
|
236
|
+
//# sourceMappingURL=WhatsappBusinessTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhatsappBusinessTypes.d.ts","sourceRoot":"","sources":["../../src/whatsapp-business/WhatsappBusinessTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,2BAA2B,CAAC;IACpC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAC;AAEF,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CAChC;AAED,KAAK,iBAAiB,GAAG,UAAU,GAAG,UAAU,GAAG,UAA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KACZ,CAAC;CACH;AAED,UAAU,WAAW;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,aAAc,SAAQ,WAAW;IACzC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,qBAAqB,CAAC;KAC7B,CAAC;CACH;AAED,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QACb,EAAE,EAAE,MAAM,CAAC;QACX,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,OAAO,CAAC,EAAE;QACR,QAAQ,EAAE,OAAO,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAGD,KAAK,sBAAsB,GAAG,cAAc,CAAC,mBAAmB,CAAC,CAAC;AAElE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,qBAAqB,GACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhatsappBusinessTypes.js","sourceRoot":"","sources":["../../src/whatsapp-business/WhatsappBusinessTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Context from '../context/Context';
|
|
2
|
+
import { Action } from '../types';
|
|
3
|
+
import { RoutePredicate } from '../router';
|
|
4
|
+
import WhatsappContext from './WhatsappBusinessContext';
|
|
5
|
+
type Route = <C extends Context>(action: Action<WhatsappContext, any>) => {
|
|
6
|
+
predicate: RoutePredicate<C>;
|
|
7
|
+
action: Action<WhatsappContext, any>;
|
|
8
|
+
};
|
|
9
|
+
type Whatsapp = Route & {
|
|
10
|
+
any: Route;
|
|
11
|
+
message: Route;
|
|
12
|
+
media: Route;
|
|
13
|
+
received: Route;
|
|
14
|
+
sent: Route;
|
|
15
|
+
delivered: Route;
|
|
16
|
+
read: Route;
|
|
17
|
+
};
|
|
18
|
+
declare const whatsapp: Whatsapp;
|
|
19
|
+
export default whatsapp;
|
|
20
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/whatsapp-business/routes.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAS,MAAM,WAAW,CAAC;AAElD,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAExD,KAAK,KAAK,GAAG,CAAC,CAAC,SAAS,OAAO,EAC7B,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,KACjC;IACH,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;CACtC,CAAC;AAEF,KAAK,QAAQ,GAAG,KAAK,GAAG;IACtB,GAAG,EAAE,KAAK,CAAC;IACX,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,QAIf,CAAC;AAgEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const router_1 = require("../router");
|
|
4
|
+
const whatsapp = (action) => {
|
|
5
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business', action);
|
|
6
|
+
};
|
|
7
|
+
whatsapp.any = whatsapp;
|
|
8
|
+
function message(action) {
|
|
9
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isMessage, action);
|
|
10
|
+
}
|
|
11
|
+
whatsapp.message = message;
|
|
12
|
+
function media(action) {
|
|
13
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isMedia, action);
|
|
14
|
+
}
|
|
15
|
+
whatsapp.media = media;
|
|
16
|
+
function received(action) {
|
|
17
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isReceived, action);
|
|
18
|
+
}
|
|
19
|
+
whatsapp.received = received;
|
|
20
|
+
function sent(action) {
|
|
21
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isSent, action);
|
|
22
|
+
}
|
|
23
|
+
whatsapp.sent = sent;
|
|
24
|
+
function delivered(action) {
|
|
25
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isDelivered, action);
|
|
26
|
+
}
|
|
27
|
+
whatsapp.delivered = delivered;
|
|
28
|
+
function read(action) {
|
|
29
|
+
return (0, router_1.route)((context) => context.platform === 'whatsapp-business' && context.event.isRead, action);
|
|
30
|
+
}
|
|
31
|
+
whatsapp.read = read;
|
|
32
|
+
exports.default = whatsapp;
|
|
33
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","s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