@sentdm/sentdm 0.40.0 → 0.41.0

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 (40) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +1 -1
  3. package/resources/conversations.d.mts +63 -8
  4. package/resources/conversations.d.mts.map +1 -1
  5. package/resources/conversations.d.ts +63 -8
  6. package/resources/conversations.d.ts.map +1 -1
  7. package/resources/me.d.mts +21 -0
  8. package/resources/me.d.mts.map +1 -1
  9. package/resources/me.d.ts +21 -0
  10. package/resources/me.d.ts.map +1 -1
  11. package/resources/me.js +5 -0
  12. package/resources/me.js.map +1 -1
  13. package/resources/me.mjs +5 -0
  14. package/resources/me.mjs.map +1 -1
  15. package/resources/messages.d.mts +76 -8
  16. package/resources/messages.d.mts.map +1 -1
  17. package/resources/messages.d.ts +76 -8
  18. package/resources/messages.d.ts.map +1 -1
  19. package/resources/templates.d.mts +7 -0
  20. package/resources/templates.d.mts.map +1 -1
  21. package/resources/templates.d.ts +7 -0
  22. package/resources/templates.d.ts.map +1 -1
  23. package/resources/webhooks.d.mts +213 -7
  24. package/resources/webhooks.d.mts.map +1 -1
  25. package/resources/webhooks.d.ts +213 -7
  26. package/resources/webhooks.d.ts.map +1 -1
  27. package/resources/webhooks.js +3 -1
  28. package/resources/webhooks.js.map +1 -1
  29. package/resources/webhooks.mjs +3 -1
  30. package/resources/webhooks.mjs.map +1 -1
  31. package/src/resources/conversations.ts +70 -8
  32. package/src/resources/me.ts +22 -0
  33. package/src/resources/messages.ts +85 -8
  34. package/src/resources/templates.ts +8 -0
  35. package/src/resources/webhooks.ts +238 -7
  36. package/src/version.ts +1 -1
  37. package/version.d.mts +1 -1
  38. package/version.d.ts +1 -1
  39. package/version.js +1 -1
  40. package/version.mjs +1 -1
