@im-more/dsh-whatsapp 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/cordis.patch.yml +12 -0
- package/lib/index.js +1694 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +66 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +164 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +40 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +63 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +64 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +244 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +53 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +149 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +48 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +52 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +15 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/interactive.d.ts +45 -0
- package/lib/types/interactive.d.ts.map +1 -0
- package/lib/types/interactive.js +111 -0
- package/lib/types/interactive.js.map +1 -0
- package/lib/types/internal.d.ts +28 -0
- package/lib/types/internal.d.ts.map +1 -0
- package/lib/types/internal.js +35 -0
- package/lib/types/internal.js.map +1 -0
- package/lib/types/media.d.ts +17 -0
- package/lib/types/media.d.ts.map +1 -0
- package/lib/types/media.js +49 -0
- package/lib/types/media.js.map +1 -0
- package/lib/types/modes/shared.d.ts +112 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +285 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/modes/text.d.ts +19 -0
- package/lib/types/modes/text.d.ts.map +1 -0
- package/lib/types/modes/text.js +126 -0
- package/lib/types/modes/text.js.map +1 -0
- package/lib/types/request.d.ts +61 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +193 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/send.d.ts +47 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +74 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/signature.d.ts +33 -0
- package/lib/types/signature.d.ts.map +1 -0
- package/lib/types/signature.js +46 -0
- package/lib/types/signature.js.map +1 -0
- package/lib/types/transport/webhook.d.ts +50 -0
- package/lib/types/transport/webhook.d.ts.map +1 -0
- package/lib/types/transport/webhook.js +197 -0
- package/lib/types/transport/webhook.js.map +1 -0
- package/lib/types/types.d.ts +198 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/types.js +2 -0
- package/lib/types/types.js.map +1 -0
- package/package.json +61 -3
- package/src/bot.ts +233 -0
- package/src/config.ts +98 -0
- package/src/decode.ts +335 -0
- package/src/errors.ts +189 -0
- package/src/identity.ts +76 -0
- package/src/index.ts +100 -0
- package/src/interactive.ts +135 -0
- package/src/internal.ts +49 -0
- package/src/media.ts +59 -0
- package/src/modes/shared.ts +354 -0
- package/src/modes/text.ts +174 -0
- package/src/request.ts +238 -0
- package/src/send.ts +120 -0
- package/src/signature.ts +54 -0
- package/src/transport/webhook.ts +267 -0
- package/src/types.ts +244 -0
- package/README.md +0 -3
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The webhook transport.
|
|
3
|
+
*
|
|
4
|
+
* The Cloud API has no long connection, polling or gateway: Meta posts every event to one public HTTPS callback, and
|
|
5
|
+
* the subscription is confirmed once by a `GET` handshake on the same path. The route is registered on the profile's
|
|
6
|
+
* `webServer`, which owns the listener and the public address; the adapter keeps the handler anonymous and
|
|
7
|
+
* authenticates every delivery with the App Secret.
|
|
8
|
+
*
|
|
9
|
+
* A delivery is acknowledged only after intake stored every message it carries, so a retrying platform can resend a
|
|
10
|
+
* delivery whose intake failed, and every refusal happens before any work is done.
|
|
11
|
+
*/
|
|
12
|
+
import { routePath } from "../config.js";
|
|
13
|
+
import { decodeChange } from "../decode.js";
|
|
14
|
+
import { constantTimeEqual, matchesSignature, SIGNATURE_HEADER, } from "../signature.js";
|
|
15
|
+
/** Message of any caught value, for a log line. */
|
|
16
|
+
function messageOf(error) {
|
|
17
|
+
return error instanceof Error ? error.message : String(error);
|
|
18
|
+
}
|
|
19
|
+
/** One header of an inbound request, when it arrived exactly once. */
|
|
20
|
+
function headerOf(request, name) {
|
|
21
|
+
const value = request.headers[name];
|
|
22
|
+
return typeof value === 'string' ? value : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** One plain object. */
|
|
25
|
+
function isRecord(value) {
|
|
26
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
/** Read a request body to its end. The platform publishes no delivery-size limit, so the adapter imposes none. */
|
|
29
|
+
async function readBody(request) {
|
|
30
|
+
const chunks = [];
|
|
31
|
+
for await (const chunk of request) {
|
|
32
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
33
|
+
}
|
|
34
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
35
|
+
}
|
|
36
|
+
/** Write one bodiless answer. */
|
|
37
|
+
function writeStatus(response, status, headers = {}) {
|
|
38
|
+
response.writeHead(status, headers);
|
|
39
|
+
response.end();
|
|
40
|
+
}
|
|
41
|
+
/** Write one answer with a body. */
|
|
42
|
+
function writeBody(response, status, body, contentType) {
|
|
43
|
+
response.writeHead(status, { 'content-type': contentType });
|
|
44
|
+
response.end(body);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether a parsed JSON value is a delivery this handler can read.
|
|
48
|
+
*
|
|
49
|
+
* A change of the `messages` field carries the routing key, so its value is validated down to that key; every other
|
|
50
|
+
* change family is only logged, so its value is taken as it came.
|
|
51
|
+
* @param value - the parsed JSON value.
|
|
52
|
+
* @returns whether the value is a webhook delivery.
|
|
53
|
+
*/
|
|
54
|
+
function isWebhookBody(value) {
|
|
55
|
+
if (!isRecord(value) ||
|
|
56
|
+
typeof value.object !== 'string' ||
|
|
57
|
+
!Array.isArray(value.entry))
|
|
58
|
+
return false;
|
|
59
|
+
for (const entry of value.entry) {
|
|
60
|
+
if (!isRecord(entry) || !Array.isArray(entry.changes))
|
|
61
|
+
return false;
|
|
62
|
+
for (const change of entry.changes) {
|
|
63
|
+
if (!isRecord(change) ||
|
|
64
|
+
typeof change.field !== 'string' ||
|
|
65
|
+
!isRecord(change.value))
|
|
66
|
+
return false;
|
|
67
|
+
if (change.field !== 'messages')
|
|
68
|
+
continue;
|
|
69
|
+
const current = change.value;
|
|
70
|
+
if (!isRecord(current.metadata) ||
|
|
71
|
+
typeof current.metadata.phone_number_id !== 'string')
|
|
72
|
+
return false;
|
|
73
|
+
if (current.messages !== undefined && !Array.isArray(current.messages))
|
|
74
|
+
return false;
|
|
75
|
+
if (current.statuses !== undefined && !Array.isArray(current.statuses))
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The webhook route.
|
|
83
|
+
*
|
|
84
|
+
* `start` registers the one route that answers both the handshake and every delivery; `stop` releases it.
|
|
85
|
+
*/
|
|
86
|
+
export class WhatsappWebhook {
|
|
87
|
+
bot;
|
|
88
|
+
webServer;
|
|
89
|
+
dispose;
|
|
90
|
+
constructor(bot, webServer) {
|
|
91
|
+
this.bot = bot;
|
|
92
|
+
this.webServer = webServer;
|
|
93
|
+
}
|
|
94
|
+
/** Register the route. */
|
|
95
|
+
start() {
|
|
96
|
+
this.dispose = this.webServer.register({
|
|
97
|
+
kind: 'exact',
|
|
98
|
+
path: routePath(this.bot.config.webhook.path),
|
|
99
|
+
auth: 'anonymous',
|
|
100
|
+
handler: (request, response) => this.handle(request, response),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/** Release the route. */
|
|
104
|
+
stop() {
|
|
105
|
+
this.dispose?.();
|
|
106
|
+
this.dispose = undefined;
|
|
107
|
+
}
|
|
108
|
+
async handle(request, response) {
|
|
109
|
+
try {
|
|
110
|
+
if (request.method === 'GET') {
|
|
111
|
+
this.verify(request, response);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (request.method !== 'POST') {
|
|
115
|
+
writeStatus(response, 405, { allow: 'GET, POST' });
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
await this.deliver(request, response);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
this.bot.ctx.logger.warn('whatsapp: webhook delivery failed: %s', messageOf(error));
|
|
122
|
+
if (!response.headersSent)
|
|
123
|
+
writeStatus(response, 500);
|
|
124
|
+
else
|
|
125
|
+
response.end();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The subscription handshake: `hub.mode` and `hub.verify_token` are checked, then `hub.challenge` is echoed.
|
|
130
|
+
*
|
|
131
|
+
* The token is a value a human typed into the Meta app panel, not a secret of the API surface, but it is compared in
|
|
132
|
+
* constant time like the signature so the endpoint is not an oracle for it.
|
|
133
|
+
*/
|
|
134
|
+
verify(request, response) {
|
|
135
|
+
const query = new URL(request.url ?? '', 'http://localhost').searchParams;
|
|
136
|
+
const mode = query.get('hub.mode');
|
|
137
|
+
const challenge = query.get('hub.challenge');
|
|
138
|
+
const token = query.get('hub.verify_token') ?? undefined;
|
|
139
|
+
if (mode !== 'subscribe' ||
|
|
140
|
+
challenge === null ||
|
|
141
|
+
!constantTimeEqual(this.bot.config.verifyToken, token)) {
|
|
142
|
+
writeStatus(response, 403);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
writeBody(response, 200, challenge, 'text/plain');
|
|
146
|
+
}
|
|
147
|
+
/** Verify, parse and store one delivery. */
|
|
148
|
+
async deliver(request, response) {
|
|
149
|
+
// A request without a signature is not from Meta; there is no reason to read its body.
|
|
150
|
+
const received = headerOf(request, SIGNATURE_HEADER);
|
|
151
|
+
if (received === undefined) {
|
|
152
|
+
writeStatus(response, 401);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const body = await readBody(request);
|
|
156
|
+
// The signature covers the body as it arrived, so it is verified before the body is interpreted.
|
|
157
|
+
if (!matchesSignature(this.bot.config.secret, body, received)) {
|
|
158
|
+
writeStatus(response, 401);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
let parsed;
|
|
162
|
+
try {
|
|
163
|
+
parsed = JSON.parse(body);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
this.bot.ctx.logger.warn('whatsapp: cannot parse a webhook delivery: %s', messageOf(error));
|
|
167
|
+
writeStatus(response, 400);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (!isWebhookBody(parsed)) {
|
|
171
|
+
this.bot.ctx.logger.warn('whatsapp: a webhook delivery is not a WhatsApp payload');
|
|
172
|
+
writeStatus(response, 400);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (parsed.object !== 'whatsapp_business_account') {
|
|
176
|
+
// Another Meta product shares the app secret; its deliveries are none of this adapter's business.
|
|
177
|
+
this.bot.ctx.logger.debug('whatsapp: ignoring a %s delivery', parsed.object);
|
|
178
|
+
writeStatus(response, 200);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
for (const entry of parsed.entry) {
|
|
182
|
+
for (const change of entry.changes) {
|
|
183
|
+
// One callback address serves every number of the app; each row answers only its own number.
|
|
184
|
+
if (change.field === 'messages' &&
|
|
185
|
+
change.value.metadata.phone_number_id !==
|
|
186
|
+
this.bot.config.phoneNumberId) {
|
|
187
|
+
this.bot.ctx.logger.debug('whatsapp: skipping a change of number %s', change.value.metadata.phone_number_id);
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
for (const session of decodeChange(this.bot, change))
|
|
191
|
+
await this.bot.receive(session);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
writeStatus(response, 200);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../src/transport/webhook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAmBxB,mDAAmD;AACnD,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED,sEAAsE;AACtE,SAAS,QAAQ,CAAC,OAAwB,EAAE,IAAY;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACtD,CAAC;AAED,wBAAwB;AACxB,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,kHAAkH;AAClH,KAAK,UAAU,QAAQ,CAAC,OAAwB;IAC9C,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,QA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ACzD,CAAA;YACD,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;YAC1B,OAAM;QACR,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,2BAA2B,EAAE,CAAC;YAClD,kGAAkG;YAClG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CACvB,kCAAkC,EAClC,MAAM,CAAC,MAAM,CACd,CAAA;YACD,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;YAC1B,OAAM;QACR,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjC,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnC,6FAA6F;gBAC7F,IACE,MAAM,CAAC,KAAK,KAAK,UAAU;oBAC3B,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe;wBACnC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,EAC/B,CAAC;oBACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CACvB,0CAA0C,EAC1C,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CACtC,CAAA;oBACD,SAAQ;gBACV,CAAC;gBACD,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;oBAClD,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACnC,CAAC;QACH,CAAC;QACD,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export interface WebhookBody {
|
|
2
|
+
object: string;
|
|
3
|
+
entry: Entry[];
|
|
4
|
+
}
|
|
5
|
+
export interface Entry {
|
|
6
|
+
id: string;
|
|
7
|
+
time: number;
|
|
8
|
+
uid: string;
|
|
9
|
+
changes: Change[];
|
|
10
|
+
}
|
|
11
|
+
export interface Change {
|
|
12
|
+
field: string;
|
|
13
|
+
value: MessageValue;
|
|
14
|
+
}
|
|
15
|
+
export interface MessageValue {
|
|
16
|
+
messaging_product: string;
|
|
17
|
+
metadata: {
|
|
18
|
+
display_phone_number: string;
|
|
19
|
+
phone_number_id: string;
|
|
20
|
+
};
|
|
21
|
+
contacts?: {
|
|
22
|
+
profile: {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
25
|
+
wa_id: string;
|
|
26
|
+
}[];
|
|
27
|
+
messages?: MessageBody[];
|
|
28
|
+
statuses?: StatusBody[];
|
|
29
|
+
errors?: unknown[];
|
|
30
|
+
}
|
|
31
|
+
export interface StatusBody {
|
|
32
|
+
id: string;
|
|
33
|
+
status: 'sent' | 'delivered' | 'read' | 'failed';
|
|
34
|
+
timestamp: string;
|
|
35
|
+
recipient_id: string;
|
|
36
|
+
errors?: {
|
|
37
|
+
code: number;
|
|
38
|
+
title?: string;
|
|
39
|
+
message?: string;
|
|
40
|
+
error_data?: {
|
|
41
|
+
details?: string;
|
|
42
|
+
};
|
|
43
|
+
}[];
|
|
44
|
+
}
|
|
45
|
+
export interface MessageBodyBase {
|
|
46
|
+
from: string;
|
|
47
|
+
id: string;
|
|
48
|
+
timestamp: string;
|
|
49
|
+
group_id?: string;
|
|
50
|
+
context?: {
|
|
51
|
+
from: string;
|
|
52
|
+
id: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface ReceivedMedia {
|
|
56
|
+
filename?: string;
|
|
57
|
+
caption?: string;
|
|
58
|
+
mime_type: string;
|
|
59
|
+
sha256: string;
|
|
60
|
+
id: string;
|
|
61
|
+
animated?: boolean;
|
|
62
|
+
voice?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface MessageBodyText extends MessageBodyBase {
|
|
65
|
+
type: 'text';
|
|
66
|
+
text: {
|
|
67
|
+
body: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface MessageBodyMedia extends MessageBodyBase {
|
|
71
|
+
type: 'image' | 'audio' | 'video' | 'document';
|
|
72
|
+
image?: ReceivedMedia;
|
|
73
|
+
audio?: ReceivedMedia;
|
|
74
|
+
video?: ReceivedMedia;
|
|
75
|
+
document?: ReceivedMedia;
|
|
76
|
+
}
|
|
77
|
+
export interface MessageBodySticker extends MessageBodyBase {
|
|
78
|
+
type: 'sticker';
|
|
79
|
+
sticker?: ReceivedMedia;
|
|
80
|
+
}
|
|
81
|
+
export interface MessageBodyLocation extends MessageBodyBase {
|
|
82
|
+
type: 'location';
|
|
83
|
+
location: {
|
|
84
|
+
latitude: number;
|
|
85
|
+
longitude: number;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export interface MessageBodyInteractive extends MessageBodyBase {
|
|
89
|
+
type: 'interactive';
|
|
90
|
+
interactive: {
|
|
91
|
+
type: 'button_reply';
|
|
92
|
+
button_reply: {
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
};
|
|
96
|
+
} | {
|
|
97
|
+
type: 'list_reply';
|
|
98
|
+
list_reply: {
|
|
99
|
+
id: string;
|
|
100
|
+
title: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export interface MessageBodyReaction extends MessageBodyBase {
|
|
105
|
+
type: 'reaction';
|
|
106
|
+
reaction: {
|
|
107
|
+
message_id: string;
|
|
108
|
+
emoji: string;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export interface MessageBodyButton extends MessageBodyBase {
|
|
112
|
+
type: 'button';
|
|
113
|
+
button: {
|
|
114
|
+
payload?: string;
|
|
115
|
+
text: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export interface MessageBodyContacts extends MessageBodyBase {
|
|
119
|
+
type: 'contacts';
|
|
120
|
+
contacts: {
|
|
121
|
+
name: {
|
|
122
|
+
formatted_name: string;
|
|
123
|
+
};
|
|
124
|
+
phones?: {
|
|
125
|
+
phone?: string;
|
|
126
|
+
wa_id?: string;
|
|
127
|
+
type?: string;
|
|
128
|
+
}[];
|
|
129
|
+
}[];
|
|
130
|
+
}
|
|
131
|
+
export interface MessageBodySystem extends MessageBodyBase {
|
|
132
|
+
type: 'system';
|
|
133
|
+
system: {
|
|
134
|
+
body: string;
|
|
135
|
+
type?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export type MessageBody = MessageBodyText | MessageBodyMedia | MessageBodySticker | MessageBodyLocation | MessageBodyInteractive | MessageBodyReaction | MessageBodyButton | MessageBodyContacts | MessageBodySystem;
|
|
139
|
+
export interface SendMessageBase {
|
|
140
|
+
messaging_product: 'whatsapp';
|
|
141
|
+
recipient_type: 'individual';
|
|
142
|
+
to: string;
|
|
143
|
+
context?: {
|
|
144
|
+
message_id: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export type SendMessage = SendTextMessage | SendMediaMessage<'image'> | SendMediaMessage<'audio'> | SendMediaMessage<'video'> | SendMediaMessage<'document'> | SendMediaMessage<'sticker'> | SendButtonMessage | SendReactionMessage;
|
|
148
|
+
export interface SendTextMessage extends SendMessageBase {
|
|
149
|
+
type: 'text';
|
|
150
|
+
text: {
|
|
151
|
+
body: string;
|
|
152
|
+
preview_url?: boolean;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export interface Button {
|
|
156
|
+
type: 'reply';
|
|
157
|
+
title: string;
|
|
158
|
+
id: string;
|
|
159
|
+
}
|
|
160
|
+
/** https://developers.facebook.com/docs/whatsapp/on-premises/reference/messages#interactive-object */
|
|
161
|
+
export interface SendButtonMessage extends SendMessageBase {
|
|
162
|
+
type: 'button';
|
|
163
|
+
header?: object;
|
|
164
|
+
body: {
|
|
165
|
+
text: string;
|
|
166
|
+
};
|
|
167
|
+
footer?: {
|
|
168
|
+
text: string;
|
|
169
|
+
};
|
|
170
|
+
action: {
|
|
171
|
+
buttons: Button[];
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export type MediaType = 'image' | 'audio' | 'video' | 'document' | 'sticker';
|
|
175
|
+
type MediaDetail = {
|
|
176
|
+
id?: string;
|
|
177
|
+
link?: string;
|
|
178
|
+
};
|
|
179
|
+
interface Media {
|
|
180
|
+
image?: MediaDetail;
|
|
181
|
+
audio?: MediaDetail;
|
|
182
|
+
video?: MediaDetail;
|
|
183
|
+
document?: MediaDetail;
|
|
184
|
+
sticker?: MediaDetail;
|
|
185
|
+
}
|
|
186
|
+
export interface SendMediaMessage<T extends MediaType> extends SendMessageBase, Media {
|
|
187
|
+
type: T;
|
|
188
|
+
}
|
|
189
|
+
/** https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-messages#reaction-messages */
|
|
190
|
+
export interface SendReactionMessage extends SendMessageBase {
|
|
191
|
+
type: 'reaction';
|
|
192
|
+
reaction: {
|
|
193
|
+
message_id: string;
|
|
194
|
+
emoji: string;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export {};
|
|
198
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,EAAE,CAAA;CACf;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,MAAM;IAGrB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,YAAY,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,QAAQ,EAAE;QACR,oBAAoB,EAAE,MAAM,CAAA;QAC5B,eAAe,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,QA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ources":["../../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@im-more/dsh-whatsapp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "WhatsApp adapter for official dsh-im of DeepSeek Harness",
|
|
5
|
+
"homepage": "https://github.com/ilharp/dsh-im-more",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/ilharp/dsh-im-more.git",
|
|
9
|
+
"directory": "packages/whatsapp"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Il Harper",
|
|
13
|
+
"email": "hi@ilharper.com",
|
|
14
|
+
"url": "https://ilharper.com"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "lib/index.js",
|
|
19
|
+
"types": "lib/types/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./lib/types/index.d.ts",
|
|
23
|
+
"default": "./lib/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json",
|
|
26
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib",
|
|
30
|
+
"src",
|
|
31
|
+
"cordis.patch.yml"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"dsh": ">=0.2.3-alpha.3"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@deepseek-ai/cordis": ">=4.2.0-alpha.2",
|
|
38
|
+
"@deepseek-ai/cordis-plugin-http": ">=1.6.1-alpha.2",
|
|
39
|
+
"@deepseek-ai/cordis-plugin-im-core": ">=5.0.1-alpha.2",
|
|
40
|
+
"@deepseek-ai/satori-element": ">=4.0.1-alpha.2",
|
|
41
|
+
"@deepseek-ai/schemastery": ">=3.20.0-alpha.2"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@deepseek-ai/cordis": ">=4.2.0-alpha.2",
|
|
45
|
+
"@deepseek-ai/cordis-plugin-http": ">=1.6.1-alpha.2",
|
|
46
|
+
"@deepseek-ai/cordis-plugin-im-core": ">=5.0.1-alpha.2",
|
|
47
|
+
"@deepseek-ai/satori-element": ">=4.0.1-alpha.2",
|
|
48
|
+
"@deepseek-ai/schemastery": ">=3.20.0-alpha.2",
|
|
49
|
+
"@types/node": "^22.20.1",
|
|
50
|
+
"tsdown": "^0.22.2",
|
|
51
|
+
"typescript": "^6.0.3",
|
|
52
|
+
"vitest": "^4.1.11"
|
|
53
|
+
},
|
|
54
|
+
"dsh": {
|
|
55
|
+
"bundle": {
|
|
56
|
+
"patch": "./cordis.patch.yml"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsc -p tsconfig.json && tsdown",
|
|
61
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
62
|
+
"test": "vitest run"
|
|
63
|
+
}
|
|
6
64
|
}
|