core-services-sdk 1.3.49 → 1.3.51
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/package.json +1 -1
- package/src/ids/generators.js +86 -173
- package/src/ids/prefixes.js +61 -65
- package/src/instant-messages/index.js +2 -0
- package/src/instant-messages/telegram-apis/telegram-apis.js +301 -0
- package/src/instant-messages/whatsapp-apis/whatsapp-apis.js +401 -0
- package/tests/ids/generators.unit.test.js +65 -1
- package/tests/ids/prefixes.unit.test.js +30 -21
- package/tests/instant-messages/telegram-apis.unit.test.js +157 -0
- package/tests/instant-messages/whatsapp-apis.unit.test.js +277 -0
- package/types/instant-messages/index.d.ts +2 -0
- package/types/instant-messages/telegram-apis/telegram-apis.d.ts +105 -0
- package/types/instant-messages/whatsapp-apis/whatsapp-apis.d.ts +73 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export function getWhatsAppMediaInfo({
|
|
2
|
+
token,
|
|
3
|
+
mediaId,
|
|
4
|
+
version,
|
|
5
|
+
baseUrl,
|
|
6
|
+
}: {
|
|
7
|
+
mediaId: string
|
|
8
|
+
token: string
|
|
9
|
+
version?: string
|
|
10
|
+
}): Promise<any>
|
|
11
|
+
export function downloadWhatsAppMedia({
|
|
12
|
+
token,
|
|
13
|
+
mediaId,
|
|
14
|
+
mode,
|
|
15
|
+
}: {
|
|
16
|
+
mediaId: string
|
|
17
|
+
token: string
|
|
18
|
+
mode: 'buffer' | 'stream'
|
|
19
|
+
}): Promise<Buffer | ReadableStream>
|
|
20
|
+
export function getWhatsAppApiUrls({
|
|
21
|
+
phoneNumberId,
|
|
22
|
+
version,
|
|
23
|
+
baseUrl,
|
|
24
|
+
}: {
|
|
25
|
+
phoneNumberId: string
|
|
26
|
+
version?: string
|
|
27
|
+
baseUrl?: string
|
|
28
|
+
}): string
|
|
29
|
+
export function whatsappApis({
|
|
30
|
+
token,
|
|
31
|
+
phoneNumberId,
|
|
32
|
+
version,
|
|
33
|
+
}: {
|
|
34
|
+
token: string
|
|
35
|
+
phoneNumberId: string
|
|
36
|
+
version?: string
|
|
37
|
+
}): WhatsAppApis
|
|
38
|
+
/**
|
|
39
|
+
* Factory that creates WhatsApp Cloud API helper methods.
|
|
40
|
+
*
|
|
41
|
+
* This module wraps the WhatsApp Graph API endpoints and exposes
|
|
42
|
+
* high level functions for sending text messages, interactive buttons,
|
|
43
|
+
* images, videos, documents, and audio files.
|
|
44
|
+
*
|
|
45
|
+
* Each returned method builds the correct request format according
|
|
46
|
+
* to the WhatsApp Cloud API specification.
|
|
47
|
+
*/
|
|
48
|
+
export type WhatsAppApis = {
|
|
49
|
+
/**
|
|
50
|
+
* Sends a plain text message to an individual WhatsApp user.
|
|
51
|
+
*/
|
|
52
|
+
sendMessage: Function
|
|
53
|
+
/**
|
|
54
|
+
* Sends an interactive message containing buttons.
|
|
55
|
+
*/
|
|
56
|
+
sendButtonsGroup: Function
|
|
57
|
+
/**
|
|
58
|
+
* Sends an image message using a public URL.
|
|
59
|
+
*/
|
|
60
|
+
sendPhoto: Function
|
|
61
|
+
/**
|
|
62
|
+
* Sends a video file using a public URL.
|
|
63
|
+
*/
|
|
64
|
+
sendVideo: Function
|
|
65
|
+
/**
|
|
66
|
+
* Sends a document message using a public URL.
|
|
67
|
+
*/
|
|
68
|
+
sendDocument: Function
|
|
69
|
+
/**
|
|
70
|
+
* Sends an audio file using a public URL.
|
|
71
|
+
*/
|
|
72
|
+
sendAudio: Function
|
|
73
|
+
}
|