@@ -197,6 +197,21 @@ export namespace MessageRetrieveActivitiesResponse {
197
197
  */
198
198
  price?: string | null;
199
199
 
200
+ /**
201
+ * A human-readable sentence for reason_code, for example "The recipient is not
202
+ * registered on this channel" Omitted whenever reason_code is.
203
+ */
204
+ reason?: string | null;
205
+
206
+ /**
207
+ * Why the message reached this status, as a stable platform code such as
208
+ * DELIVERY_007 or BUSINESS_003. Present on FAILED, FILTERED and BLOCKED
209
+ * activities; omitted on every status that needs no explanation. Switch on this
210
+ * rather than on reason: the code is stable, the wording may be improved. Same
211
+ * wire name and vocabulary as on the message and the webhook.
212
+ */
213
+ reason_code?: string | null;
214
+
200
215
  /**
201
216
  * SCHEDULED activities only: when the held message will be released for delivery,
202
217
  * in UTC. Same wire name as on the send response, the message and the webhook.
@@ -294,6 +309,22 @@ export namespace MessageRetrieveStatusResponse {
294
309
 
295
310
  price?: number | null;
296
311
 
312
+ /**
313
+ * A human-readable sentence for reason_code, for example "Insufficient balance".
314
+ * Omitted whenever reason_code is.
315
+ */
316
+ reason?: string | null;
317
+
318
+ /**
319
+ * Why the message is at its current status, as a stable platform code such as
320
+ * DELIVERY_007, BUSINESS_003 or DELIVERY_003. Present when the current status is
321
+ * FAILED, FILTERED or BLOCKED and the lifecycle was loaded; omitted otherwise.
322
+ * Switch on this rather than on reason: the code is stable, the wording may be
323
+ * improved. It is the platform's classification of the outcome, never a carrier or
324
+ * vendor code.
325
+ */
326
+ reason_code?: string | null;
327
+
297
328
  region_code?: string;
298
329
 
299
330
  status?: string;
@@ -315,6 +346,19 @@ export namespace MessageRetrieveStatusResponse {
315
346
  timestamp: string;
316
347
 
317
348
  description?: string | null;
349
+
350
+ /**
351
+ * A human-readable sentence for reason_code. Omitted whenever reason_code is.
352
+ */
353
+ reason?: string | null;
354
+
355
+ /**
356
+ * Why the message reached this status, as a stable platform code such as
357
+ * DELIVERY_007. Present on FAILED, FILTERED and BLOCKED events; omitted on every
358
+ * status that needs no explanation. Same wire name and vocabulary as on the
359
+ * activities list and the webhook.
360
+ */
361
+ reason_code?: string | null;
318
362
  }
319
363
 
320
364
  /**
@@ -388,21 +432,54 @@ export namespace MessageRetrieveStatusResponse {
388
432
  }
389
433
 
390
434
  /**
391
- * One attachment on a message: a customer-supplied public URL handed to the
392
- * carrier as-is.
435
+ * One attachment on a message, in either direction — and in both, a URL somebody
436
+ * else hosts.
437
+ *
438
+ * Outbound: the customer supplied a public URL and we handed it to the carrier.
439
+ * Inbound: the carrier hosts the file and we record where. sent.dm never holds the
440
+ * bytes, so there is no key, no expiry bookkeeping and nothing minted per read —
441
+ * what is stored is what is served.
442
+ *
443
+ * An inbound link expires on the carrier's own schedule and is unauthenticated.
444
+ * That is the customer's to manage, and it is documented where they will see it
445
+ * rather than only here — a recipient who needs an attachment to outlive that
446
+ * window copies it on receipt.
393
447
  *
394
- * A URL and nothing else. sent.dm never takes custody of MMS media — the customer hosts it and we
395
- * pass the link through at send time — so there is no storage key, size or expiry to record. If we ever
396
- * do host attachments, that belongs with the change that introduces the hosting, not here.
448
+ * Storing a presigned URL is the specific mistake this shape still avoids:
449
+ * M260826130000 and M260826140000 exist because RCS assets were stored as signed
450
+ * URLs and went stale. Nothing here is signed.
397
451
  */
398
452
  export interface Media {
399
453
  /**
400
- * One of Constants.MmsMediaTypes when known. Advisory — the carrier reads the
401
- * fetched object's Content-Type, not this.
454
+ * One of MmsMediaTypes when the content type is known. Advisory — a reader should
455
+ * trust the fetched object's own Content-Type.
402
456
  */
403
457
  mediaType?: string | null;
404
458
 
405
- url?: string;
459
+ /**
460
+ * Content type as the provider declared it. Null when it declared none.
461
+ */
462
+ mimeType?: string | null;
463
+
464
+ /**
465
+ * Size as the provider declared it. Never measured here — nothing downloads the
466
+ * file.
467
+ */
468
+ sizeBytes?: number | null;
469
+
470
+ /**
471
+ * Inbound only: the SHA-256 the provider declared alongside the attachment, when
472
+ * it declared one. Relayed to the customer so they can verify what they fetch
473
+ * matches what the carrier said it sent. It is the only integrity signal available
474
+ * on an attachment nobody here has read.
475
+ */
476
+ sourceHashSha256?: string | null;
477
+
478
+ /**
479
+ * Where the file lives. Outbound: the URL the customer gave us and the carrier
480
+ * fetched. Inbound: the URL the carrier hosts it at, relayed unchanged.
481
+ */
482
+ url?: string | null;
406
483
  }
407
484
  }
408
485
  }
@@ -720,6 +720,14 @@ export namespace TemplateVariable {
720
720
  }
721
721
 
