@zapyapi/sdk 1.0.0-beta.1
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 +308 -0
- package/index.cjs +1176 -0
- package/index.js +1149 -0
- package/package.json +55 -0
- package/src/client.d.ts +98 -0
- package/src/client.d.ts.map +1 -0
- package/src/errors.d.ts +70 -0
- package/src/errors.d.ts.map +1 -0
- package/src/generated/Api.d.ts +1542 -0
- package/src/generated/Api.d.ts.map +1 -0
- package/src/index.d.ts +38 -0
- package/src/index.d.ts.map +1 -0
- package/src/resources/base.resource.d.ts +17 -0
- package/src/resources/base.resource.d.ts.map +1 -0
- package/src/resources/index.d.ts +8 -0
- package/src/resources/index.d.ts.map +1 -0
- package/src/resources/instances.resource.d.ts +75 -0
- package/src/resources/instances.resource.d.ts.map +1 -0
- package/src/resources/messages.resource.d.ts +159 -0
- package/src/resources/messages.resource.d.ts.map +1 -0
- package/src/resources/webhooks.resource.d.ts +115 -0
- package/src/resources/webhooks.resource.d.ts.map +1 -0
- package/src/types/common.types.d.ts +89 -0
- package/src/types/common.types.d.ts.map +1 -0
- package/src/types/enums.d.ts +142 -0
- package/src/types/enums.d.ts.map +1 -0
- package/src/types/index.d.ts +11 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/instances.types.d.ts +114 -0
- package/src/types/instances.types.d.ts.map +1 -0
- package/src/types/messages.types.d.ts +166 -0
- package/src/types/messages.types.d.ts.map +1 -0
- package/src/types/webhook-config.types.d.ts +60 -0
- package/src/types/webhook-config.types.d.ts.map +1 -0
- package/src/types/webhook-events.types.d.ts +232 -0
- package/src/types/webhook-events.types.d.ts.map +1 -0
- package/src/utils/index.d.ts +6 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/phone.d.ts +38 -0
- package/src/utils/phone.d.ts.map +1 -0
- package/src/utils/webhook-signature.d.ts +69 -0
- package/src/utils/webhook-signature.d.ts.map +1 -0
- package/src/version.d.ts +3 -0
- package/src/version.d.ts.map +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Enums - Type-safe enums for ZapyAPI SDK
|
|
3
|
+
*
|
|
4
|
+
* These enums can be imported and used for type-safe comparisons and
|
|
5
|
+
* webhook event handling.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { WebhookEventType, InstanceStatus, MessageAckStatus } from '@zapyapi/sdk';
|
|
10
|
+
*
|
|
11
|
+
* // Type-safe event handling
|
|
12
|
+
* if (event.event === WebhookEventType.MESSAGE) {
|
|
13
|
+
* // Handle message event
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* // Check instance status
|
|
17
|
+
* if (instance.status === InstanceStatus.CONNECTED) {
|
|
18
|
+
* // Instance is ready
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Webhook event types sent by ZapyAPI
|
|
24
|
+
* These are the event types you'll receive in webhook payloads
|
|
25
|
+
*/
|
|
26
|
+
export declare const WebhookEventType: {
|
|
27
|
+
/** New message received */
|
|
28
|
+
readonly MESSAGE: "message";
|
|
29
|
+
/** Message delivery status update */
|
|
30
|
+
readonly MESSAGE_STATUS: "message-status";
|
|
31
|
+
/** QR code generated for authentication */
|
|
32
|
+
readonly QR_CODE: "qr-code";
|
|
33
|
+
/** New contact discovered */
|
|
34
|
+
readonly CONTACT_CREATED: "contact-created";
|
|
35
|
+
/** Contact information updated */
|
|
36
|
+
readonly CONTACT_UPDATED: "contact-updated";
|
|
37
|
+
/** Duplicate contacts merged */
|
|
38
|
+
readonly CONTACT_DEDUPLICATED: "contact-deduplicated";
|
|
39
|
+
};
|
|
40
|
+
export type WebhookEventType = (typeof WebhookEventType)[keyof typeof WebhookEventType];
|
|
41
|
+
/**
|
|
42
|
+
* Instance status values
|
|
43
|
+
* Represents the current state of a WhatsApp instance
|
|
44
|
+
*/
|
|
45
|
+
export declare const InstanceStatus: {
|
|
46
|
+
/** Instance is stopped */
|
|
47
|
+
readonly STOPPED: "stopped";
|
|
48
|
+
/** Instance was manually stopped by user */
|
|
49
|
+
readonly MANUALLY_STOPPED: "manually_stopped";
|
|
50
|
+
/** Instance is connecting to WhatsApp */
|
|
51
|
+
readonly CONNECTING: "connecting";
|
|
52
|
+
/** Waiting for QR code to be scanned */
|
|
53
|
+
readonly PENDING_QR_CODE_SCAN: "pending_qr_code_scan";
|
|
54
|
+
/** Instance is connected and ready */
|
|
55
|
+
readonly CONNECTED: "connected";
|
|
56
|
+
/** Instance encountered an error */
|
|
57
|
+
readonly ERROR: "error";
|
|
58
|
+
/** Instance was just created */
|
|
59
|
+
readonly CREATED: "created";
|
|
60
|
+
/** QR code scanning timed out */
|
|
61
|
+
readonly QR_TIMEOUT: "qr_timeout";
|
|
62
|
+
/** Payment pending for this instance */
|
|
63
|
+
readonly PAYMENT_PENDING: "payment_pending";
|
|
64
|
+
};
|
|
65
|
+
export type InstanceStatus = (typeof InstanceStatus)[keyof typeof InstanceStatus];
|
|
66
|
+
/**
|
|
67
|
+
* Message acknowledgment status
|
|
68
|
+
* Represents the delivery status of a sent message
|
|
69
|
+
*/
|
|
70
|
+
export declare const MessageAckStatus: {
|
|
71
|
+
/** Message is pending to be sent */
|
|
72
|
+
readonly PENDING: "pending";
|
|
73
|
+
/** Message was sent to server */
|
|
74
|
+
readonly SENT: "sent";
|
|
75
|
+
/** Message was delivered to recipient */
|
|
76
|
+
readonly DELIVERED: "delivered";
|
|
77
|
+
/** Message was read by recipient */
|
|
78
|
+
readonly READ: "read";
|
|
79
|
+
/** Audio/video message was played */
|
|
80
|
+
readonly PLAYED: "played";
|
|
81
|
+
};
|
|
82
|
+
export type MessageAckStatus = (typeof MessageAckStatus)[keyof typeof MessageAckStatus];
|
|
83
|
+
/**
|
|
84
|
+
* Message types for incoming messages
|
|
85
|
+
* Identifies the type of content in a received message
|
|
86
|
+
*/
|
|
87
|
+
export declare const MessageType: {
|
|
88
|
+
/** Text message */
|
|
89
|
+
readonly TEXT: "text";
|
|
90
|
+
/** Image message */
|
|
91
|
+
readonly IMAGE: "image";
|
|
92
|
+
/** Video message */
|
|
93
|
+
readonly VIDEO: "video";
|
|
94
|
+
/** Audio message (voice note or file) */
|
|
95
|
+
readonly AUDIO: "audio";
|
|
96
|
+
/** Document/file message */
|
|
97
|
+
readonly DOCUMENT: "document";
|
|
98
|
+
/** Sticker message */
|
|
99
|
+
readonly STICKER: "sticker";
|
|
100
|
+
/** Location message */
|
|
101
|
+
readonly LOCATION: "location";
|
|
102
|
+
/** Contact card message */
|
|
103
|
+
readonly CONTACT: "contact";
|
|
104
|
+
/** Poll message */
|
|
105
|
+
readonly POLL: "poll";
|
|
106
|
+
/** Reaction message */
|
|
107
|
+
readonly REACTION: "reaction";
|
|
108
|
+
};
|
|
109
|
+
export type MessageType = (typeof MessageType)[keyof typeof MessageType];
|
|
110
|
+
/**
|
|
111
|
+
* Webhook queue item status
|
|
112
|
+
* Used for monitoring webhook delivery status
|
|
113
|
+
*/
|
|
114
|
+
export declare const WebhookQueueStatus: {
|
|
115
|
+
/** Webhook is queued for delivery */
|
|
116
|
+
readonly PENDING: "pending";
|
|
117
|
+
/** Webhook is being processed */
|
|
118
|
+
readonly PROCESSING: "processing";
|
|
119
|
+
/** Webhook was successfully delivered */
|
|
120
|
+
readonly DELIVERED: "delivered";
|
|
121
|
+
/** Webhook delivery failed after retries */
|
|
122
|
+
readonly FAILED: "failed";
|
|
123
|
+
/** Webhook delivery is paused due to repeated failures */
|
|
124
|
+
readonly PAUSED: "paused";
|
|
125
|
+
};
|
|
126
|
+
export type WebhookQueueStatus = (typeof WebhookQueueStatus)[keyof typeof WebhookQueueStatus];
|
|
127
|
+
/**
|
|
128
|
+
* Connection status for webhook events
|
|
129
|
+
* Sent in connection.update webhook events
|
|
130
|
+
*/
|
|
131
|
+
export declare const ConnectionStatus: {
|
|
132
|
+
/** Instance is connecting */
|
|
133
|
+
readonly CONNECTING: "connecting";
|
|
134
|
+
/** Instance is connected */
|
|
135
|
+
readonly CONNECTED: "connected";
|
|
136
|
+
/** Instance disconnected */
|
|
137
|
+
readonly DISCONNECTED: "disconnected";
|
|
138
|
+
/** Connection error occurred */
|
|
139
|
+
readonly ERROR: "error";
|
|
140
|
+
};
|
|
141
|
+
export type ConnectionStatus = (typeof ConnectionStatus)[keyof typeof ConnectionStatus];
|
|
142
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk/src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,2BAA2B;;IAE3B,qCAAqC;;IAErC,2CAA2C;;IAE3C,6BAA6B;;IAE7B,kCAAkC;;IAElC,gCAAgC;;CAExB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,0BAA0B;;IAE1B,4CAA4C;;IAE5C,yCAAyC;;IAEzC,wCAAwC;;IAExC,sCAAsC;;IAEtC,oCAAoC;;IAEpC,gCAAgC;;IAEhC,iCAAiC;;IAEjC,wCAAwC;;CAEhC,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,oCAAoC;;IAEpC,iCAAiC;;IAEjC,yCAAyC;;IAEzC,oCAAoC;;IAEpC,qCAAqC;;CAE7B,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB,mBAAmB;;IAEnB,oBAAoB;;IAEpB,oBAAoB;;IAEpB,yCAAyC;;IAEzC,4BAA4B;;IAE5B,sBAAsB;;IAEtB,uBAAuB;;IAEvB,2BAA2B;;IAE3B,mBAAmB;;IAEnB,uBAAuB;;CAEf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,kBAAkB;IAC7B,qCAAqC;;IAErC,iCAAiC;;IAEjC,yCAAyC;;IAEzC,4CAA4C;;IAE5C,0DAA0D;;CAElD,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,6BAA6B;;IAE7B,4BAA4B;;IAE5B,4BAA4B;;IAE5B,gCAAgC;;CAExB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type exports for @zapyapi/sdk
|
|
3
|
+
*/
|
|
4
|
+
export { WebhookEventType, InstanceStatus, MessageAckStatus, MessageType, WebhookQueueStatus, ConnectionStatus, } from './enums';
|
|
5
|
+
export type { ZapyClientOptions, PaginationQuery, PaginatedResponse, ApiErrorResponse, } from './common.types';
|
|
6
|
+
export type { Instance, CreateInstanceOptions, QRCodeResponse, InstanceStatusResponse, } from './instances.types';
|
|
7
|
+
export type { BaseMessageOptions, SendTextMessageOptions, MediaSource, SendImageMessageOptions, SendVideoMessageOptions, SendAudioNoteMessageOptions, SendAudioFileMessageOptions, SendDocumentMessageOptions, ForwardMessageOptions, EditMessageOptions, MessageResponse, ReadMessageResponse, MediaDownloadLinkResponse, } from './messages.types';
|
|
8
|
+
export type { WebhookEventBase, MessageParticipant, MediaInfo, MessageEventData, MessageWebhookEvent, MessageStatusEventData, MessageAckWebhookEvent, QRCodeEventData, QRCodeWebhookEvent, ContactInfo, ContactCreatedEventData, ContactCreatedWebhookEvent, ContactUpdatedEventData, ContactUpdatedWebhookEvent, ContactDeduplicatedEventData, ContactDeduplicatedWebhookEvent, ConnectionEventData, ConnectionWebhookEvent, WebhookEvent, } from './webhook-events.types';
|
|
9
|
+
export { isMessageEvent, isMessageStatusEvent, isQRCodeEvent, isContactCreatedEvent, isContactUpdatedEvent, isContactDeduplicatedEvent, } from './webhook-events.types';
|
|
10
|
+
export type { UserWebhookConfig, UpsertWebhookConfigInput, WebhookQueueStatusResponse, WebhookResumeResult, } from './webhook-config.types';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk/src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,GACb,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instance-related type definitions
|
|
3
|
+
*/
|
|
4
|
+
import type { InstanceStatus } from './enums';
|
|
5
|
+
/**
|
|
6
|
+
* WhatsApp instance information
|
|
7
|
+
*/
|
|
8
|
+
export interface Instance {
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier for the instance
|
|
11
|
+
*/
|
|
12
|
+
instanceId: string;
|
|
13
|
+
/**
|
|
14
|
+
* Display name of the instance
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Current connection status
|
|
19
|
+
*/
|
|
20
|
+
status: InstanceStatus;
|
|
21
|
+
/**
|
|
22
|
+
* Profile picture URL (when connected)
|
|
23
|
+
*/
|
|
24
|
+
profilePicUrl?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Profile name from WhatsApp (when connected)
|
|
27
|
+
*/
|
|
28
|
+
profileName?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Owner JID (WhatsApp ID)
|
|
31
|
+
*/
|
|
32
|
+
ownerJid?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Instance creation timestamp
|
|
35
|
+
*/
|
|
36
|
+
createdAt: string;
|
|
37
|
+
/**
|
|
38
|
+
* Last update timestamp
|
|
39
|
+
*/
|
|
40
|
+
updatedAt?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Options for creating a new instance (Partner only)
|
|
44
|
+
*/
|
|
45
|
+
export interface CreateInstanceOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Custom instance ID (optional, will be generated if not provided)
|
|
48
|
+
*/
|
|
49
|
+
instanceId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Display name for the instance
|
|
52
|
+
*/
|
|
53
|
+
name?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Custom metadata to attach to the instance
|
|
56
|
+
*/
|
|
57
|
+
metadata?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* QR Code response for connecting an instance
|
|
61
|
+
*/
|
|
62
|
+
export interface QRCodeResponse {
|
|
63
|
+
/**
|
|
64
|
+
* Instance ID
|
|
65
|
+
*/
|
|
66
|
+
instanceId: string;
|
|
67
|
+
/**
|
|
68
|
+
* QR code as base64 encoded image
|
|
69
|
+
*/
|
|
70
|
+
qrCode: string;
|
|
71
|
+
/**
|
|
72
|
+
* QR code expiration timestamp (Unix ms)
|
|
73
|
+
*/
|
|
74
|
+
expiresAt: number;
|
|
75
|
+
/**
|
|
76
|
+
* Current QR code attempt number
|
|
77
|
+
*/
|
|
78
|
+
attempt?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Instance status with connection details
|
|
82
|
+
*/
|
|
83
|
+
export interface InstanceStatusResponse {
|
|
84
|
+
/**
|
|
85
|
+
* Instance ID
|
|
86
|
+
*/
|
|
87
|
+
instanceId: string;
|
|
88
|
+
/**
|
|
89
|
+
* Current status
|
|
90
|
+
*/
|
|
91
|
+
status: InstanceStatus;
|
|
92
|
+
/**
|
|
93
|
+
* QR code if status is pending_qr_code_scan
|
|
94
|
+
*/
|
|
95
|
+
qrCode?: string;
|
|
96
|
+
/**
|
|
97
|
+
* QR code expiration timestamp
|
|
98
|
+
*/
|
|
99
|
+
qrExpiresAt?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Last activity timestamp
|
|
102
|
+
*/
|
|
103
|
+
lastActivity?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Connection information when connected
|
|
106
|
+
*/
|
|
107
|
+
connectionInfo?: {
|
|
108
|
+
connected: boolean;
|
|
109
|
+
device?: string;
|
|
110
|
+
platform?: string;
|
|
111
|
+
pushName?: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=instances.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.types.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk/src/types/instances.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,CAAC,EAAE;QACf,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message-related type definitions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base options for all message types
|
|
6
|
+
*/
|
|
7
|
+
export interface BaseMessageOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Recipient phone number or WhatsApp ID
|
|
10
|
+
*
|
|
11
|
+
* Formats supported:
|
|
12
|
+
* - Brazilian format: 11999999999
|
|
13
|
+
* - International format: 5511999999999
|
|
14
|
+
* - WhatsApp ID: 5511999999999@c.us (personal) or ...@g.us (group)
|
|
15
|
+
*/
|
|
16
|
+
to: string;
|
|
17
|
+
/**
|
|
18
|
+
* Message ID to reply to (for quoted messages)
|
|
19
|
+
*/
|
|
20
|
+
quotedMessageId?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Options for sending a text message
|
|
24
|
+
*/
|
|
25
|
+
export interface SendTextMessageOptions extends BaseMessageOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Text content of the message
|
|
28
|
+
*/
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Media source - either URL or base64 encoded content
|
|
33
|
+
*/
|
|
34
|
+
export interface MediaSource {
|
|
35
|
+
/**
|
|
36
|
+
* Public URL of the media file
|
|
37
|
+
*/
|
|
38
|
+
url?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Base64 encoded media content
|
|
41
|
+
*/
|
|
42
|
+
base64?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for sending an image message
|
|
46
|
+
*/
|
|
47
|
+
export interface SendImageMessageOptions extends BaseMessageOptions, MediaSource {
|
|
48
|
+
/**
|
|
49
|
+
* Optional caption for the image
|
|
50
|
+
*/
|
|
51
|
+
caption?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Options for sending a video message
|
|
55
|
+
*/
|
|
56
|
+
export interface SendVideoMessageOptions extends BaseMessageOptions, MediaSource {
|
|
57
|
+
/**
|
|
58
|
+
* Optional caption for the video
|
|
59
|
+
*/
|
|
60
|
+
caption?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Options for sending an audio note (voice message)
|
|
64
|
+
*/
|
|
65
|
+
export interface SendAudioNoteMessageOptions extends BaseMessageOptions, MediaSource {
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for sending an audio file
|
|
69
|
+
*/
|
|
70
|
+
export interface SendAudioFileMessageOptions extends BaseMessageOptions, MediaSource {
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for sending a document
|
|
74
|
+
*/
|
|
75
|
+
export interface SendDocumentMessageOptions extends BaseMessageOptions, MediaSource {
|
|
76
|
+
/**
|
|
77
|
+
* Filename for the document
|
|
78
|
+
*/
|
|
79
|
+
filename: string;
|
|
80
|
+
/**
|
|
81
|
+
* Optional caption for the document
|
|
82
|
+
*/
|
|
83
|
+
caption?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Options for forwarding a message
|
|
87
|
+
*/
|
|
88
|
+
export interface ForwardMessageOptions {
|
|
89
|
+
/**
|
|
90
|
+
* Recipient to forward the message to
|
|
91
|
+
*/
|
|
92
|
+
to: string;
|
|
93
|
+
/**
|
|
94
|
+
* ID of the message to forward
|
|
95
|
+
*/
|
|
96
|
+
messageId: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Options for editing a message
|
|
100
|
+
*/
|
|
101
|
+
export interface EditMessageOptions {
|
|
102
|
+
/**
|
|
103
|
+
* ID of the message to edit
|
|
104
|
+
*/
|
|
105
|
+
messageId: string;
|
|
106
|
+
/**
|
|
107
|
+
* New text content
|
|
108
|
+
*/
|
|
109
|
+
text: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Response after sending a message
|
|
113
|
+
*/
|
|
114
|
+
export interface MessageResponse {
|
|
115
|
+
/**
|
|
116
|
+
* Unique message ID assigned by WhatsApp
|
|
117
|
+
*/
|
|
118
|
+
messageId: string;
|
|
119
|
+
/**
|
|
120
|
+
* Message status
|
|
121
|
+
*/
|
|
122
|
+
status: 'sent' | 'pending' | 'failed';
|
|
123
|
+
/**
|
|
124
|
+
* Timestamp when the message was sent (Unix ms)
|
|
125
|
+
*/
|
|
126
|
+
timestamp: number;
|
|
127
|
+
/**
|
|
128
|
+
* Error message if status is 'failed'
|
|
129
|
+
*/
|
|
130
|
+
error?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Response for read message operation
|
|
134
|
+
*/
|
|
135
|
+
export interface ReadMessageResponse {
|
|
136
|
+
/**
|
|
137
|
+
* Whether the operation was successful
|
|
138
|
+
*/
|
|
139
|
+
success: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Message ID that was marked as read
|
|
142
|
+
*/
|
|
143
|
+
messageId: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Response for media download link
|
|
147
|
+
*/
|
|
148
|
+
export interface MediaDownloadLinkResponse {
|
|
149
|
+
/**
|
|
150
|
+
* Download URL for the media
|
|
151
|
+
*/
|
|
152
|
+
url: string;
|
|
153
|
+
/**
|
|
154
|
+
* MIME type of the media
|
|
155
|
+
*/
|
|
156
|
+
mimeType: string;
|
|
157
|
+
/**
|
|
158
|
+
* File size in bytes
|
|
159
|
+
*/
|
|
160
|
+
size?: number;
|
|
161
|
+
/**
|
|
162
|
+
* URL expiration timestamp
|
|
163
|
+
*/
|
|
164
|
+
expiresAt?: number;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=messages.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.types.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk/src/types/messages.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB,EAAE,WAAW;IAC9E;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB,EAAE,WAAW;IAC9E;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB,EAAE,WAAW;CAEnF;AAED;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,kBAAkB,EAAE,WAAW;CAEnF;AAED;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,kBAAkB,EAAE,WAAW;IACjF;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IAEtC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook configuration type definitions
|
|
3
|
+
* Types for managing webhook settings via the SDK
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* User webhook configuration
|
|
7
|
+
*/
|
|
8
|
+
export interface UserWebhookConfig {
|
|
9
|
+
/** Webhook configuration ID */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Webhook URL (HTTPS only) */
|
|
12
|
+
url: string;
|
|
13
|
+
/** Whether a secret is configured (secret value is never exposed) */
|
|
14
|
+
hasSecret: boolean;
|
|
15
|
+
/** Whether the webhook is active */
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
/** Whether the webhook is paused due to delivery failures */
|
|
18
|
+
isPaused: boolean;
|
|
19
|
+
/** When the webhook was paused (ISO 8601) */
|
|
20
|
+
pausedAt?: string;
|
|
21
|
+
/** Creation timestamp (ISO 8601) */
|
|
22
|
+
createdAt: string;
|
|
23
|
+
/** Last update timestamp (ISO 8601) */
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Input for configuring or updating a webhook
|
|
28
|
+
*/
|
|
29
|
+
export interface UpsertWebhookConfigInput {
|
|
30
|
+
/** Webhook URL (must be HTTPS) */
|
|
31
|
+
url: string;
|
|
32
|
+
/**
|
|
33
|
+
* Secret for HMAC-SHA256 signature verification (16-256 characters)
|
|
34
|
+
* Pass empty string to clear the secret
|
|
35
|
+
*/
|
|
36
|
+
secret?: string;
|
|
37
|
+
/** Whether the webhook is active */
|
|
38
|
+
isActive: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Webhook queue status response (counts by status)
|
|
42
|
+
*/
|
|
43
|
+
export interface WebhookQueueStatusResponse {
|
|
44
|
+
/** Number of webhooks pending delivery */
|
|
45
|
+
pendingCount: number;
|
|
46
|
+
/** Number of webhooks that failed permanently */
|
|
47
|
+
failedCount: number;
|
|
48
|
+
/** Number of webhooks paused due to delivery issues */
|
|
49
|
+
pausedCount: number;
|
|
50
|
+
/** Number of successfully delivered webhooks */
|
|
51
|
+
deliveredCount: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Result of resuming webhooks
|
|
55
|
+
*/
|
|
56
|
+
export interface WebhookResumeResult {
|
|
57
|
+
/** Number of webhooks resumed */
|
|
58
|
+
resumedCount: number;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=webhook-config.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-config.types.d.ts","sourceRoot":"","sources":["../../../../../libs/sdk/src/types/webhook-config.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,SAAS,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB"}
|