@gymspace/evolution 1.0.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/README.md +1273 -0
- package/dist/index.d.mts +1790 -0
- package/dist/index.d.ts +1790 -0
- package/dist/index.js +1091 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1077 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -0
- package/src/api/errors.ts +220 -0
- package/src/api/routes.ts +76 -0
- package/src/api/service.ts +141 -0
- package/src/index.ts +89 -0
- package/src/modules/chats/index.ts +253 -0
- package/src/modules/chats/schemas/archive.ts +15 -0
- package/src/modules/chats/schemas/check.ts +20 -0
- package/src/modules/chats/schemas/delete-message.ts +16 -0
- package/src/modules/chats/schemas/fetch-profile-picture.ts +13 -0
- package/src/modules/chats/schemas/find-all.ts +49 -0
- package/src/modules/chats/schemas/find-contacts.ts +17 -0
- package/src/modules/chats/schemas/find-messages.ts +55 -0
- package/src/modules/chats/schemas/find-status-message.ts +11 -0
- package/src/modules/chats/schemas/get-base64-from-media-message.ts +20 -0
- package/src/modules/chats/schemas/index.ts +33 -0
- package/src/modules/chats/schemas/mark-as-read.ts +20 -0
- package/src/modules/chats/schemas/mark-as-unread.ts +17 -0
- package/src/modules/chats/schemas/presence.ts +41 -0
- package/src/modules/chats/schemas/update-message.ts +16 -0
- package/src/modules/groups/index.ts +246 -0
- package/src/modules/groups/schemas/accept-invite-code.ts +14 -0
- package/src/modules/groups/schemas/common.ts +89 -0
- package/src/modules/groups/schemas/create.ts +15 -0
- package/src/modules/groups/schemas/fetch-invite-code.ts +13 -0
- package/src/modules/groups/schemas/find-all.ts +26 -0
- package/src/modules/groups/schemas/find-by-invite-code.ts +39 -0
- package/src/modules/groups/schemas/find-by-jid.ts +14 -0
- package/src/modules/groups/schemas/find-members.ts +16 -0
- package/src/modules/groups/schemas/index.ts +24 -0
- package/src/modules/groups/schemas/leave.ts +14 -0
- package/src/modules/groups/schemas/revoke-invite-code.ts +14 -0
- package/src/modules/groups/schemas/send-group-invite.ts +15 -0
- package/src/modules/groups/schemas/toggle-ephemeral.ts +15 -0
- package/src/modules/groups/schemas/update-description.ts +15 -0
- package/src/modules/groups/schemas/update-members.ts +18 -0
- package/src/modules/groups/schemas/update-picture.ts +15 -0
- package/src/modules/groups/schemas/update-setting.ts +16 -0
- package/src/modules/groups/schemas/update-subject.ts +15 -0
- package/src/modules/index.ts +7 -0
- package/src/modules/instance/index.ts +126 -0
- package/src/modules/instance/schemas/connect.ts +14 -0
- package/src/modules/instance/schemas/connection-state.ts +16 -0
- package/src/modules/instance/schemas/create.ts +99 -0
- package/src/modules/instance/schemas/delete.ts +21 -0
- package/src/modules/instance/schemas/fetch-all.ts +57 -0
- package/src/modules/instance/schemas/index.ts +8 -0
- package/src/modules/instance/schemas/logout.ts +22 -0
- package/src/modules/instance/schemas/restart.ts +13 -0
- package/src/modules/instance/schemas/set-presence.ts +20 -0
- package/src/modules/messages/index.ts +246 -0
- package/src/modules/messages/schemas/audio.ts +12 -0
- package/src/modules/messages/schemas/base.ts +11 -0
- package/src/modules/messages/schemas/contact.ts +70 -0
- package/src/modules/messages/schemas/document.ts +12 -0
- package/src/modules/messages/schemas/image.ts +12 -0
- package/src/modules/messages/schemas/index.ts +31 -0
- package/src/modules/messages/schemas/list.ts +36 -0
- package/src/modules/messages/schemas/location.ts +76 -0
- package/src/modules/messages/schemas/media.ts +51 -0
- package/src/modules/messages/schemas/poll.ts +87 -0
- package/src/modules/messages/schemas/reaction.ts +21 -0
- package/src/modules/messages/schemas/status.ts +18 -0
- package/src/modules/messages/schemas/sticker.ts +77 -0
- package/src/modules/messages/schemas/template.ts +39 -0
- package/src/modules/messages/schemas/text.ts +88 -0
- package/src/modules/messages/schemas/video.ts +12 -0
- package/src/modules/messages/schemas/voice.ts +94 -0
- package/src/modules/profile/index.ts +110 -0
- package/src/modules/profile/schemas/fetch-business-profile.ts +29 -0
- package/src/modules/profile/schemas/fetch-privacy-settings.ts +11 -0
- package/src/modules/profile/schemas/fetch-profile.ts +23 -0
- package/src/modules/profile/schemas/index.ts +8 -0
- package/src/modules/profile/schemas/remove-picture.ts +4 -0
- package/src/modules/profile/schemas/update-name.ts +11 -0
- package/src/modules/profile/schemas/update-picture.ts +11 -0
- package/src/modules/profile/schemas/update-privacy-settings.ts +18 -0
- package/src/modules/profile/schemas/update-status.ts +11 -0
- package/src/modules/settings/index.ts +28 -0
- package/src/modules/settings/schemas/find.ts +11 -0
- package/src/modules/settings/schemas/index.ts +2 -0
- package/src/modules/settings/schemas/set.ts +18 -0
- package/src/modules/webhook/index.ts +28 -0
- package/src/modules/webhook/schemas/find.ts +7 -0
- package/src/modules/webhook/schemas/index.ts +2 -0
- package/src/modules/webhook/schemas/set.ts +16 -0
- package/src/schemas/client.ts +23 -0
- package/src/schemas/common.ts +44 -0
- package/src/types/api.ts +17 -0
- package/src/types/events.ts +53 -0
- package/src/types/messages.ts +5 -0
- package/src/types/tags.ts +14 -0
- package/src/types/webhooks.ts +255 -0
- package/src/utils/phone-numer-from-jid.ts +9 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the Evolution API client
|
|
5
|
+
*/
|
|
6
|
+
export interface ClientOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Your server URL
|
|
9
|
+
*/
|
|
10
|
+
serverUrl: string;
|
|
11
|
+
/**
|
|
12
|
+
* Your instance token or global API key
|
|
13
|
+
*/
|
|
14
|
+
token: string;
|
|
15
|
+
/**
|
|
16
|
+
* Your instance name
|
|
17
|
+
*/
|
|
18
|
+
instance?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Custom headers to include in requests
|
|
21
|
+
*/
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Pure TypeScript types and utility functions for better IDE support and performance
|
|
2
|
+
import { isValidPhoneNumber, parsePhoneNumber } from "libphonenumber-js";
|
|
3
|
+
import type { GroupInviteCode, GroupJid, Jid } from "@/types/tags";
|
|
4
|
+
|
|
5
|
+
// Type definitions
|
|
6
|
+
export type PhoneNumber = string;
|
|
7
|
+
export type MessageId = string;
|
|
8
|
+
export type ChatId = PhoneNumber | Jid | GroupJid;
|
|
9
|
+
export type ApiNumber = PhoneNumber | Jid | GroupJid;
|
|
10
|
+
export type Media = string; // URL or base64 string
|
|
11
|
+
|
|
12
|
+
// Utility functions
|
|
13
|
+
export const validatePhoneNumber = (value: string): boolean => isValidPhoneNumber(value);
|
|
14
|
+
export const parsePhoneNumberUtil = (phoneNumber: string): string => parsePhoneNumber(phoneNumber).number;
|
|
15
|
+
|
|
16
|
+
export const validateJid = (value: string): boolean => value.endsWith("@s.whatsapp.net");
|
|
17
|
+
export const validateGroupJid = (value: string): boolean => value.endsWith("@g.us");
|
|
18
|
+
export const validateGroupInviteCode = (value: string): boolean =>
|
|
19
|
+
value.length === 22 && /^[a-zA-Z0-9]{22}$/.test(value);
|
|
20
|
+
|
|
21
|
+
export const validateMedia = (value: string): boolean => {
|
|
22
|
+
// Check if it's a URL or base64 string
|
|
23
|
+
try {
|
|
24
|
+
new URL(value);
|
|
25
|
+
return true;
|
|
26
|
+
} catch {
|
|
27
|
+
// Check if it's a valid base64 string
|
|
28
|
+
try {
|
|
29
|
+
return btoa(atob(value)) === value;
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Backward compatibility - keeping the schema names but as type aliases
|
|
37
|
+
export type PhoneNumberSchema = PhoneNumber;
|
|
38
|
+
export type JidSchema = Jid;
|
|
39
|
+
export type GroupJidSchema = GroupJid;
|
|
40
|
+
export type GroupInviteCodeSchema = GroupInviteCode;
|
|
41
|
+
export type MessageIdSchema = MessageId;
|
|
42
|
+
export type ChatIdSchema = ChatId;
|
|
43
|
+
export type ApiNumberSchema = ApiNumber;
|
|
44
|
+
export type mediaSchema = Media;
|
package/src/types/api.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Internal interface used by the service
|
|
2
|
+
export interface APIRequestInit {
|
|
3
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
4
|
+
params?: any; // Accept any object type for params
|
|
5
|
+
body?: any; // Accept any object type for body
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
isInstanceUrl?: boolean;
|
|
8
|
+
instance?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Public interface for method options that users can pass
|
|
12
|
+
export interface MethodOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Instance name to use for this request (overrides default instance)
|
|
15
|
+
*/
|
|
16
|
+
instance?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export enum WebhookEvent {
|
|
2
|
+
APPLICATION_STARTUP = "application.startup",
|
|
3
|
+
QRCODE_UPDATED = "qrcode.updated",
|
|
4
|
+
CONNECTION_UPDATE = "connection.update",
|
|
5
|
+
MESSAGES_SET = "messages.set",
|
|
6
|
+
MESSAGES_UPSERT = "messages.upsert",
|
|
7
|
+
MESSAGES_UPDATE = "messages.update",
|
|
8
|
+
MESSAGES_DELETE = "messages.delete",
|
|
9
|
+
SEND_MESSAGE = "send.message",
|
|
10
|
+
CONTACTS_SET = "contacts.set",
|
|
11
|
+
CONTACTS_UPSERT = "contacts.upsert",
|
|
12
|
+
CONTACTS_UPDATE = "contacts.update",
|
|
13
|
+
PRESENCE_UPDATE = "presence.update",
|
|
14
|
+
CHATS_SET = "chats.set",
|
|
15
|
+
CHATS_UPDATE = "chats.update",
|
|
16
|
+
CHATS_UPSERT = "chats.upsert",
|
|
17
|
+
CHATS_DELETE = "chats.delete",
|
|
18
|
+
GROUPS_UPSERT = "groups.upsert",
|
|
19
|
+
GROUPS_UPDATE = "groups.update",
|
|
20
|
+
GROUP_PARTICIPANTS_UPDATE = "group.participants.update",
|
|
21
|
+
NEW_TOKEN = "new.jwt",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum WebhookEventSetup {
|
|
25
|
+
APPLICATION_STARTUP = "APPLICATION_STARTUP",
|
|
26
|
+
QRCODE_UPDATED = "QRCODE_UPDATED",
|
|
27
|
+
CONNECTION_UPDATE = "CONNECTION_UPDATE",
|
|
28
|
+
MESSAGES_SET = "MESSAGES_SET",
|
|
29
|
+
MESSAGES_UPSERT = "MESSAGES_UPSERT",
|
|
30
|
+
MESSAGES_UPDATE = "MESSAGES_UPDATE",
|
|
31
|
+
MESSAGES_DELETE = "MESSAGES_DELETE",
|
|
32
|
+
SEND_MESSAGE = "SEND_MESSAGE",
|
|
33
|
+
CONTACTS_SET = "CONTACTS_SET",
|
|
34
|
+
CONTACTS_UPSERT = "CONTACTS_UPSERT",
|
|
35
|
+
CONTACTS_UPDATE = "CONTACTS_UPDATE",
|
|
36
|
+
PRESENCE_UPDATE = "PRESENCE_UPDATE",
|
|
37
|
+
CHATS_SET = "CHATS_SET",
|
|
38
|
+
CHATS_UPDATE = "CHATS_UPDATE",
|
|
39
|
+
CHATS_UPSERT = "CHATS_UPSERT",
|
|
40
|
+
CHATS_DELETE = "CHATS_DELETE",
|
|
41
|
+
GROUPS_UPSERT = "GROUPS_UPSERT",
|
|
42
|
+
GROUPS_UPDATE = "GROUPS_UPDATE",
|
|
43
|
+
GROUP_PARTICIPANTS_UPDATE = "GROUP_PARTICIPANTS_UPDATE",
|
|
44
|
+
NEW_TOKEN = "NEW_TOKEN",
|
|
45
|
+
MESSAGES_EDITED = "MESSAGES_EDITED",
|
|
46
|
+
LABELS_EDIT = "LABELS_EDIT",
|
|
47
|
+
LABELS_ASSOCIATION = "LABELS_ASSOCIATION",
|
|
48
|
+
CALL = "CALL",
|
|
49
|
+
TYPEBOT_START = "TYPEBOT_START",
|
|
50
|
+
TYPEBOT_CHANGE_STATUS = "TYPEBOT_CHANGE_STATUS",
|
|
51
|
+
ERRORS = "ERRORS",
|
|
52
|
+
ERRORS_WEBHOOK = "ERRORS_WEBHOOK",
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Jid = `${string}@s.whatsapp.net` | string;
|
|
2
|
+
export const Jid = (jid: string) => jid as Jid;
|
|
3
|
+
|
|
4
|
+
export type GroupJid = `${string}@g.us` | string;
|
|
5
|
+
export const GroupJid = (jid: string) => jid as GroupJid;
|
|
6
|
+
|
|
7
|
+
export type GroupInviteCode = string & { __tag: "GroupInviteCode" };
|
|
8
|
+
export const GroupInviteCode = (code: string) => code as GroupInviteCode;
|
|
9
|
+
|
|
10
|
+
export type MessageId = string & { __tag: "MessageId" };
|
|
11
|
+
export const MessageId = (id: string) => id as MessageId;
|
|
12
|
+
|
|
13
|
+
export type ChatId = string & { __tag: "ChatId" };
|
|
14
|
+
export const ChatId = (id: string) => id as ChatId;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { MessageUpdateStatus } from "./messages";
|
|
2
|
+
|
|
3
|
+
export enum ConnectionState {
|
|
4
|
+
OPEN = "open",
|
|
5
|
+
CONNECTING = "connecting",
|
|
6
|
+
CLOSED = "close",
|
|
7
|
+
REFUSED = "refused",
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum MessageType {
|
|
11
|
+
CONVERSATION = "conversation",
|
|
12
|
+
TEXT = "textMessage",
|
|
13
|
+
EPHEMERAL = "ephemeralMessage",
|
|
14
|
+
AUDIO = "audioMessage",
|
|
15
|
+
IMAGE = "imageMessage",
|
|
16
|
+
VIDEO = "videoMessage",
|
|
17
|
+
DOCUMENT = "documentMessage",
|
|
18
|
+
STICKER = "stickerMessage",
|
|
19
|
+
CONTACT = "contactMessage",
|
|
20
|
+
LOCATION = "locationMessage",
|
|
21
|
+
REACTION = "reactionMessage",
|
|
22
|
+
BUTTONS = "buttonsMessage",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface DeviceListMetadata {
|
|
26
|
+
senderKeyHash: string;
|
|
27
|
+
senderTimestamp: string;
|
|
28
|
+
recipientKeyHash: string;
|
|
29
|
+
recipientTimestamp: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MessageContextInfo {
|
|
33
|
+
deviceListMetadata?: DeviceListMetadata | Record<string, unknown>;
|
|
34
|
+
deviceListMetadataVersion: number;
|
|
35
|
+
messageSecret: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DisappearingMode {
|
|
39
|
+
initiator: string;
|
|
40
|
+
trigger: string;
|
|
41
|
+
initiatedByMe: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ContextInfo {
|
|
45
|
+
expiration?: number;
|
|
46
|
+
ephemeralSettingTimestamp?: string;
|
|
47
|
+
disappearingMode?: DisappearingMode;
|
|
48
|
+
stanzaId?: string;
|
|
49
|
+
participant?: string;
|
|
50
|
+
quotedMessage?: {
|
|
51
|
+
conversation?: string;
|
|
52
|
+
};
|
|
53
|
+
statusSourceType?: string;
|
|
54
|
+
forwardingScore?: number;
|
|
55
|
+
isForwarded?: boolean;
|
|
56
|
+
pairedMediaType?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface ImageMessage {
|
|
60
|
+
url: string;
|
|
61
|
+
mimetype: string;
|
|
62
|
+
fileSha256: string;
|
|
63
|
+
fileLength: string;
|
|
64
|
+
height: number;
|
|
65
|
+
width: number;
|
|
66
|
+
mediaKey: string;
|
|
67
|
+
fileEncSha256: string;
|
|
68
|
+
directPath: string;
|
|
69
|
+
mediaKeyTimestamp: string;
|
|
70
|
+
jpegThumbnail: string;
|
|
71
|
+
contextInfo?: ContextInfo;
|
|
72
|
+
firstScanSidecar: string;
|
|
73
|
+
firstScanLength: number;
|
|
74
|
+
scansSidecar: string;
|
|
75
|
+
scanLengths: number[];
|
|
76
|
+
midQualityFileSha256: string;
|
|
77
|
+
imageSourceType: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface AudioMessage {
|
|
81
|
+
url: string;
|
|
82
|
+
mimetype: string;
|
|
83
|
+
fileSha256: string;
|
|
84
|
+
fileLength: string;
|
|
85
|
+
seconds: number;
|
|
86
|
+
ptt: boolean;
|
|
87
|
+
mediaKey: string;
|
|
88
|
+
fileEncSha256: string;
|
|
89
|
+
directPath: string;
|
|
90
|
+
mediaKeyTimestamp: string;
|
|
91
|
+
waveform: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface StickerMessage {
|
|
95
|
+
url: string;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
isAvatar: boolean;
|
|
99
|
+
isLottie: boolean;
|
|
100
|
+
mediaKey: string;
|
|
101
|
+
mimetype: string;
|
|
102
|
+
directPath: string;
|
|
103
|
+
fileLength: string;
|
|
104
|
+
fileSha256: string;
|
|
105
|
+
isAnimated: boolean;
|
|
106
|
+
isAiSticker: boolean;
|
|
107
|
+
fileEncSha256: string;
|
|
108
|
+
stickerSentTs: string;
|
|
109
|
+
mediaKeyTimestamp: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface VideoMessage {
|
|
113
|
+
url: string;
|
|
114
|
+
mimetype: string;
|
|
115
|
+
fileSha256: string;
|
|
116
|
+
fileLength: string;
|
|
117
|
+
seconds: number;
|
|
118
|
+
mediaKey: string;
|
|
119
|
+
height: number;
|
|
120
|
+
width: number;
|
|
121
|
+
fileEncSha256: string;
|
|
122
|
+
directPath: string;
|
|
123
|
+
mediaKeyTimestamp: string;
|
|
124
|
+
jpegThumbnail: string;
|
|
125
|
+
contextInfo?: ContextInfo;
|
|
126
|
+
streamingSidecar: string;
|
|
127
|
+
externalShareFullVideoDurationInSeconds: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ReactionMessage {
|
|
131
|
+
key: {
|
|
132
|
+
remoteJid: string;
|
|
133
|
+
fromMe: boolean;
|
|
134
|
+
id: string;
|
|
135
|
+
};
|
|
136
|
+
text: string;
|
|
137
|
+
senderTimestampMs: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface DocumentMessage {
|
|
141
|
+
url: string;
|
|
142
|
+
mimetype: string;
|
|
143
|
+
fileSha256: string;
|
|
144
|
+
fileLength: string;
|
|
145
|
+
pageCount: number;
|
|
146
|
+
mediaKey: string;
|
|
147
|
+
fileName: string;
|
|
148
|
+
fileEncSha256: string;
|
|
149
|
+
directPath: string;
|
|
150
|
+
mediaKeyTimestamp: string;
|
|
151
|
+
contextInfo: ContextInfo;
|
|
152
|
+
caption: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ContactMessage {
|
|
156
|
+
displayName: string;
|
|
157
|
+
vcard: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ExtendedTextMessage {
|
|
161
|
+
text: string;
|
|
162
|
+
contextInfo?: ContextInfo;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export type MessageContent = {
|
|
166
|
+
messageContextInfo?: MessageContextInfo;
|
|
167
|
+
conversation?: string;
|
|
168
|
+
extendedTextMessage?: ExtendedTextMessage;
|
|
169
|
+
imageMessage?: ImageMessage;
|
|
170
|
+
audioMessage?: AudioMessage;
|
|
171
|
+
stickerMessage?: StickerMessage;
|
|
172
|
+
ephemeralMessage?: EphemeralMessage;
|
|
173
|
+
videoMessage?: VideoMessage;
|
|
174
|
+
documentMessage?: DocumentMessage;
|
|
175
|
+
contactMessage?: ContactMessage;
|
|
176
|
+
locationMessage?: any;
|
|
177
|
+
reactionMessage?: ReactionMessage;
|
|
178
|
+
buttonsMessage?: any;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export interface MessageUpdate {
|
|
182
|
+
status: MessageUpdateStatus;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface ConnectionUpdatePayload {
|
|
186
|
+
instance: string;
|
|
187
|
+
wuid?: string;
|
|
188
|
+
profileName?: string;
|
|
189
|
+
profilePictureUrl?: string | null;
|
|
190
|
+
state: ConnectionState;
|
|
191
|
+
statusReason: number;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface ContactPayload {
|
|
195
|
+
remoteJid: string;
|
|
196
|
+
pushName: string;
|
|
197
|
+
profilePicUrl: string | null;
|
|
198
|
+
instanceId: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface EphemeralMessage {
|
|
202
|
+
message: MessageContent;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface MessagePayload {
|
|
206
|
+
key: {
|
|
207
|
+
remoteJid: string;
|
|
208
|
+
fromMe: boolean;
|
|
209
|
+
id: string;
|
|
210
|
+
senderLid?: string;
|
|
211
|
+
};
|
|
212
|
+
pushName?: string;
|
|
213
|
+
message?: MessageContent;
|
|
214
|
+
messageType?: MessageType;
|
|
215
|
+
messageTimestamp?: number;
|
|
216
|
+
status?: string;
|
|
217
|
+
participant?: string;
|
|
218
|
+
contextInfo?: ContextInfo;
|
|
219
|
+
instanceId?: string;
|
|
220
|
+
source?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface WebhookData {
|
|
224
|
+
event: string;
|
|
225
|
+
instance: string;
|
|
226
|
+
data:
|
|
227
|
+
| MessagePayload
|
|
228
|
+
| ContactPayload
|
|
229
|
+
| ContactPayload[]
|
|
230
|
+
| ConnectionUpdatePayload;
|
|
231
|
+
sender: string;
|
|
232
|
+
date?: number;
|
|
233
|
+
instanceName?: string;
|
|
234
|
+
destination?: string;
|
|
235
|
+
date_time?: string;
|
|
236
|
+
server_url?: string;
|
|
237
|
+
apikey?: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface Instance {
|
|
241
|
+
instanceName: string;
|
|
242
|
+
status: string;
|
|
243
|
+
qrcode?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface Message {
|
|
247
|
+
key: {
|
|
248
|
+
remoteJid: string;
|
|
249
|
+
fromMe: boolean;
|
|
250
|
+
id: string;
|
|
251
|
+
};
|
|
252
|
+
message: Record<string, unknown>;
|
|
253
|
+
messageTimestamp: number;
|
|
254
|
+
pushName?: string;
|
|
255
|
+
}
|