722
722
  export interface TemplateCreateParams {
723
+ /**
724
+ * Body param: Create this template automatically on every sender profile of the
725
+ * organization, now and in future (default: false). Accepted only from an
726
+ * organization that has been enabled for it, and only at creation — it cannot be
727
+ * changed afterwards.
728
+ */
729
+ auto_create_for_sp?: boolean;
730
+
723
731
  /**
724
732
  * Body param: Template category: MARKETING, UTILITY, AUTHENTICATION (optional,
725
733
  * auto-detected if not provided)
@@ -169,7 +169,9 @@ export class Webhooks extends APIResource {
169
169
  }
170
170
 
171
171
  /**
172
- * Retrieves a paginated list of delivery events for the specified webhook.
172
+ * Retrieves a paginated list of delivery events for the specified webhook. If the
173
+ * webhook is cloned onto your sender profiles, the list includes what those clones
174
+ * received; read payload.account_id to tell whose event it is.
173
175
  *
174
176
  * @example
175
177
  * ```ts
@@ -467,13 +469,20 @@ export interface ChannelEventPayload {
467
469
  number_type?: string | null;
468
470
 
469
471
  /**
470
- * Why the market reached this state, when a reason was given — a correction
471
- * explained, or a campaign lapse. Free text, passed through from the registry or
472
- * carrier that wrote it, so treat it as a message to show a human rather than a
473
- * value to branch on.
472
+ * Why the market reached this state, as a sentence to show a person: the specific
473
+ * explanation when one was given (a correction explained, a campaign lapse),
474
+ * otherwise what reason_code means for this market. Not a value to branch on.
474
475
  */
475
476
  reason?: string | null;
476
477
 
478
+ /**
479
+ * Why the market is not ACTIVE, as a stable code: an ErrorCodes CHANNEL_xxx value
480
+ * such as CHANNEL_001 (something you owe) or CHANNEL_002 (a correction was
481
+ * requested). The same code the channels resource reports for the market. Switch
482
+ * on this rather than on reason. Omitted while ACTIVE.
483
+ */
484
+ reason_code?: string | null;
485
+
477
486
  /**
478
487
  * The sender itself — a number in E.164, or an alphanumeric sender ID.
479
488
  *
@@ -867,10 +876,24 @@ export interface InboundMessageEventPayload {
867
876
  account_id?: string;
868
877
 
869
878
  /**
870
- * The channel the message arrived on, for example sms or whatsapp.
879
+ * The channel the message arrived on, for example sms or mms.
871
880
  */
872
881
  channel?: string;
873
882
 
883
+ /**
884
+ * Attachments the contact sent, present only on channels that carry them (mms
885
+ * today) and omitted entirely otherwise.
886
+ *
887
+ * Each url points at the carrier's own copy of the file — sent.dm records where
888
+ * the attachment is, not the attachment itself. The link is unauthenticated and
889
+ * expires on the carrier's schedule, which differs between them: assume days, not
890
+ * months. Download what you need on receipt; re-reading the message through GET
891
+ * /v3/messages/{id} returns the same stored link, not a fresh one, so once it
892
+ * lapses the entry remains with whatever the carrier declared about the file but
893
+ * the file is no longer reachable.
894
+ */
895
+ media?: Array<InboundMessageEventPayload.Media> | null;
896
+
874
897
  /**
875
898
  * The inbound message.
876
899
  */
@@ -895,6 +918,41 @@ export interface InboundMessageEventPayload {
895
918
  updated_at?: string;
896
919
  }
897
920
 
921
+ export namespace InboundMessageEventPayload {
922
+ /**
923
+ * One attachment on an inbound message.
924
+ */
925
+ export interface Media {
926
+ /**
927
+ * SHA-256 of the file as the carrier declared it, when it declares one. Verify
928
+ * what you download against this — sent.dm never reads the bytes, so it is the
929
+ * only integrity signal available.
930
+ */
931
+ hash_sha256?: string | null;
932
+
933
+ /**
934
+ * Content type as the carrier reported it, for example image/jpeg.
935
+ */
936
+ mime_type?: string | null;
937
+
938
+ /**
939
+ * Size in bytes as the carrier declared it. Absent when it declared none.
940
+ */
941
+ size_bytes?: number | null;
942
+
943
+ /**
944
+ * Where the carrier hosts the attachment.
945
+ *
946
+ * This link expires and is not authenticated. sent.dm relays it rather than
947
+ * copying the file, so how long it stays fetchable is the carrier's decision and
948
+ * differs between them — assume days, not months. Anyone holding the URL can fetch
949
+ * it until it lapses. Copy the file on receipt if you need it to outlive that
950
+ * window; do not store this URL as a permanent reference.
951
+ */
952
+ url?: string | null;
953
+ }
954
+ }
955
+
898
956
  /**
899
957
  * The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
900
958
  * this shape and varies only in Payload.
@@ -980,6 +1038,22 @@ export interface MessageEventPayload {
980
1038
  */
981
1039
  outbound_number?: string;
982
1040
 
1041
+ /**
1042
+ * A human-readable sentence for ReasonCode, for example "The recipient is not
1043
+ * registered on this channel". Omitted whenever reason_code is.
1044
+ */
1045
+ reason?: string | null;
1046
+
1047
+ /**
1048
+ * Why the message reached this status, as a stable platform code such as
1049
+ * DELIVERY_007 or BUSINESS_003. Present on message.failed, message.filtered and
1050
+ * message.blocked; omitted on every status that needs no explanation. Switch on
1051
+ * this rather than on Reason: the code is stable, the wording may be improved. It
1052
+ * is the platform's classification of the outcome and never a carrier or vendor
1053
+ * code.
1054
+ */
1055
+ reason_code?: string | null;
1056
+
983
1057
  /**
984
1058
  * message.scheduled only: why the message is held, either because you scheduled it
985
1059
  * or because the recipient is inside a protected quiet-hours window. Omitted on
@@ -1312,7 +1386,8 @@ export interface WebhookListEventsResponse {
1312
1386
  | TemplateEvent
1313
1387
  | ChannelEvent
1314
1388
  | ContactEvent
1315
- | WebhookListEventsResponse.SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload;
1389
+ | WebhookListEventsResponse.SentDmServicesCommonServicesWebhooksContractsWebhookEventOfLinkWebhookPayload
1390
+ | WebhookListEventsResponse.SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload;
1316
1391
 
1317
1392
  event_type?: string;
1318
1393
 
@@ -1535,6 +1610,124 @@ export namespace WebhookListEventsResponse {
1535
1610
  traffic_class?: string | null;
1536
1611
  }
1537
1612
  }
1613
+
1614
+ /**
1615
+ * The envelope Sent POSTs to a subscribed webhook endpoint. Every event shares
1616
+ * this shape and varies only in Payload.
1617
+ */
1618
+ export interface SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload {
1619
+ /**
1620
+ * The specific event within the family, for example message.delivered,
1621
+ * message.received or contact.opt_out. Absent on events that have no subtype, so
1622
+ * treat it as optional.
1623
+ */
1624
+ event?: string | null;
1625
+
1626
+ /**
1627
+ * The event family, for example message, templates or contact. Route on this
1628
+ * first, then on event for the specific change.
1629
+ */
1630
+ field?: string;
1631
+
1632
+ /**
1633
+ * Body of a call.initiated, call.answered, call.completed, call.failed or
1634
+ * call.recording_ready event. Which of them occurred is the envelope's event.
1635
+ *
1636
+ * Shaped like the message, inbound, template and channel payloads: account_id
1637
+ * names the account the event is about, channel names the channel, and updated_at
1638
+ * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
1639
+ * duration_seconds and price are added on call.completed, reason on call.failed
1640
+ * and recording_id on call.recording_ready; each is omitted rather than sent as
1641
+ * null when it does not apply.
1642
+ *
1643
+ * Casing is snake_case because these ride the same webhook stream customers
1644
+ * already parse message_id from; the question/answer contract is a separate
1645
+ * surface and stays camelCase. Nothing here is provider-shaped: no provider call
1646
+ * id, no namespaced identity.
1647
+ */
1648
+ payload?: SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload.Payload | null;
1649
+
1650
+ /**
1651
+ * The event-specific body.
1652
+ */
1653
+ request_id?: string | null;
1654
+
1655
+ /**
1656
+ * When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ). This is the emission
1657
+ * time, not the time the underlying change happened. Use the timestamp inside the
1658
+ * payload for the latter.
1659
+ */
1660
+ timestamp?: string;
1661
+ }
1662
+
1663
+ export namespace SentDmServicesCommonServicesWebhooksContractsWebhookEventOfCallWebhookPayload {
1664
+ /**
1665
+ * Body of a call.initiated, call.answered, call.completed, call.failed or
1666
+ * call.recording_ready event. Which of them occurred is the envelope's event.
1667
+ *
1668
+ * Shaped like the message, inbound, template and channel payloads: account_id
1669
+ * names the account the event is about, channel names the channel, and updated_at
1670
+ * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
1671
+ * duration_seconds and price are added on call.completed, reason on call.failed
1672
+ * and recording_id on call.recording_ready; each is omitted rather than sent as
1673
+ * null when it does not apply.
1674
+ *
1675
+ * Casing is snake_case because these ride the same webhook stream customers
1676
+ * already parse message_id from; the question/answer contract is a separate
1677
+ * surface and stays camelCase. Nothing here is provider-shaped: no provider call
1678
+ * id, no namespaced identity.
1679
+ */
1680
+ export interface Payload {
1681
+ /**
1682
+ * Sent's call id, the same one the customer saw on the first question.
1683
+ */
1684
+ call_id: string;
1685
+
1686
+ /**
1687
+ * The account the call belongs to: the key's own customer, or the sender profile
1688
+ * it acted as.
1689
+ */
1690
+ account_id?: string;
1691
+
1692
+ /**
1693
+ * Always voice.
1694
+ */
1695
+ channel?: string;
1696
+
1697
+ /**
1698
+ * How long the call lasted. Only on call.completed.
1699
+ */
1700
+ duration_seconds?: number | null;
1701
+
1702
+ /**
1703
+ * The customer number that owns the call, in E.164 format.
1704
+ */
1705
+ number?: string;
1706
+
1707
+ /**
1708
+ * What the call was charged. Only on call.completed, and omitted there until
1709
+ * billing has recorded the charge.
1710
+ */
1711
+ price?: number | null;
1712
+
1713
+ /**
1714
+ * The machine-readable reason the call did not complete. Only on call.failed, and
1715
+ * omitted when no reason was recorded.
1716
+ */
1717
+ reason?: string | null;
1718
+
1719
+ /**
1720
+ * The recording that became available, the same id GET /v3/calls/{id}/recordings
1721
+ * lists it under. Only on call.recording_ready, which is sent once per recording.
1722
+ */
1723
+ recording_id?: string | null;
1724
+
1725
+ /**
1726
+ * When the change happened on the call, as opposed to when the event was emitted.
1727
+ */
1728
+ updated_at?: string;
1729
+ }
1730
+ }
1538
1731
  }
