@in.pulse-crm/sdk 2.14.2 → 2.14.3
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.
|
@@ -142,14 +142,16 @@ export type WppChatWithDetailsAndMessages = WppChatWithDetails & {
|
|
|
142
142
|
};
|
|
143
143
|
export interface SendMessageData {
|
|
144
144
|
sendAsChatOwner?: boolean;
|
|
145
|
-
sendAsAudio?: boolean;
|
|
146
|
-
sendAsDocument?: boolean;
|
|
147
145
|
contactId: number;
|
|
146
|
+
text: string;
|
|
148
147
|
quotedId?: number | null;
|
|
149
148
|
chatId?: number | null;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
fileId
|
|
149
|
+
}
|
|
150
|
+
export interface SendFileMessageData extends SendMessageData {
|
|
151
|
+
fileId: number;
|
|
152
|
+
publicFileId: string;
|
|
153
|
+
sendAsDocument?: boolean;
|
|
154
|
+
sendAsAudio?: boolean;
|
|
153
155
|
}
|
|
154
156
|
export interface MonitorChat {
|
|
155
157
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ApiClient from "./api-client";
|
|
2
2
|
import { RequestFilters } from "./types";
|
|
3
3
|
import { DataResponse, MessageResponse } from "./types/response.types";
|
|
4
|
-
import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedContactsResponse, PaginatedNotificationsResponse, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
|
|
4
|
+
import { AppNotification, AutomaticResponseRule, AutomaticResponseRuleDTO, CreateScheduleDTO, ForwardMessagesData, PaginatedContactsResponse, PaginatedNotificationsResponse, SendFileMessageData, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
|
|
5
5
|
interface FetchMessagesFilters {
|
|
6
6
|
minDate: string;
|
|
7
7
|
maxDate: string;
|
|
@@ -13,7 +13,7 @@ export default class WhatsappClient extends ApiClient {
|
|
|
13
13
|
getMessageById(id: string): Promise<WppMessage>;
|
|
14
14
|
getUserWallets(instance: string, userId: number): Promise<WppWallet[]>;
|
|
15
15
|
markContactMessagesAsRead(contactId: number): Promise<WppMessage[]>;
|
|
16
|
-
sendMessage(clientId: string, to: string, data: SendMessageData): Promise<WppMessage>;
|
|
16
|
+
sendMessage(clientId: string, to: string, data: SendMessageData | SendFileMessageData): Promise<WppMessage>;
|
|
17
17
|
editMessage(clientId: string, messageId: string, newText: string, isInternal?: boolean): Promise<void>;
|
|
18
18
|
finishChatById(id: number, resultId: number, scheduleDate?: Date | null): Promise<void>;
|
|
19
19
|
startChatByContactId(contactId: number, template?: any): Promise<void>;
|
package/dist/whatsapp.client.js
CHANGED
|
@@ -38,16 +38,14 @@ class WhatsappClient extends api_client_1.default {
|
|
|
38
38
|
const url = `/api/whatsapp/${clientId}/messages`;
|
|
39
39
|
const formData = new form_data_1.default();
|
|
40
40
|
formData.append("to", to);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
data.
|
|
44
|
-
data.
|
|
45
|
-
data.
|
|
46
|
-
data.
|
|
47
|
-
data.
|
|
48
|
-
data.
|
|
49
|
-
data.sendAsChatOwner &&
|
|
50
|
-
formData.append("sendAsChatOwner", String(data.sendAsChatOwner));
|
|
41
|
+
formData.append("text", data.text);
|
|
42
|
+
formData.append("contactId", String(data.contactId));
|
|
43
|
+
("quotedId" in data) && data.quotedId && formData.append("quotedId", String(data.quotedId));
|
|
44
|
+
("chatId" in data) && data.chatId && formData.append("chatId", String(data.chatId));
|
|
45
|
+
("fileId" in data) && data.fileId && formData.append("fileId", String(data.fileId));
|
|
46
|
+
("sendAsAudio" in data) && data.sendAsAudio && formData.append("sendAsAudio", "true");
|
|
47
|
+
("sendAsDocument" in data) && data.sendAsDocument && formData.append("sendAsDocument", "true");
|
|
48
|
+
("sendAsChatOwner" in data) && data.sendAsChatOwner && formData.append("sendAsChatOwner", String(data.sendAsChatOwner));
|
|
51
49
|
const { data: res } = await this.ax.post(url, formData, {
|
|
52
50
|
headers: {
|
|
53
51
|
"Content-Type": "multipart/form-data",
|