ab-ecosystem-cpass 1.0.7 → 1.0.8
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 +5 -1
- package/dist/client.d.ts +24 -0
- package/dist/client.js +28 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/audience/canned-replies.d.ts +95 -0
- package/dist/resources/audience/canned-replies.js +112 -0
- package/dist/resources/audience/canned-replies.js.map +1 -0
- package/dist/resources/audience/notifications.d.ts +14 -0
- package/dist/resources/audience/notifications.js +14 -0
- package/dist/resources/audience/notifications.js.map +1 -1
- package/dist/resources/campaign-messages.d.ts +25 -22
- package/dist/resources/campaign-messages.js +34 -27
- package/dist/resources/campaign-messages.js.map +1 -1
- package/dist/resources/data-stores.d.ts +469 -0
- package/dist/resources/data-stores.js +530 -0
- package/dist/resources/data-stores.js.map +1 -0
- package/dist/resources/paths.d.ts +6 -0
- package/dist/resources/paths.js +7 -1
- package/dist/resources/paths.js.map +1 -1
- package/dist/types/campaign.d.ts +11 -5
- package/dist/types/canned-reply.d.ts +124 -0
- package/dist/types/canned-reply.js +6 -0
- package/dist/types/canned-reply.js.map +1 -0
- package/dist/types/datastore.d.ts +260 -0
- package/dist/types/datastore.js +21 -0
- package/dist/types/datastore.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/docs/audience/canned-replies.md +302 -0
- package/docs/audience/notifications.md +99 -0
- package/docs/campaign/campaign-messages.md +31 -22
- package/docs/campaign/campaigns.md +1 -1
- package/docs/data-store.md +495 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ same pages ship inside the package, so they are readable offline at
|
|
|
173
173
|
| `crm.contactTags` | [contact tags](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/contact-tags.md) | `list` `get` `create` `update` `delete` |
|
|
174
174
|
| `crm.contactNotes` | [contact notes](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/contact-notes.md) | `list` `get` `create` `update` `delete` |
|
|
175
175
|
| `crm.customFields` | [custom fields](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/custom-fields.md) | `list` `get` `create` `update` `delete` |
|
|
176
|
+
| `crm.cannedReplies` | [canned replies](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/canned-replies.md) | `list` `get` `create` `update` `delete` — addressed by id **or** name |
|
|
176
177
|
| `crm.segments` | [segments](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/segments.md) | `list` `get` `create` `update` `delete` |
|
|
177
178
|
| `crm.crmTriggers` | [CRM triggers](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/crm-triggers.md) | `list` `get` `create` `update` `delete` `logs` |
|
|
178
179
|
| `crm.imports` | [import history](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/imports.md) | `list` `get` `create` `delete` |
|
|
@@ -180,6 +181,9 @@ same pages ship inside the package, so they are readable offline at
|
|
|
180
181
|
| `crm.webhooks` | [audience webhooks](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/webhooks.md) | `list` `get` `create` `update` `delete` |
|
|
181
182
|
| `crm.scheduledMessages` | [scheduled messages](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/scheduled-messages.md) | `list` `get` `create` `createSeries` `createRepeating` `reschedule` `cancel` `cancelSeries` `sendNow` |
|
|
182
183
|
| `crm.notifications` | [push notifications](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/audience/notifications.md) | `subscribe` `unsubscribe` `devices` — the devices a user wants notified |
|
|
184
|
+
| `crm.dataStores` | [data store](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/data-store.md) | `list` `get` `create` `update` `remove` `test` — a MongoDB you own, registered with the platform |
|
|
185
|
+
| `crm.dataStoreCollections` | [data store](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/data-store.md) | `list` `get` `create` `update` `remove` — the schemas declared over it |
|
|
186
|
+
| `crm.dataStoreRecords` | [data store](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/data-store.md) | `insert` `list` `search` `get` `update` `bulkUpdate` `remove` `bulkRemove` — documents in your own database |
|
|
183
187
|
|
|
184
188
|
### Channels — `/v1/channels`
|
|
185
189
|
|
|
@@ -275,7 +279,7 @@ to show a user.
|
|
|
275
279
|
| Resource | Page | Actions |
|
|
276
280
|
| --- | --- | --- |
|
|
277
281
|
| `crm.campaigns` | [campaigns](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/campaign/campaigns.md) | `list` `get` `create` `createBulk` `createGroup` `uploadReceivers` `update` `schedule` `cancel` `delete` |
|
|
278
|
-
| `crm.campaignMessages` | [campaign
|
|
282
|
+
| `crm.campaignMessages` | [campaign reporting](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/campaign/campaign-messages.md) | `stats` `list` `iterate` `replies` — `/v1/campaigns/:id/report`, counted off the per-recipient rows |
|
|
279
283
|
|
|
280
284
|
The audience helpers are exported too, so a UI can show "12,480 recipients, 3
|
|
281
285
|
duplicates dropped" before anything is uploaded:
|
package/dist/client.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ClientOptions } from './http';
|
|
|
2
2
|
import { Contacts } from './resources/audience/contacts';
|
|
3
3
|
import { ContactTags } from './resources/audience/contact-tags';
|
|
4
4
|
import { ContactNotes } from './resources/audience/contact-notes';
|
|
5
|
+
import { CannedReplies } from './resources/audience/canned-replies';
|
|
5
6
|
import { CustomFields } from './resources/audience/custom-fields';
|
|
6
7
|
import { Segments } from './resources/audience/segments';
|
|
7
8
|
import { CrmTriggers } from './resources/audience/crm-triggers';
|
|
@@ -11,6 +12,7 @@ import { Webhooks } from './resources/audience/webhooks';
|
|
|
11
12
|
import { ScheduledMessages } from './resources/audience/scheduled-messages';
|
|
12
13
|
import { InboxMedia } from './resources/audience/inbox-media';
|
|
13
14
|
import { Notifications } from './resources/audience/notifications';
|
|
15
|
+
import { DataStoreCollections, DataStoreRecords, DataStores } from './resources/data-stores';
|
|
14
16
|
import { Channels } from './resources/channels/channels';
|
|
15
17
|
import { Templates } from './resources/channels/templates';
|
|
16
18
|
import { ChannelWebhooks } from './resources/channels/webhooks';
|
|
@@ -40,6 +42,15 @@ export declare class CrmClient {
|
|
|
40
42
|
readonly contactNotes: ContactNotes;
|
|
41
43
|
/** Custom fields: the per-account contact schema. */
|
|
42
44
|
readonly customFields: CustomFields;
|
|
45
|
+
/**
|
|
46
|
+
* Canned replies: stored message payloads an agent sends without retyping
|
|
47
|
+
* them. A `CANNED` reply fires its messages as stored; a `QUICK` one lands in
|
|
48
|
+
* the composer to edit first.
|
|
49
|
+
*
|
|
50
|
+
* Addressed by id or by name -- names are unique per account, and the name is
|
|
51
|
+
* what an agent types after `/` to pick one.
|
|
52
|
+
*/
|
|
53
|
+
readonly cannedReplies: CannedReplies;
|
|
43
54
|
/** Segments: saved contact filters. */
|
|
44
55
|
readonly segments: Segments;
|
|
45
56
|
/** CRM triggers: fire a webhook when a contact changes, plus their delivery logs. */
|
|
@@ -69,6 +80,19 @@ export declare class CrmClient {
|
|
|
69
80
|
* token, `unsubscribe()` on logout.
|
|
70
81
|
*/
|
|
71
82
|
readonly notifications: Notifications;
|
|
83
|
+
/**
|
|
84
|
+
* Data stores: a MongoDB you own, registered with the platform.
|
|
85
|
+
*
|
|
86
|
+
* The platform holds the credential -- encrypted -- and the schemas you
|
|
87
|
+
* declare over it. It holds none of your data: every record call is a live
|
|
88
|
+
* round trip to your own cluster. Deleting a store or a collection forgets
|
|
89
|
+
* our side of it and leaves your database untouched.
|
|
90
|
+
*/
|
|
91
|
+
readonly dataStores: DataStores;
|
|
92
|
+
/** The collections declared over a data store: a name, and the fields in it. */
|
|
93
|
+
readonly dataStoreCollections: DataStoreCollections;
|
|
94
|
+
/** The records inside one -- documents in your database, read and written live. */
|
|
95
|
+
readonly dataStoreRecords: DataStoreRecords;
|
|
72
96
|
/** Channels, and the provider properties that hang off them. */
|
|
73
97
|
readonly channels: Channels;
|
|
74
98
|
/** WhatsApp message templates, per channel. */
|
package/dist/client.js
CHANGED
|
@@ -6,6 +6,7 @@ const http_1 = require("./http");
|
|
|
6
6
|
const contacts_1 = require("./resources/audience/contacts");
|
|
7
7
|
const contact_tags_1 = require("./resources/audience/contact-tags");
|
|
8
8
|
const contact_notes_1 = require("./resources/audience/contact-notes");
|
|
9
|
+
const canned_replies_1 = require("./resources/audience/canned-replies");
|
|
9
10
|
const custom_fields_1 = require("./resources/audience/custom-fields");
|
|
10
11
|
const segments_1 = require("./resources/audience/segments");
|
|
11
12
|
const crm_triggers_1 = require("./resources/audience/crm-triggers");
|
|
@@ -15,6 +16,7 @@ const webhooks_1 = require("./resources/audience/webhooks");
|
|
|
15
16
|
const scheduled_messages_1 = require("./resources/audience/scheduled-messages");
|
|
16
17
|
const inbox_media_1 = require("./resources/audience/inbox-media");
|
|
17
18
|
const notifications_1 = require("./resources/audience/notifications");
|
|
19
|
+
const data_stores_1 = require("./resources/data-stores");
|
|
18
20
|
// Channels
|
|
19
21
|
const channels_1 = require("./resources/channels/channels");
|
|
20
22
|
const templates_1 = require("./resources/channels/templates");
|
|
@@ -47,6 +49,15 @@ class CrmClient {
|
|
|
47
49
|
contactNotes;
|
|
48
50
|
/** Custom fields: the per-account contact schema. */
|
|
49
51
|
customFields;
|
|
52
|
+
/**
|
|
53
|
+
* Canned replies: stored message payloads an agent sends without retyping
|
|
54
|
+
* them. A `CANNED` reply fires its messages as stored; a `QUICK` one lands in
|
|
55
|
+
* the composer to edit first.
|
|
56
|
+
*
|
|
57
|
+
* Addressed by id or by name -- names are unique per account, and the name is
|
|
58
|
+
* what an agent types after `/` to pick one.
|
|
59
|
+
*/
|
|
60
|
+
cannedReplies;
|
|
50
61
|
/** Segments: saved contact filters. */
|
|
51
62
|
segments;
|
|
52
63
|
/** CRM triggers: fire a webhook when a contact changes, plus their delivery logs. */
|
|
@@ -76,6 +87,19 @@ class CrmClient {
|
|
|
76
87
|
* token, `unsubscribe()` on logout.
|
|
77
88
|
*/
|
|
78
89
|
notifications;
|
|
90
|
+
/**
|
|
91
|
+
* Data stores: a MongoDB you own, registered with the platform.
|
|
92
|
+
*
|
|
93
|
+
* The platform holds the credential -- encrypted -- and the schemas you
|
|
94
|
+
* declare over it. It holds none of your data: every record call is a live
|
|
95
|
+
* round trip to your own cluster. Deleting a store or a collection forgets
|
|
96
|
+
* our side of it and leaves your database untouched.
|
|
97
|
+
*/
|
|
98
|
+
dataStores;
|
|
99
|
+
/** The collections declared over a data store: a name, and the fields in it. */
|
|
100
|
+
dataStoreCollections;
|
|
101
|
+
/** The records inside one -- documents in your database, read and written live. */
|
|
102
|
+
dataStoreRecords;
|
|
79
103
|
// -- Channels -------------------------------------------------------------
|
|
80
104
|
/** Channels, and the provider properties that hang off them. */
|
|
81
105
|
channels;
|
|
@@ -111,6 +135,7 @@ class CrmClient {
|
|
|
111
135
|
this.contactTags = new contact_tags_1.ContactTags(http);
|
|
112
136
|
this.contactNotes = new contact_notes_1.ContactNotes(http);
|
|
113
137
|
this.customFields = new custom_fields_1.CustomFields(http);
|
|
138
|
+
this.cannedReplies = new canned_replies_1.CannedReplies(http);
|
|
114
139
|
this.segments = new segments_1.Segments(http);
|
|
115
140
|
this.crmTriggers = new crm_triggers_1.CrmTriggers(http);
|
|
116
141
|
this.imports = new import_history_1.Imports(http);
|
|
@@ -119,6 +144,9 @@ class CrmClient {
|
|
|
119
144
|
this.scheduledMessages = new scheduled_messages_1.ScheduledMessages(http);
|
|
120
145
|
this.inboxMedia = new inbox_media_1.InboxMedia(http);
|
|
121
146
|
this.notifications = new notifications_1.Notifications(http);
|
|
147
|
+
this.dataStores = new data_stores_1.DataStores(http);
|
|
148
|
+
this.dataStoreCollections = new data_stores_1.DataStoreCollections(http);
|
|
149
|
+
this.dataStoreRecords = new data_stores_1.DataStoreRecords(http);
|
|
122
150
|
this.channels = new channels_1.Channels(http);
|
|
123
151
|
this.templates = new templates_1.Templates(http);
|
|
124
152
|
this.channelWebhooks = new webhooks_2.ChannelWebhooks(http);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,iCAAwD;AAExD,WAAW;AACX,4DAAyD;AACzD,oEAAgE;AAChE,sEAAkE;AAClE,sEAAkE;AAClE,4DAAyD;AACzD,oEAAgE;AAChE,wEAA8D;AAC9D,wEAA8D;AAC9D,4DAAyD;AACzD,gFAA4E;AAC5E,kEAA8D;AAC9D,sEAAmE;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,iCAAwD;AAExD,WAAW;AACX,4DAAyD;AACzD,oEAAgE;AAChE,sEAAkE;AAClE,wEAAoE;AACpE,sEAAkE;AAClE,4DAAyD;AACzD,oEAAgE;AAChE,wEAA8D;AAC9D,wEAA8D;AAC9D,4DAAyD;AACzD,gFAA4E;AAC5E,kEAA8D;AAC9D,sEAAmE;AACnE,yDAIiC;AAEjC,WAAW;AACX,4DAAyD;AACzD,8DAA2D;AAC3D,4DAAgE;AAChE,0DAAuD;AACvD,wDAAqD;AACrD,4DAAyD;AAEzD,WAAW;AACX,qDAAkD;AAClD,qEAAiE;AAEjE;;;;;;;;;;;GAWG;AACH,MAAa,SAAS;IACpB,4EAA4E;IAE5E,gDAAgD;IACvC,QAAQ,CAAW;IAC5B,oDAAoD;IAC3C,WAAW,CAAc;IAClC,kEAAkE;IACzD,YAAY,CAAe;IACpC,qDAAqD;IAC5C,YAAY,CAAe;IACpC;;;;;;;OAOG;IACM,aAAa,CAAgB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AAC,CAAC;IACrD,CAAC;CACF;AApID,8BAoIC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { AUDIENCE, CHANNELS } from './resources/paths';
|
|
|
6
6
|
export { Contacts } from './resources/audience/contacts';
|
|
7
7
|
export { ContactTags } from './resources/audience/contact-tags';
|
|
8
8
|
export { ContactNotes } from './resources/audience/contact-notes';
|
|
9
|
+
export { CannedReplies } from './resources/audience/canned-replies';
|
|
9
10
|
export { CustomFields } from './resources/audience/custom-fields';
|
|
10
11
|
export { Segments } from './resources/audience/segments';
|
|
11
12
|
export { CrmTriggers } from './resources/audience/crm-triggers';
|
|
@@ -13,6 +14,7 @@ export { Imports } from './resources/audience/import-history';
|
|
|
13
14
|
export { Exports } from './resources/audience/export-history';
|
|
14
15
|
export { Webhooks } from './resources/audience/webhooks';
|
|
15
16
|
export { Notifications } from './resources/audience/notifications';
|
|
17
|
+
export { DataStores, DataStoreCollections, DataStoreRecords, } from './resources/data-stores';
|
|
16
18
|
export { InboxMedia, type UploadMediaOptions, type UploadMediaSource, } from './resources/audience/inbox-media';
|
|
17
19
|
export { Campaigns, type CreateBulkCampaignInput, type BulkCampaignResult, type CreateGroupCampaignInput, type GroupBucket, type GroupBucketResult, type GroupCampaignResult, type ReceiverUploader, } from './resources/campaigns';
|
|
18
20
|
export { CampaignMessages } from './resources/campaign-messages';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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
|
-
exports.Activity = exports.Wallet = exports.Billing = exports.ChannelWebhooks = exports.Templates = exports.Channels = exports.resolveAudience = exports.parseDelimited = exports.normaliseNumbers = exports.normaliseColumn = exports.buildReceivers = exports.MAX_BULK_RECEIVERS = exports.CampaignMessages = exports.Campaigns = exports.InboxMedia = exports.Notifications = exports.Webhooks = exports.Exports = exports.Imports = exports.CrmTriggers = exports.Segments = exports.CustomFields = exports.ContactNotes = exports.ContactTags = exports.Contacts = exports.CHANNELS = exports.AUDIENCE = void 0;
|
|
17
|
+
exports.Activity = exports.Wallet = exports.Billing = exports.ChannelWebhooks = exports.Templates = exports.Channels = exports.resolveAudience = exports.parseDelimited = exports.normaliseNumbers = exports.normaliseColumn = exports.buildReceivers = exports.MAX_BULK_RECEIVERS = exports.CampaignMessages = exports.Campaigns = exports.InboxMedia = exports.DataStoreRecords = exports.DataStoreCollections = exports.DataStores = exports.Notifications = exports.Webhooks = exports.Exports = exports.Imports = exports.CrmTriggers = exports.Segments = exports.CustomFields = exports.CannedReplies = exports.ContactNotes = exports.ContactTags = exports.Contacts = exports.CHANNELS = exports.AUDIENCE = void 0;
|
|
18
18
|
__exportStar(require("./client"), exports);
|
|
19
19
|
__exportStar(require("./http"), exports);
|
|
20
20
|
__exportStar(require("./errors"), exports);
|
|
@@ -29,6 +29,8 @@ var contact_tags_1 = require("./resources/audience/contact-tags");
|
|
|
29
29
|
Object.defineProperty(exports, "ContactTags", { enumerable: true, get: function () { return contact_tags_1.ContactTags; } });
|
|
30
30
|
var contact_notes_1 = require("./resources/audience/contact-notes");
|
|
31
31
|
Object.defineProperty(exports, "ContactNotes", { enumerable: true, get: function () { return contact_notes_1.ContactNotes; } });
|
|
32
|
+
var canned_replies_1 = require("./resources/audience/canned-replies");
|
|
33
|
+
Object.defineProperty(exports, "CannedReplies", { enumerable: true, get: function () { return canned_replies_1.CannedReplies; } });
|
|
32
34
|
var custom_fields_1 = require("./resources/audience/custom-fields");
|
|
33
35
|
Object.defineProperty(exports, "CustomFields", { enumerable: true, get: function () { return custom_fields_1.CustomFields; } });
|
|
34
36
|
var segments_1 = require("./resources/audience/segments");
|
|
@@ -43,6 +45,10 @@ var webhooks_1 = require("./resources/audience/webhooks");
|
|
|
43
45
|
Object.defineProperty(exports, "Webhooks", { enumerable: true, get: function () { return webhooks_1.Webhooks; } });
|
|
44
46
|
var notifications_1 = require("./resources/audience/notifications");
|
|
45
47
|
Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return notifications_1.Notifications; } });
|
|
48
|
+
var data_stores_1 = require("./resources/data-stores");
|
|
49
|
+
Object.defineProperty(exports, "DataStores", { enumerable: true, get: function () { return data_stores_1.DataStores; } });
|
|
50
|
+
Object.defineProperty(exports, "DataStoreCollections", { enumerable: true, get: function () { return data_stores_1.DataStoreCollections; } });
|
|
51
|
+
Object.defineProperty(exports, "DataStoreRecords", { enumerable: true, get: function () { return data_stores_1.DataStoreRecords; } });
|
|
46
52
|
var inbox_media_1 = require("./resources/audience/inbox-media");
|
|
47
53
|
Object.defineProperty(exports, "InboxMedia", { enumerable: true, get: function () { return inbox_media_1.InboxMedia; } });
|
|
48
54
|
// Campaign
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AAExB,2CAAuD;AAA9C,iGAAA,QAAQ,OAAA;AAAE,iGAAA,QAAQ,OAAA;AAE3B,WAAW;AACX,0DAAyD;AAAhD,oGAAA,QAAQ,OAAA;AACjB,kEAAgE;AAAvD,2GAAA,WAAW,OAAA;AACpB,oEAAkE;AAAzD,6GAAA,YAAY,OAAA;AACrB,oEAAkE;AAAzD,6GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,oGAAA,QAAQ,OAAA;AACjB,kEAAgE;AAAvD,2GAAA,WAAW,OAAA;AACpB,sEAA8D;AAArD,yGAAA,OAAO,OAAA;AAChB,sEAA8D;AAArD,yGAAA,OAAO,OAAA;AAChB,0DAAyD;AAAhD,oGAAA,QAAQ,OAAA;AACjB,oEAAmE;AAA1D,8GAAA,aAAa,OAAA;AACtB,g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AA,aAAa,OAAA;AACtB,uDAIiC;AAH/B,yGAAA,UAAU,OAAA;AACV,mHAAA,oBAAoB,OAAA;AACpB,+GAAA,gBAAgB,OAAA;AAElB,gEAI0C;AAHxC,yGAAA,UAAU,OAAA;AAKZ,WAAW;AACX,mDAS+B;AAR7B,sGAAA,SAAS,OAAA;AASX,mEAAiE;AAAxD,qHAAA,gBAAgB,OAAA;AACzB;;;;GAIG;AACH,mEAUuC;AATrC,uHAAA,kBAAkB,OAAA;AAClB,mHAAA,cAAc,OAAA;AACd,oHAAA,eAAe,OAAA;AACf,qHAAA,gBAAgB,OAAA;AAChB,mHAAA,cAAc,OAAA;AACd,oHAAA,eAAe,OAAA;AAMjB,WAAW;AACX,0DAA8E;AAArE,oGAAA,QAAQ,OAAA;AACjB,4DAA2D;AAAlD,sGAAA,SAAS,OAAA;AAClB,0DAAgE;AAAvD,2GAAA,eAAe,OAAA;AACxB,wDAAuD;AAA9C,kGAAA,OAAO,OAAA;AAChB,sDAAqD;AAA5C,gGAAA,MAAM,OAAA;AACf,0DAAyD;AAAhD,oGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { CannedReply, CreateCannedReplyInput, ListCannedRepliesQuery, Paginated, UpdateCannedReplyInput } from '../../types';
|
|
2
|
+
import type { HttpClient } from '../../http';
|
|
3
|
+
/**
|
|
4
|
+
* Canned replies: message payloads an agent sends into a chat without retyping
|
|
5
|
+
* them.
|
|
6
|
+
*
|
|
7
|
+
* Two kinds. A `CANNED` reply sends every message it holds, as stored, in order,
|
|
8
|
+
* the moment it is picked -- so a three-message reply is three messages on the
|
|
9
|
+
* contact's phone from one keystroke. A `QUICK` reply drops its text into the
|
|
10
|
+
* agent's composer to edit first, which is why it holds exactly one text message
|
|
11
|
+
* and nothing else.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* await crm.cannedReplies.create({
|
|
15
|
+
* name: 'price list',
|
|
16
|
+
* type: 'CANNED',
|
|
17
|
+
* channel: 'whatsapp',
|
|
18
|
+
* messages: [
|
|
19
|
+
* { version: '2', whatsapp_api: { type: 'text', text: { body: 'Here you go' } } },
|
|
20
|
+
* { version: '2', whatsapp_api: {
|
|
21
|
+
* type: 'document',
|
|
22
|
+
* document: { link: 'https://.../prices.pdf', filename: 'prices.pdf' } } },
|
|
23
|
+
* ],
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The payload under `whatsapp_api` is the same object `inbox.messages.send()`
|
|
28
|
+
* takes as `content`, which is the point: picking a reply is sending its
|
|
29
|
+
* payloads, with no translation step in between.
|
|
30
|
+
*
|
|
31
|
+
* Variable placeholders in a body are stored literally and substituted by the
|
|
32
|
+
* sender against the contact in front of the agent. There is no contact at the
|
|
33
|
+
* time a reply is written, so nothing is substituted here.
|
|
34
|
+
*/
|
|
35
|
+
export declare class CannedReplies {
|
|
36
|
+
private readonly http;
|
|
37
|
+
constructor(http: HttpClient);
|
|
38
|
+
/**
|
|
39
|
+
* `GET /v1/audience/canned-replies` -- offset paginated, newest first, with
|
|
40
|
+
* `messages` included on every row.
|
|
41
|
+
*
|
|
42
|
+
* Query: `page` (default 1), `rows` (1-100, default 25), `search` (matches the
|
|
43
|
+
* name, case-insensitive, substring, the term escaped), `type` (`CANNED` |
|
|
44
|
+
* `QUICK`), `channel` (a channel *type*, e.g. `whatsapp` -- not a channel id).
|
|
45
|
+
*
|
|
46
|
+
* To count without fetching, ask for `rows: 1` and read `pagination.total`.
|
|
47
|
+
*
|
|
48
|
+
* Scope: `canned_replies:read`.
|
|
49
|
+
*/
|
|
50
|
+
list(query?: Partial<ListCannedRepliesQuery>): Promise<Paginated<CannedReply>>;
|
|
51
|
+
/**
|
|
52
|
+
* `GET /v1/audience/canned-replies/:reply` -- by **id or name**.
|
|
53
|
+
*
|
|
54
|
+
* A 24-hex-character value is read as an id, anything else as a name. Names are
|
|
55
|
+
* unique per account, which is what makes addressing by the name an agent typed
|
|
56
|
+
* safe. 404 `not_found` if it is not the caller's.
|
|
57
|
+
*
|
|
58
|
+
* Scope: `canned_replies:read`.
|
|
59
|
+
*/
|
|
60
|
+
get(ref: string): Promise<CannedReply>;
|
|
61
|
+
/**
|
|
62
|
+
* `POST /v1/audience/canned-replies` -- 201 with the created reply.
|
|
63
|
+
*
|
|
64
|
+
* Body: `name` (1-120 chars, unique per account), `type`, `channel` (default
|
|
65
|
+
* `whatsapp`), `messages` (1-10, each `{ version: '2', whatsapp_api, internal? }`).
|
|
66
|
+
*
|
|
67
|
+
* Errors: 409 `conflict` if the name is taken. 422 `invalid_canned_reply` if a
|
|
68
|
+
* `QUICK` reply holds more than one message or a non-text one -- which legacy
|
|
69
|
+
* accepted and the panel then refused to use.
|
|
70
|
+
*
|
|
71
|
+
* Scope: `canned_replies:write`.
|
|
72
|
+
*/
|
|
73
|
+
create(input: CreateCannedReplyInput): Promise<CannedReply>;
|
|
74
|
+
/**
|
|
75
|
+
* `PATCH /v1/audience/canned-replies/:reply` -- by id or name, any subset of
|
|
76
|
+
* the create body.
|
|
77
|
+
*
|
|
78
|
+
* `messages` is replaced whole, never merged: send the array you want stored.
|
|
79
|
+
* Renaming works (it silently did not in legacy, which `$set` only `messages`).
|
|
80
|
+
*
|
|
81
|
+
* Errors: 404 `not_found`; 409 `conflict` on a rename into a taken name; 422
|
|
82
|
+
* `invalid_canned_reply` if the *merged* result breaks the `QUICK` rule -- so
|
|
83
|
+
* flipping a three-message reply to `QUICK` is refused, while renaming one that
|
|
84
|
+
* already breaks the rule is not.
|
|
85
|
+
*
|
|
86
|
+
* Scope: `canned_replies:write`.
|
|
87
|
+
*/
|
|
88
|
+
update(ref: string, input: UpdateCannedReplyInput): Promise<CannedReply>;
|
|
89
|
+
/**
|
|
90
|
+
* `DELETE /v1/audience/canned-replies/:reply` -- by id or name. 204, no body.
|
|
91
|
+
*
|
|
92
|
+
* Scope: `canned_replies:write`.
|
|
93
|
+
*/
|
|
94
|
+
delete(ref: string): Promise<void>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CannedReplies = void 0;
|
|
4
|
+
const paths_1 = require("../paths");
|
|
5
|
+
const BASE = `${paths_1.AUDIENCE}/canned-replies`;
|
|
6
|
+
/**
|
|
7
|
+
* Canned replies: message payloads an agent sends into a chat without retyping
|
|
8
|
+
* them.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds. A `CANNED` reply sends every message it holds, as stored, in order,
|
|
11
|
+
* the moment it is picked -- so a three-message reply is three messages on the
|
|
12
|
+
* contact's phone from one keystroke. A `QUICK` reply drops its text into the
|
|
13
|
+
* agent's composer to edit first, which is why it holds exactly one text message
|
|
14
|
+
* and nothing else.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* await crm.cannedReplies.create({
|
|
18
|
+
* name: 'price list',
|
|
19
|
+
* type: 'CANNED',
|
|
20
|
+
* channel: 'whatsapp',
|
|
21
|
+
* messages: [
|
|
22
|
+
* { version: '2', whatsapp_api: { type: 'text', text: { body: 'Here you go' } } },
|
|
23
|
+
* { version: '2', whatsapp_api: {
|
|
24
|
+
* type: 'document',
|
|
25
|
+
* document: { link: 'https://.../prices.pdf', filename: 'prices.pdf' } } },
|
|
26
|
+
* ],
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The payload under `whatsapp_api` is the same object `inbox.messages.send()`
|
|
31
|
+
* takes as `content`, which is the point: picking a reply is sending its
|
|
32
|
+
* payloads, with no translation step in between.
|
|
33
|
+
*
|
|
34
|
+
* Variable placeholders in a body are stored literally and substituted by the
|
|
35
|
+
* sender against the contact in front of the agent. There is no contact at the
|
|
36
|
+
* time a reply is written, so nothing is substituted here.
|
|
37
|
+
*/
|
|
38
|
+
class CannedReplies {
|
|
39
|
+
http;
|
|
40
|
+
constructor(http) {
|
|
41
|
+
this.http = http;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `GET /v1/audience/canned-replies` -- offset paginated, newest first, with
|
|
45
|
+
* `messages` included on every row.
|
|
46
|
+
*
|
|
47
|
+
* Query: `page` (default 1), `rows` (1-100, default 25), `search` (matches the
|
|
48
|
+
* name, case-insensitive, substring, the term escaped), `type` (`CANNED` |
|
|
49
|
+
* `QUICK`), `channel` (a channel *type*, e.g. `whatsapp` -- not a channel id).
|
|
50
|
+
*
|
|
51
|
+
* To count without fetching, ask for `rows: 1` and read `pagination.total`.
|
|
52
|
+
*
|
|
53
|
+
* Scope: `canned_replies:read`.
|
|
54
|
+
*/
|
|
55
|
+
list(query = {}) {
|
|
56
|
+
return this.http.request('GET', BASE, { query });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* `GET /v1/audience/canned-replies/:reply` -- by **id or name**.
|
|
60
|
+
*
|
|
61
|
+
* A 24-hex-character value is read as an id, anything else as a name. Names are
|
|
62
|
+
* unique per account, which is what makes addressing by the name an agent typed
|
|
63
|
+
* safe. 404 `not_found` if it is not the caller's.
|
|
64
|
+
*
|
|
65
|
+
* Scope: `canned_replies:read`.
|
|
66
|
+
*/
|
|
67
|
+
get(ref) {
|
|
68
|
+
return this.http.request('GET', `${BASE}/${(0, paths_1.seg)(ref)}`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `POST /v1/audience/canned-replies` -- 201 with the created reply.
|
|
72
|
+
*
|
|
73
|
+
* Body: `name` (1-120 chars, unique per account), `type`, `channel` (default
|
|
74
|
+
* `whatsapp`), `messages` (1-10, each `{ version: '2', whatsapp_api, internal? }`).
|
|
75
|
+
*
|
|
76
|
+
* Errors: 409 `conflict` if the name is taken. 422 `invalid_canned_reply` if a
|
|
77
|
+
* `QUICK` reply holds more than one message or a non-text one -- which legacy
|
|
78
|
+
* accepted and the panel then refused to use.
|
|
79
|
+
*
|
|
80
|
+
* Scope: `canned_replies:write`.
|
|
81
|
+
*/
|
|
82
|
+
create(input) {
|
|
83
|
+
return this.http.request('POST', BASE, { body: input });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `PATCH /v1/audience/canned-replies/:reply` -- by id or name, any subset of
|
|
87
|
+
* the create body.
|
|
88
|
+
*
|
|
89
|
+
* `messages` is replaced whole, never merged: send the array you want stored.
|
|
90
|
+
* Renaming works (it silently did not in legacy, which `$set` only `messages`).
|
|
91
|
+
*
|
|
92
|
+
* Errors: 404 `not_found`; 409 `conflict` on a rename into a taken name; 422
|
|
93
|
+
* `invalid_canned_reply` if the *merged* result breaks the `QUICK` rule -- so
|
|
94
|
+
* flipping a three-message reply to `QUICK` is refused, while renaming one that
|
|
95
|
+
* already breaks the rule is not.
|
|
96
|
+
*
|
|
97
|
+
* Scope: `canned_replies:write`.
|
|
98
|
+
*/
|
|
99
|
+
update(ref, input) {
|
|
100
|
+
return this.http.request('PATCH', `${BASE}/${(0, paths_1.seg)(ref)}`, { body: input });
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* `DELETE /v1/audience/canned-replies/:reply` -- by id or name. 204, no body.
|
|
104
|
+
*
|
|
105
|
+
* Scope: `canned_replies:write`.
|
|
106
|
+
*/
|
|
107
|
+
delete(ref) {
|
|
108
|
+
return this.http.request('DELETE', `${BASE}/${(0, paths_1.seg)(ref)}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.CannedReplies = CannedReplies;
|
|
112
|
+
//# sourceMappingURL=canned-replies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canned-replies.js","sourceRoot":"","sources":["../../../src/resources/audience/canned-replies.ts"],"names":[],"mappings":";;;AAQA,oCAAyC;AAEzC,MAAM,IAAI,GAAG,GAAG,gBAAQ,iBAAiB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,QAAyC,EAAE;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAyB,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc,KAAK,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAA6B;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,GAAW,EAAE,KAA6B;QAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc,OAAO,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAO,QAAQ,EAAE,GAAG,IAAI,IAAI,IAAA,WAAG,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AA1ED,sCA0EC"}
|
|
@@ -38,6 +38,20 @@ import type { HttpClient } from '../../http';
|
|
|
38
38
|
* the platform resolves it from the client the call arrives on and stamps it onto
|
|
39
39
|
* the row, because a token is only sendable through the project that minted it
|
|
40
40
|
* and nothing in the token says which.
|
|
41
|
+
*
|
|
42
|
+
* ## What a subscribed device then receives
|
|
43
|
+
*
|
|
44
|
+
* One notification per **message the business did not send itself** -- a
|
|
45
|
+
* contact's reply, or an echo of somebody answering from the WhatsApp Business
|
|
46
|
+
* app -- on a chat the device's owner is responsible for: the assigned agent, or
|
|
47
|
+
* the account owner while the chat is unassigned. An agent's own reply, a bot's,
|
|
48
|
+
* a campaign send and a delivery receipt all notify nobody.
|
|
49
|
+
*
|
|
50
|
+
* The title is who wrote; the body is the message text, or `Image Message` and
|
|
51
|
+
* the like for media. `data.chat` is the chat id, `webpush.fcmOptions.link` is
|
|
52
|
+
* what a browser opens on click, and `data.click_action` is that same URL on web
|
|
53
|
+
* and the bare chat id on a native app. The payload is documented key by key in
|
|
54
|
+
* `docs/audience/notifications.md`.
|
|
41
55
|
*/
|
|
42
56
|
export declare class Notifications {
|
|
43
57
|
private readonly http;
|
|
@@ -47,6 +47,20 @@ const MAX_LABEL = 200;
|
|
|
47
47
|
* the platform resolves it from the client the call arrives on and stamps it onto
|
|
48
48
|
* the row, because a token is only sendable through the project that minted it
|
|
49
49
|
* and nothing in the token says which.
|
|
50
|
+
*
|
|
51
|
+
* ## What a subscribed device then receives
|
|
52
|
+
*
|
|
53
|
+
* One notification per **message the business did not send itself** -- a
|
|
54
|
+
* contact's reply, or an echo of somebody answering from the WhatsApp Business
|
|
55
|
+
* app -- on a chat the device's owner is responsible for: the assigned agent, or
|
|
56
|
+
* the account owner while the chat is unassigned. An agent's own reply, a bot's,
|
|
57
|
+
* a campaign send and a delivery receipt all notify nobody.
|
|
58
|
+
*
|
|
59
|
+
* The title is who wrote; the body is the message text, or `Image Message` and
|
|
60
|
+
* the like for media. `data.chat` is the chat id, `webpush.fcmOptions.link` is
|
|
61
|
+
* what a browser opens on click, and `data.click_action` is that same URL on web
|
|
62
|
+
* and the bare chat id on a native app. The payload is documented key by key in
|
|
63
|
+
* `docs/audience/notifications.md`.
|
|
50
64
|
*/
|
|
51
65
|
class Notifications {
|
|
52
66
|
http;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/resources/audience/notifications.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,kDAAuE;AACvE,oCAAoC;AAEpC,MAAM,IAAI,GAAG,GAAG,gBAAQ,UAAU,CAAC;AAEnC,6FAA6F;AAC7F,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAE5C,wFAAwF;AACxF,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../src/resources/audience/notifications.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,kDAAuE;AACvE,oCAAoC;AAEpC,MAAM,IAAI,GAAG,GAAG,gBAAQ,UAAU,CAAC;AAEnC,6FAA6F;AAC7F,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAE5C,wFAAwF;AACxF,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiEG;IACH,SAAS,CAAC,KAAkC;QAC1C,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAEzC,IAAI,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,IAAI,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;YACvE,MAAM,IAAI,oBAAW,CACnB,GAAG,EACH,mBAAmB,EACnB,kDAAkD,YAAY,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,aAAa,CACrG,CAAC;QACJ,CAA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EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CAAC,QAAmC,EAAE;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;CACF;AAhLD,sCAgLC"}
|
|
@@ -5,13 +5,19 @@ import type { HttpClient } from '../http';
|
|
|
5
5
|
* Campaign reporting: what actually happened to each message.
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
|
-
* const stats = await crm.campaignMessages.stats(
|
|
8
|
+
* const stats = await crm.campaignMessages.stats(campaign);
|
|
9
9
|
* // { total: 12480, sent: 12410, delivered: 11980, read: 7420, replied: 310, failed: 70 }
|
|
10
10
|
*
|
|
11
|
-
* const { data } = await crm.campaignMessages.list(
|
|
11
|
+
* const { data } = await crm.campaignMessages.list(campaign, { status: 'failed' });
|
|
12
12
|
* data[0].error; // why that one did not go
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
+
* Every method takes the campaign id first. A report has no meaning without one,
|
|
16
|
+
* so it is addressed as the campaign's own sub-resource --
|
|
17
|
+
* `/v1/campaigns/:id/report` -- rather than as a collection of rows that a
|
|
18
|
+
* campaign filters. The options object holds only what *narrows* a report that
|
|
19
|
+
* already exists: a message index, a status, a page.
|
|
20
|
+
*
|
|
15
21
|
* ## Where these numbers come from
|
|
16
22
|
*
|
|
17
23
|
* One row per attempted send, written by the campaign manager as it hands each
|
|
@@ -44,18 +50,17 @@ export declare class CampaignMessages {
|
|
|
44
50
|
/**
|
|
45
51
|
* The campaign's funnel counts.
|
|
46
52
|
*
|
|
47
|
-
* `GET /v1/
|
|
53
|
+
* `GET /v1/campaigns/:id/report` · `campaigns:read` · **200**
|
|
48
54
|
*
|
|
49
55
|
* ### Query
|
|
50
56
|
*
|
|
51
|
-
* | Field | Type |
|
|
52
|
-
* | --- | --- | --- |
|
|
53
|
-
* | `
|
|
54
|
-
* | `message` | number | no | One message of a multi-message campaign, zero-based. |
|
|
57
|
+
* | Field | Type | Notes |
|
|
58
|
+
* | --- | --- | --- |
|
|
59
|
+
* | `message` | number | One message of a multi-message campaign, zero-based. Omit for the whole campaign. |
|
|
55
60
|
*
|
|
56
61
|
* ```ts
|
|
57
|
-
* const overall = await crm.campaignMessages.stats(
|
|
58
|
-
* const second = await crm.campaignMessages.stats(
|
|
62
|
+
* const overall = await crm.campaignMessages.stats(campaign);
|
|
63
|
+
* const second = await crm.campaignMessages.stats(campaign, { message: 1 });
|
|
59
64
|
* ```
|
|
60
65
|
*
|
|
61
66
|
* No date window: a campaign is one send, so its whole life is the only
|
|
@@ -65,17 +70,16 @@ export declare class CampaignMessages {
|
|
|
65
70
|
* `404 not_found` if the campaign is not the caller's -- the same answer as a
|
|
66
71
|
* campaign that does not exist, so the error cannot be used to probe ids.
|
|
67
72
|
*/
|
|
68
|
-
stats(
|
|
73
|
+
stats(campaign: string, query?: CampaignMessageStatsQuery): Promise<CampaignMessageStats>;
|
|
69
74
|
/**
|
|
70
75
|
* The rows behind the funnel. This is the report table.
|
|
71
76
|
*
|
|
72
|
-
* `GET /v1/
|
|
77
|
+
* `GET /v1/campaigns/:id/report/messages` · `campaigns:read` · **200**
|
|
73
78
|
*
|
|
74
79
|
* ### Query
|
|
75
80
|
*
|
|
76
81
|
* | Field | Type | Default | Notes |
|
|
77
82
|
* | --- | --- | --- | --- |
|
|
78
|
-
* | `campaign` | string | — | Required. |
|
|
79
83
|
* | `message` | number | — | Zero-based index of one campaign message. |
|
|
80
84
|
* | `status` | `sent \| delivered \| read \| replied \| failed` | — | Cumulative; see below. Omit for every row. |
|
|
81
85
|
* | `exact` | boolean | `false` | Only rows sitting at `status` right now. |
|
|
@@ -91,20 +95,20 @@ export declare class CampaignMessages {
|
|
|
91
95
|
*
|
|
92
96
|
* ```ts
|
|
93
97
|
* // the two queries a report screen actually makes
|
|
94
|
-
* const failures = await crm.campaignMessages.list(
|
|
95
|
-
* const unread = await crm.campaignMessages.list(
|
|
98
|
+
* const failures = await crm.campaignMessages.list(campaign, { status: 'failed', rows: 100 });
|
|
99
|
+
* const unread = await crm.campaignMessages.list(campaign, { status: 'delivered', exact: true });
|
|
96
100
|
* ```
|
|
97
101
|
*
|
|
98
102
|
* `reply_type` and `replied_within_hours` are **refused** with
|
|
99
|
-
* `
|
|
103
|
+
* `422 validation_failed` unless `status` is `replied`, rather than quietly
|
|
100
104
|
* matching nothing.
|
|
101
105
|
*/
|
|
102
|
-
list(
|
|
106
|
+
list(campaign: string, query?: ListCampaignMessagesQuery): Promise<Paginated<CampaignMessageRecord>>;
|
|
103
107
|
/**
|
|
104
108
|
* Every matching row, paged through for you. What an export is.
|
|
105
109
|
*
|
|
106
110
|
* ```ts
|
|
107
|
-
* for await (const row of crm.campaignMessages.iterate(
|
|
111
|
+
* for await (const row of crm.campaignMessages.iterate(campaign)) {
|
|
108
112
|
* csv.write([row.identifier, row.name, row.status, row.error ?? '']);
|
|
109
113
|
* }
|
|
110
114
|
* ```
|
|
@@ -119,22 +123,21 @@ export declare class CampaignMessages {
|
|
|
119
123
|
* moving data can repeat or skip a row -- for a stable snapshot, export after
|
|
120
124
|
* the campaign completes.
|
|
121
125
|
*/
|
|
122
|
-
iterate(
|
|
126
|
+
iterate(campaign: string, query?: ListCampaignMessagesQuery): AsyncGenerator<CampaignMessageRecord>;
|
|
123
127
|
/**
|
|
124
128
|
* What people replied, grouped by the reply itself.
|
|
125
129
|
*
|
|
126
|
-
* `GET /v1/
|
|
130
|
+
* `GET /v1/campaigns/:id/report/replies` · `campaigns:read` · **200**
|
|
127
131
|
*
|
|
128
132
|
* ### Query
|
|
129
133
|
*
|
|
130
134
|
* | Field | Type | Default | Notes |
|
|
131
135
|
* | --- | --- | --- | --- |
|
|
132
|
-
* | `campaign` | string | — | Required. |
|
|
133
136
|
* | `message` | number | — | Zero-based index of one campaign message. |
|
|
134
137
|
* | `limit` | number | `50` | Distinct replies to return, 1–200. |
|
|
135
138
|
*
|
|
136
139
|
* ```ts
|
|
137
|
-
* const { groups, replied, distinct } = await crm.campaignMessages.replies(
|
|
140
|
+
* const { groups, replied, distinct } = await crm.campaignMessages.replies(campaign);
|
|
138
141
|
* groups; // [{ reply: 'Yes', replyType: 'button', count: 182 }, …]
|
|
139
142
|
* ```
|
|
140
143
|
*
|
|
@@ -146,5 +149,5 @@ export declare class CampaignMessages {
|
|
|
146
149
|
* complete. A campaign that asked an open question has as many groups as it
|
|
147
150
|
* has repliers, so a truncated answer there is normal rather than a problem.
|
|
148
151
|
*/
|
|
149
|
-
replies(
|
|
152
|
+
replies(campaign: string, query?: CampaignRepliesQuery): Promise<CampaignReplyBreakdown>;
|
|
150
153
|
}
|