cogfy-messenger 0.1.3 → 0.1.5
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/dist/clients/conversations/conversations-client.d.ts +16 -3
- package/dist/clients/conversations/conversations-client.js +17 -0
- package/dist/clients/conversations/types/index.d.ts +2 -1
- package/dist/clients/conversations/types/index.js +2 -1
- package/dist/clients/conversations/types/send-interactive-order-details-message.d.ts +81 -0
- package/dist/clients/conversations/types/send-interactive-order-details-message.js +2 -0
- package/dist/clients/index.d.ts +6 -2
- package/dist/clients/index.js +6 -2
- package/dist/clients/messages/index.d.ts +1 -0
- package/dist/clients/messages/index.js +17 -0
- package/dist/clients/messages/messages-client.d.ts +40 -0
- package/dist/clients/messages/messages-client.js +76 -0
- package/dist/clients/messages/types/index.d.ts +6 -0
- package/dist/clients/messages/types/index.js +22 -0
- package/dist/clients/messages/types/send-interactive-cta-url.d.ts +26 -0
- package/dist/clients/messages/types/send-interactive-cta-url.js +2 -0
- package/dist/clients/messages/types/send-interactive-order-details.d.ts +68 -0
- package/dist/clients/messages/types/send-interactive-order-details.js +2 -0
- package/dist/clients/messages/types/send-interactive-order-status.d.ts +33 -0
- package/dist/clients/messages/types/send-interactive-order-status.js +2 -0
- package/dist/clients/messages/types/send-location.d.ts +13 -0
- package/dist/clients/messages/types/send-location.js +2 -0
- package/dist/clients/messages/types/send-template.d.ts +19 -0
- package/dist/clients/messages/types/send-template.js +2 -0
- package/dist/clients/messages/types/send-text.d.ts +10 -0
- package/dist/clients/messages/types/send-text.js +2 -0
- package/dist/cogfy-messenger.d.ts +2 -4
- package/dist/cogfy-messenger.js +6 -8
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from '../base-client';
|
|
2
|
-
import { SendMessageCommand } from './types/send-message';
|
|
3
|
-
import { GetConversationResult, GetMessagesResult, ListConversationsParams, ListConversationsResult, ListMessagesParams } from './types';
|
|
2
|
+
import { SendMessageCommand, SendMessageResult } from './types/send-message';
|
|
3
|
+
import { GetConversationResult, GetMessagesResult, ListConversationsParams, ListConversationsResult, ListMessagesParams, SendInteractiveOrderDetailsMessageCommand, SendInteractiveOrderDetailsMessageResult } from './types';
|
|
4
4
|
export declare class ConversationsClient extends BaseClient {
|
|
5
5
|
/**
|
|
6
6
|
* Calls the GET /conversations/:id endpoint
|
|
@@ -20,5 +20,18 @@ export declare class ConversationsClient extends BaseClient {
|
|
|
20
20
|
* @returns A list of all messages in the specified conversation
|
|
21
21
|
*/
|
|
22
22
|
getMessages(params: ListMessagesParams): Promise<GetMessagesResult>;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Calls the POST /conversations/:id/messages/interactive/order-details endpoint
|
|
25
|
+
* @param id The ID of the conversation to send a message to
|
|
26
|
+
* @param payload The message payload to send
|
|
27
|
+
* @returns The response from the API
|
|
28
|
+
*/
|
|
29
|
+
sendInteractiveOrderDetailsMessage(id: string, payload: SendInteractiveOrderDetailsMessageCommand): Promise<SendInteractiveOrderDetailsMessageResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Calls the POST /conversations/:id/messages endpoint
|
|
32
|
+
* @param id The ID of the conversation to send a message to
|
|
33
|
+
* @param payload The message payload to send
|
|
34
|
+
* @returns The response from the API
|
|
35
|
+
*/
|
|
36
|
+
sendMessage(id: string, payload: SendMessageCommand): Promise<SendMessageResult>;
|
|
24
37
|
}
|
|
@@ -48,6 +48,23 @@ class ConversationsClient extends base_client_1.BaseClient {
|
|
|
48
48
|
return axiosResponse.data;
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Calls the POST /conversations/:id/messages/interactive/order-details endpoint
|
|
53
|
+
* @param id The ID of the conversation to send a message to
|
|
54
|
+
* @param payload The message payload to send
|
|
55
|
+
* @returns The response from the API
|
|
56
|
+
*/
|
|
57
|
+
sendInteractiveOrderDetailsMessage(id, payload) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return (yield this.axios.post(`/conversations/${id}/messages/interactive/order-details`, payload)).data;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Calls the POST /conversations/:id/messages endpoint
|
|
64
|
+
* @param id The ID of the conversation to send a message to
|
|
65
|
+
* @param payload The message payload to send
|
|
66
|
+
* @returns The response from the API
|
|
67
|
+
*/
|
|
51
68
|
sendMessage(id, payload) {
|
|
52
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
70
|
return (yield this.axios.post(`/conversations/${id}/messages`, payload)).data;
|
|
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./get-conversation"), exports);
|
|
18
18
|
__exportStar(require("./get-messages"), exports);
|
|
19
|
-
__exportStar(require("./send-message"), exports);
|
|
20
19
|
__exportStar(require("./list-conversations"), exports);
|
|
20
|
+
__exportStar(require("./send-interactive-order-details-message"), exports);
|
|
21
|
+
__exportStar(require("./send-message"), exports);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type SendInteractiveOrderDetailsMessageCommand = {
|
|
2
|
+
content: InteractiveOrderDetailsContent;
|
|
3
|
+
};
|
|
4
|
+
export type SendInteractiveOrderDetailsMessageResult = {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
type Amount = {
|
|
8
|
+
value: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
type PaymentSettingsTypePixDynamicCode = {
|
|
13
|
+
type: 'pix_dynamic_code';
|
|
14
|
+
pix_dynamic_code: {
|
|
15
|
+
code: string;
|
|
16
|
+
merchant_name: string;
|
|
17
|
+
key: string;
|
|
18
|
+
key_type: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type PaymentSettingsTypePaymentLink = {
|
|
22
|
+
type: 'payment_link';
|
|
23
|
+
payment_link: {
|
|
24
|
+
uri: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
type PaymentSettingsTypeBoleto = {
|
|
28
|
+
type: 'boleto';
|
|
29
|
+
boleto: {
|
|
30
|
+
digitable_line: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type InteractiveOrderDetailsContent = {
|
|
34
|
+
type: 'order_details';
|
|
35
|
+
body: {
|
|
36
|
+
text: string;
|
|
37
|
+
};
|
|
38
|
+
action: {
|
|
39
|
+
name: string;
|
|
40
|
+
parameters: {
|
|
41
|
+
reference_id: string;
|
|
42
|
+
type: string;
|
|
43
|
+
payment_type: string;
|
|
44
|
+
payment_settings?: Array<PaymentSettingsTypePixDynamicCode | PaymentSettingsTypePaymentLink | PaymentSettingsTypeBoleto>;
|
|
45
|
+
currency: string;
|
|
46
|
+
total_amount: Amount;
|
|
47
|
+
order: {
|
|
48
|
+
status: string;
|
|
49
|
+
catalog_id?: string;
|
|
50
|
+
shipping?: Amount;
|
|
51
|
+
expiration?: {
|
|
52
|
+
description: string;
|
|
53
|
+
timestamp: string;
|
|
54
|
+
};
|
|
55
|
+
tax: Amount;
|
|
56
|
+
discount?: Amount & {
|
|
57
|
+
discount_program_name?: string;
|
|
58
|
+
};
|
|
59
|
+
items: {
|
|
60
|
+
retailer_id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
amount: Amount;
|
|
63
|
+
quantity: number;
|
|
64
|
+
sale_amount?: Amount;
|
|
65
|
+
}[];
|
|
66
|
+
subtotal: Amount;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
header?: {
|
|
71
|
+
type: 'image';
|
|
72
|
+
image: {
|
|
73
|
+
link: string;
|
|
74
|
+
provider?: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
footer?: {
|
|
78
|
+
text: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export {};
|
package/dist/clients/index.d.ts
CHANGED
package/dist/clients/index.js
CHANGED
|
@@ -14,5 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./base-client"), exports);
|
|
18
|
+
__exportStar(require("./broadcasts"), exports);
|
|
19
|
+
__exportStar(require("./contacts"), exports);
|
|
20
|
+
__exportStar(require("./conversations"), exports);
|
|
21
|
+
__exportStar(require("./messages"), exports);
|
|
22
|
+
__exportStar(require("./tags"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './messages-client';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./messages-client"), exports);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseClient } from '../base-client';
|
|
2
|
+
import { SendInteractiveCtaUrlMessageCommand, SendInteractiveCtaUrlMessageResult, SendInteractiveOrderDetailsMessageCommand, SendInteractiveOrderDetailsMessageResult, SendInteractiveOrderStatusMessageCommand, SendInteractiveOrderStatusMessageResult, SendLocationMessageCommand, SendLocationMessageResult, SendTemplateMessageCommand, SendTemplateMessageResult, SendTextMessageCommand, SendTextMessageResult } from './types';
|
|
3
|
+
export declare class MessagesClient extends BaseClient {
|
|
4
|
+
/**
|
|
5
|
+
* Calls the POST /messages/interactive/cta_url endpoint
|
|
6
|
+
* @param payload The message data to send
|
|
7
|
+
* @returns The result of the sent message
|
|
8
|
+
*/
|
|
9
|
+
sendInteractiveCtaUrl(payload: SendInteractiveCtaUrlMessageCommand): Promise<SendInteractiveCtaUrlMessageResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Calls the POST /messages/interactive/order_details endpoint
|
|
12
|
+
* @param payload The message data to send
|
|
13
|
+
* @returns The result of the sent message
|
|
14
|
+
*/
|
|
15
|
+
sendInteractiveOrderDetails(payload: SendInteractiveOrderDetailsMessageCommand): Promise<SendInteractiveOrderDetailsMessageResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Calls the POST /messages/interactive/order_status endpoint
|
|
18
|
+
* @param payload The message data to send
|
|
19
|
+
* @returns The result of the sent message
|
|
20
|
+
*/
|
|
21
|
+
sendInteractiveOrderStatus(payload: SendInteractiveOrderStatusMessageCommand): Promise<SendInteractiveOrderStatusMessageResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Calls the POST /messages/location endpoint
|
|
24
|
+
* @param payload The message data to send
|
|
25
|
+
* @returns The result of the sent message
|
|
26
|
+
*/
|
|
27
|
+
sendLocation(payload: SendLocationMessageCommand): Promise<SendLocationMessageResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Calls the POST /messages/template endpoint
|
|
30
|
+
* @param payload The message data to send
|
|
31
|
+
* @returns The result of the sent message
|
|
32
|
+
*/
|
|
33
|
+
sendTemplate(payload: SendTemplateMessageCommand): Promise<SendTemplateMessageResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Calls the POST /messages/text endpoint
|
|
36
|
+
* @param payload The message data to send
|
|
37
|
+
* @returns The result of the sent message
|
|
38
|
+
*/
|
|
39
|
+
sendText(payload: SendTextMessageCommand): Promise<SendTextMessageResult>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MessagesClient = void 0;
|
|
13
|
+
const base_client_1 = require("../base-client");
|
|
14
|
+
class MessagesClient extends base_client_1.BaseClient {
|
|
15
|
+
/**
|
|
16
|
+
* Calls the POST /messages/interactive/cta_url endpoint
|
|
17
|
+
* @param payload The message data to send
|
|
18
|
+
* @returns The result of the sent message
|
|
19
|
+
*/
|
|
20
|
+
sendInteractiveCtaUrl(payload) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (yield this.axios.post('/messages/interactive/cta_url', payload)).data;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calls the POST /messages/interactive/order_details endpoint
|
|
27
|
+
* @param payload The message data to send
|
|
28
|
+
* @returns The result of the sent message
|
|
29
|
+
*/
|
|
30
|
+
sendInteractiveOrderDetails(payload) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
return (yield this.axios.post('/messages/interactive/order_details', payload)).data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Calls the POST /messages/interactive/order_status endpoint
|
|
37
|
+
* @param payload The message data to send
|
|
38
|
+
* @returns The result of the sent message
|
|
39
|
+
*/
|
|
40
|
+
sendInteractiveOrderStatus(payload) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return (yield this.axios.post('/messages/interactive/order_status', payload)).data;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Calls the POST /messages/location endpoint
|
|
47
|
+
* @param payload The message data to send
|
|
48
|
+
* @returns The result of the sent message
|
|
49
|
+
*/
|
|
50
|
+
sendLocation(payload) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return (yield this.axios.post('/messages/location', payload)).data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Calls the POST /messages/template endpoint
|
|
57
|
+
* @param payload The message data to send
|
|
58
|
+
* @returns The result of the sent message
|
|
59
|
+
*/
|
|
60
|
+
sendTemplate(payload) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return (yield this.axios.post('/messages/template', payload)).data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Calls the POST /messages/text endpoint
|
|
67
|
+
* @param payload The message data to send
|
|
68
|
+
* @returns The result of the sent message
|
|
69
|
+
*/
|
|
70
|
+
sendText(payload) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return (yield this.axios.post('/messages/text', payload)).data;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.MessagesClient = MessagesClient;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./send-interactive-cta-url"), exports);
|
|
18
|
+
__exportStar(require("./send-interactive-order-details"), exports);
|
|
19
|
+
__exportStar(require("./send-interactive-order-status"), exports);
|
|
20
|
+
__exportStar(require("./send-location"), exports);
|
|
21
|
+
__exportStar(require("./send-template"), exports);
|
|
22
|
+
__exportStar(require("./send-text"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type SendInteractiveCtaUrlMessageCommand = {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
interactive: {
|
|
5
|
+
type?: 'cta_url';
|
|
6
|
+
header?: {
|
|
7
|
+
type: 'text' | 'image' | 'video' | 'document';
|
|
8
|
+
};
|
|
9
|
+
body: {
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
footer?: {
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
action: {
|
|
16
|
+
name?: 'cta_url';
|
|
17
|
+
parameters: {
|
|
18
|
+
display_text: string;
|
|
19
|
+
url: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type SendInteractiveCtaUrlMessageResult = {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type SendInteractiveOrderDetailsMessageCommand = {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
interactive: {
|
|
5
|
+
type?: 'order_details';
|
|
6
|
+
header?: {
|
|
7
|
+
type: 'image';
|
|
8
|
+
};
|
|
9
|
+
body: {
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
footer?: {
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
action: {
|
|
16
|
+
name?: 'review_and_pay';
|
|
17
|
+
parameters: {
|
|
18
|
+
reference_id: string;
|
|
19
|
+
type: 'digital-goods' | 'physical-goods';
|
|
20
|
+
payment_type?: 'br';
|
|
21
|
+
payment_settings: Array<{
|
|
22
|
+
type: 'pix_dynamic_code' | 'payment_link' | 'boleto';
|
|
23
|
+
pix_dynamic_code?: {
|
|
24
|
+
code: string;
|
|
25
|
+
merchant_name: string;
|
|
26
|
+
key: string;
|
|
27
|
+
key_type: 'CPF' | 'CNPJ' | 'EMAIL' | 'PHONE' | 'EVP';
|
|
28
|
+
};
|
|
29
|
+
payment_link?: {
|
|
30
|
+
uri: string;
|
|
31
|
+
};
|
|
32
|
+
boleto?: {
|
|
33
|
+
digitable_line: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
currency?: 'BRL';
|
|
37
|
+
total_amount: number;
|
|
38
|
+
order: {
|
|
39
|
+
status?: 'pending';
|
|
40
|
+
catalog_id?: string;
|
|
41
|
+
expiration?: {
|
|
42
|
+
timestamp?: number;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
items: Array<{
|
|
46
|
+
retailer_id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
amount: number;
|
|
49
|
+
quantity?: number;
|
|
50
|
+
sale_amount?: number;
|
|
51
|
+
}>;
|
|
52
|
+
subtotal: number;
|
|
53
|
+
tax: number;
|
|
54
|
+
shipping?: number;
|
|
55
|
+
discount?: {
|
|
56
|
+
value: number;
|
|
57
|
+
offset?: number;
|
|
58
|
+
description?: string;
|
|
59
|
+
discount_program_name?: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type SendInteractiveOrderDetailsMessageResult = {
|
|
67
|
+
id: string;
|
|
68
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type SendInteractiveOrderStatusMessageCommand = {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
interactive: {
|
|
5
|
+
type?: 'order_status';
|
|
6
|
+
header?: {
|
|
7
|
+
type: 'image';
|
|
8
|
+
};
|
|
9
|
+
body: {
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
footer?: {
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
action: {
|
|
16
|
+
name?: 'review_order';
|
|
17
|
+
parameters: {
|
|
18
|
+
reference_id: string;
|
|
19
|
+
order?: {
|
|
20
|
+
status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
payment?: {
|
|
24
|
+
status: 'pending' | 'captured' | 'failed';
|
|
25
|
+
timestamp?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type SendInteractiveOrderStatusMessageResult = {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type SendTemplateMessageCommand = {
|
|
2
|
+
from: string;
|
|
3
|
+
to: string;
|
|
4
|
+
template: {
|
|
5
|
+
name: string;
|
|
6
|
+
language: {
|
|
7
|
+
code: string;
|
|
8
|
+
};
|
|
9
|
+
components: {
|
|
10
|
+
type: string;
|
|
11
|
+
sub_type?: string;
|
|
12
|
+
index?: number;
|
|
13
|
+
parameters: any[];
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type SendTemplateMessageResult = {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { ContactsClient } from './clients
|
|
2
|
-
import { TagsClient } from './clients/tags';
|
|
3
|
-
import { ConversationsClient } from './clients/conversations';
|
|
4
|
-
import { BroadcastsClient } from './clients/broadcasts';
|
|
1
|
+
import { BroadcastsClient, ContactsClient, ConversationsClient, MessagesClient, TagsClient } from './clients';
|
|
5
2
|
export type CogfyMessengerOptions = {
|
|
6
3
|
apiKey: string;
|
|
7
4
|
baseURL?: string;
|
|
@@ -10,6 +7,7 @@ export declare class CogfyMessenger {
|
|
|
10
7
|
broadcasts: BroadcastsClient;
|
|
11
8
|
contacts: ContactsClient;
|
|
12
9
|
conversations: ConversationsClient;
|
|
10
|
+
messages: MessagesClient;
|
|
13
11
|
tags: TagsClient;
|
|
14
12
|
constructor(options: CogfyMessengerOptions);
|
|
15
13
|
}
|
package/dist/cogfy-messenger.js
CHANGED
|
@@ -5,10 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CogfyMessenger = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const
|
|
9
|
-
const tags_1 = require("./clients/tags");
|
|
10
|
-
const conversations_1 = require("./clients/conversations");
|
|
11
|
-
const broadcasts_1 = require("./clients/broadcasts");
|
|
8
|
+
const clients_1 = require("./clients");
|
|
12
9
|
const DEFAULT_BASE_URL = 'https://messenger-public-api.cogfy.com';
|
|
13
10
|
class CogfyMessenger {
|
|
14
11
|
constructor(options) {
|
|
@@ -20,10 +17,11 @@ class CogfyMessenger {
|
|
|
20
17
|
}
|
|
21
18
|
})
|
|
22
19
|
};
|
|
23
|
-
this.broadcasts = new
|
|
24
|
-
this.contacts = new
|
|
25
|
-
this.conversations = new
|
|
26
|
-
this.
|
|
20
|
+
this.broadcasts = new clients_1.BroadcastsClient(clientOptions);
|
|
21
|
+
this.contacts = new clients_1.ContactsClient(clientOptions);
|
|
22
|
+
this.conversations = new clients_1.ConversationsClient(clientOptions);
|
|
23
|
+
this.messages = new clients_1.MessagesClient(clientOptions);
|
|
24
|
+
this.tags = new clients_1.TagsClient(clientOptions);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
exports.CogfyMessenger = CogfyMessenger;
|