1539
1732
 
1540
1733
  /**
@@ -1639,6 +1832,13 @@ export interface WebhookCreateParams {
1639
1832
  */
1640
1833
  sandbox?: boolean;
1641
1834
 
1835
+ /**
1836
+ * Body param: Request-only: the events an organization webhook's sender profile
1837
+ * clones receive, one clone per existing and future profile. Responses never
1838
+ * return it.
1839
+ */
1840
+ sender_profile?: WebhookCreateParams.SenderProfile | null;
1841
+
1642
1842
  /**
1643
1843
  * Body param
1644
1844
  */
@@ -1659,6 +1859,18 @@ export interface WebhookCreateParams {
1659
1859
  'x-profile-id'?: string;
1660
1860
  }
1661
1861
 
1862
+ export namespace WebhookCreateParams {
1863
+ /**
1864
+ * Request-only: the events an organization webhook's sender profile clones
1865
+ * receive, one clone per existing and future profile. Responses never return it.
1866
+ */
1867
+ export interface SenderProfile {
1868
+ event_filters?: { [key: string]: Array<string> } | null;
1869
+
1870
+ event_types?: Array<string>;
1871
+ }
1872
+ }
1873
+
1662
1874
  export interface WebhookRetrieveParams {
1663
1875
  /**
1664
1876
  * Profile UUID to scope the request to a child profile. Only organization API keys
@@ -1699,6 +1911,13 @@ export interface WebhookUpdateParams {
1699
1911
  */
1700
1912
  sandbox?: boolean;
1701
1913
 
1914
+ /**
1915
+ * Body param: Request-only: the events an organization webhook's sender profile
1916
+ * clones receive, one clone per existing and future profile. Responses never
1917
+ * return it.
1918
+ */
1919
+ sender_profile?: WebhookUpdateParams.SenderProfile | null;
1920
+
1702
1921
  /**
1703
1922
  * Body param
1704
1923
  */
@@ -1719,6 +1938,18 @@ export interface WebhookUpdateParams {
1719
1938
  'x-profile-id'?: string;
1720
1939
  }
1721
1940
 
1941
+ export namespace WebhookUpdateParams {
1942
+ /**
1943
+ * Request-only: the events an organization webhook's sender profile clones
1944
+ * receive, one clone per existing and future profile. Responses never return it.
1945
+ */
1946
+ export interface SenderProfile {
1947
+ event_filters?: { [key: string]: Array<string> } | null;
1948
+
1949
+ event_types?: Array<string>;
1950
+ }
1951
+ }
1952
+
1722
1953
  export interface WebhookListParams extends WebhooksPageParams {
1723
1954
  /**
1724
1955
  * Query param
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.40.0'; // x-release-please-version
1
+ export const VERSION = '0.41.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.40.0";
1
+ export declare const VERSION = "0.41.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.40.0";
1
+ export declare const VERSION = "0.41.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.40.0'; // x-release-please-version
4
+ exports.VERSION = '0.41.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.40.0'; // x-release-please-version
1
+ export const VERSION = '0.41.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map