ab-ecosystem-cpass 1.0.6 → 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.
Files changed (44) hide show
  1. package/README.md +5 -2
  2. package/dist/client.d.ts +31 -6
  3. package/dist/client.js +36 -8
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.js +9 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/resources/audience/canned-replies.d.ts +95 -0
  9. package/dist/resources/audience/canned-replies.js +112 -0
  10. package/dist/resources/audience/canned-replies.js.map +1 -0
  11. package/dist/resources/audience/notifications.d.ts +14 -0
  12. package/dist/resources/audience/notifications.js +14 -0
  13. package/dist/resources/audience/notifications.js.map +1 -1
  14. package/dist/resources/campaign-messages.d.ts +153 -0
  15. package/dist/resources/campaign-messages.js +179 -0
  16. package/dist/resources/campaign-messages.js.map +1 -0
  17. package/dist/resources/data-stores.d.ts +469 -0
  18. package/dist/resources/data-stores.js +530 -0
  19. package/dist/resources/data-stores.js.map +1 -0
  20. package/dist/resources/paths.d.ts +6 -0
  21. package/dist/resources/paths.js +7 -1
  22. package/dist/resources/paths.js.map +1 -1
  23. package/dist/types/campaign.d.ts +137 -41
  24. package/dist/types/canned-reply.d.ts +124 -0
  25. package/dist/types/canned-reply.js +6 -0
  26. package/dist/types/canned-reply.js.map +1 -0
  27. package/dist/types/datastore.d.ts +260 -0
  28. package/dist/types/datastore.js +21 -0
  29. package/dist/types/datastore.js.map +1 -0
  30. package/dist/types/index.d.ts +2 -0
  31. package/dist/types/index.js +3 -0
  32. package/dist/types/index.js.map +1 -1
  33. package/docs/audience/canned-replies.md +302 -0
  34. package/docs/audience/notifications.md +99 -0
  35. package/docs/campaign/campaign-messages.md +282 -0
  36. package/docs/campaign/campaigns.md +8 -48
  37. package/docs/data-store.md +495 -0
  38. package/package.json +1 -1
  39. package/dist/resources/campaign-report-exports.d.ts +0 -14
  40. package/dist/resources/campaign-report-exports.js +0 -28
  41. package/dist/resources/campaign-report-exports.js.map +0 -1
  42. package/dist/resources/campaign-reports.d.ts +0 -15
  43. package/dist/resources/campaign-reports.js +0 -25
  44. package/dist/resources/campaign-reports.js.map +0 -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,8 +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.campaignReports` | [campaigns](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/campaign/campaigns.md#campaign-reports) | `list` `getByCampaign` |
279
- | `crm.campaignReportExports` | [campaigns](https://github.com/udghatan-dev/crm-sdk/blob/main/packages/sdk-js/docs/campaign/campaigns.md#campaign-reports) | `list` `get` `create` |
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 |
280
283
 
281
284
  The audience helpers are exported too, so a UI can show "12,480 recipients, 3
282
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';
@@ -18,8 +20,7 @@ import { Billing } from './resources/channels/billing';
18
20
  import { Wallet } from './resources/channels/wallet';
19
21
  import { Activity } from './resources/channels/activity';
20
22
  import { Campaigns } from './resources/campaigns';
21
- import { CampaignReports } from './resources/campaign-reports';
22
- import { CampaignReportExports } from './resources/campaign-report-exports';
23
+ import { CampaignMessages } from './resources/campaign-messages';
23
24
  /**
24
25
  * One client for the whole gateway. Construct it once and share it: it holds no
25
26
  * per-request state, and every resource below runs over the same HTTP client,
@@ -41,6 +42,15 @@ export declare class CrmClient {
41
42
  readonly contactNotes: ContactNotes;
42
43
  /** Custom fields: the per-account contact schema. */
43
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;
44
54
  /** Segments: saved contact filters. */
45
55
  readonly segments: Segments;
46
56
  /** CRM triggers: fire a webhook when a contact changes, plus their delivery logs. */
@@ -70,6 +80,19 @@ export declare class CrmClient {
70
80
  * token, `unsubscribe()` on logout.
71
81
  */
72
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;
73
96
  /** Channels, and the provider properties that hang off them. */
74
97
  readonly channels: Channels;
75
98
  /** WhatsApp message templates, per channel. */
@@ -91,9 +114,11 @@ export declare class CrmClient {
91
114
  * has to get exactly right.
92
115
  */
93
116
  readonly campaigns: Campaigns;
94
- /** Per-campaign delivery metrics. */
95
- readonly campaignReports: CampaignReports;
96
- /** Report extracts as CSV or XLSX, generated asynchronously. */
97
- readonly campaignReportExports: CampaignReportExports;
117
+ /**
118
+ * Campaign reporting: the funnel, the per-recipient rows behind it, and what
119
+ * people replied -- all counted off the message rows when asked for, so there
120
+ * is no roll-up to wait for and no export job to poll.
121
+ */
122
+ readonly campaignMessages: CampaignMessages;
98
123
  constructor(options: ClientOptions);
99
124
  }
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");
@@ -24,8 +26,7 @@ const wallet_1 = require("./resources/channels/wallet");
24
26
  const activity_1 = require("./resources/channels/activity");
25
27
  // Campaign
26
28
  const campaigns_1 = require("./resources/campaigns");
27
- const campaign_reports_1 = require("./resources/campaign-reports");
28
- const campaign_report_exports_1 = require("./resources/campaign-report-exports");
29
+ const campaign_messages_1 = require("./resources/campaign-messages");
29
30
  /**
30
31
  * One client for the whole gateway. Construct it once and share it: it holds no
31
32
  * per-request state, and every resource below runs over the same HTTP client,
@@ -48,6 +49,15 @@ class CrmClient {
48
49
  contactNotes;
49
50
  /** Custom fields: the per-account contact schema. */
50
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;
51
61
  /** Segments: saved contact filters. */
52
62
  segments;
53
63
  /** CRM triggers: fire a webhook when a contact changes, plus their delivery logs. */
@@ -77,6 +87,19 @@ class CrmClient {
77
87
  * token, `unsubscribe()` on logout.
78
88
  */
79
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;
80
103
  // -- Channels -------------------------------------------------------------
81
104
  /** Channels, and the provider properties that hang off them. */
82
105
  channels;
@@ -100,16 +123,19 @@ class CrmClient {
100
123
  * has to get exactly right.
101
124
  */
102
125
  campaigns;
103
- /** Per-campaign delivery metrics. */
104
- campaignReports;
105
- /** Report extracts as CSV or XLSX, generated asynchronously. */
106
- campaignReportExports;
126
+ /**
127
+ * Campaign reporting: the funnel, the per-recipient rows behind it, and what
128
+ * people replied -- all counted off the message rows when asked for, so there
129
+ * is no roll-up to wait for and no export job to poll.
130
+ */
131
+ campaignMessages;
107
132
  constructor(options) {
108
133
  const http = new http_1.HttpClient(options);
109
134
  this.contacts = new contacts_1.Contacts(http);
110
135
  this.contactTags = new contact_tags_1.ContactTags(http);
111
136
  this.contactNotes = new contact_notes_1.ContactNotes(http);
112
137
  this.customFields = new custom_fields_1.CustomFields(http);
138
+ this.cannedReplies = new canned_replies_1.CannedReplies(http);
113
139
  this.segments = new segments_1.Segments(http);
114
140
  this.crmTriggers = new crm_triggers_1.CrmTriggers(http);
115
141
  this.imports = new import_history_1.Imports(http);
@@ -118,6 +144,9 @@ class CrmClient {
118
144
  this.scheduledMessages = new scheduled_messages_1.ScheduledMessages(http);
119
145
  this.inboxMedia = new inbox_media_1.InboxMedia(http);
120
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);
121
150
  this.channels = new channels_1.Channels(http);
122
151
  this.templates = new templates_1.Templates(http);
123
152
  this.channelWebhooks = new webhooks_2.ChannelWebhooks(http);
@@ -128,8 +157,7 @@ class CrmClient {
128
157
  // audience is uploaded through the media endpoint before the campaign is
129
158
  // created.
130
159
  this.campaigns = new campaigns_1.Campaigns(http);
131
- this.campaignReports = new campaign_reports_1.CampaignReports(http);
132
- this.campaignReportExports = new campaign_report_exports_1.CampaignReportExports(http);
160
+ this.campaignMessages = new campaign_messages_1.CampaignMessages(http);
133
161
  }
134
162
  }
135
163
  exports.CrmClient = CrmClient;
@@ -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;AAEnE,WAAW;AACX,4DAAyD;AACzD,8DAA2D;AAC3D,4DAAgE;AAChE,0DAAuD;AACvD,wDAAqD;AACrD,4DAAyD;AAEzD,WAAW;AACX,qDAAkD;AAClD,mEAA+D;AAC/D,iFAA4E;AAE5E;;;;;;;;;;;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,uCAAuC;IAC9B,QAAQ,CAAW;IAC5B,qFAAqF;IAC5E,WAAW,CAAc;IAClC,kEAAkE;IACzD,OAAO,CAAU;IAC1B,yDAAyD;IAChD,OAAO,CAAU;IAC1B,0DAA0D;IACjD,QAAQ,CAAW;IAC5B;;;OAGG;IACM,iBAAiB,CAAoB;IAE9C;;;;;;OAMG;IACM,UAAU,CAAa;IAEhC;;;;OAIG;IACM,aAAa,CAAgB;IAEtC,4EAA4E;IAE5E,gEAAgE;IACvD,QAAQ,CAAW;IAC5B,+CAA+C;IACtC,SAAS,CAAY;IAC9B,wEAAwE;IAC/D,eAAe,CAAkB;IAC1C,yDAAyD;IAChD,OAAO,CAAU;IAC1B,6BAA6B;IACpB,MAAM,CAAS;IACxB,6BAA6B;IACpB,QAAQ,CAAW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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,10 +14,10 @@ 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
- export { CampaignReports } from './resources/campaign-reports';
19
- export { CampaignReportExports } from './resources/campaign-report-exports';
20
+ export { CampaignMessages } from './resources/campaign-messages';
20
21
  /**
21
22
  * The audience helpers, exported because they are useful before a campaign
22
23
  * exists: a UI can parse a CSV, show "12,480 recipients, 3 duplicates dropped",
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.CampaignReportExports = exports.CampaignReports = 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,15 +45,17 @@ 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
49
55
  var campaigns_1 = require("./resources/campaigns");
50
56
  Object.defineProperty(exports, "Campaigns", { enumerable: true, get: function () { return campaigns_1.Campaigns; } });
51
- var campaign_reports_1 = require("./resources/campaign-reports");
52
- Object.defineProperty(exports, "CampaignReports", { enumerable: true, get: function () { return campaign_reports_1.CampaignReports; } });
53
- var campaign_report_exports_1 = require("./resources/campaign-report-exports");
54
- Object.defineProperty(exports, "CampaignReportExports", { enumerable: true, get: function () { return campaign_report_exports_1.CampaignReportExports; } });
57
+ var campaign_messages_1 = require("./resources/campaign-messages");
58
+ Object.defineProperty(exports, "CampaignMessages", { enumerable: true, get: function () { return campaign_messages_1.CampaignMessages; } });
55
59
  /**
56
60
  * The audience helpers, exported because they are useful before a campaign
57
61
  * exists: a UI can parse a CSV, show "12,480 recipients, 3 duplicates dropped",
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;A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AA,YAAY,OAAA;AACrB,sEAAoE;AAA3D,+GAAA,aAAa,OAAA;AACtB,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,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;;;;;;;;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