sendblue 3.3.1 → 3.6.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 (50) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/client.d.mts +8 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +12 -1
  11. package/resources/contacts/contacts.d.mts +51 -2
  12. package/resources/contacts/contacts.d.mts.map +1 -1
  13. package/resources/contacts/contacts.d.ts +51 -2
  14. package/resources/contacts/contacts.d.ts.map +1 -1
  15. package/resources/contacts/contacts.js +18 -1
  16. package/resources/contacts/contacts.js.map +1 -1
  17. package/resources/contacts/contacts.mjs +18 -1
  18. package/resources/contacts/contacts.mjs.map +1 -1
  19. package/resources/contacts/index.d.mts +1 -1
  20. package/resources/contacts/index.d.mts.map +1 -1
  21. package/resources/contacts/index.d.ts +1 -1
  22. package/resources/contacts/index.d.ts.map +1 -1
  23. package/resources/contacts/index.js.map +1 -1
  24. package/resources/contacts/index.mjs.map +1 -1
  25. package/resources/index.d.mts +2 -1
  26. package/resources/index.d.mts.map +1 -1
  27. package/resources/index.d.ts +2 -1
  28. package/resources/index.d.ts.map +1 -1
  29. package/resources/index.js +3 -1
  30. package/resources/index.js.map +1 -1
  31. package/resources/index.mjs +1 -0
  32. package/resources/index.mjs.map +1 -1
  33. package/resources/send-carousel.d.mts +82 -0
  34. package/resources/send-carousel.d.mts.map +1 -0
  35. package/resources/send-carousel.d.ts +82 -0
  36. package/resources/send-carousel.d.ts.map +1 -0
  37. package/resources/send-carousel.js +33 -0
  38. package/resources/send-carousel.js.map +1 -0
  39. package/resources/send-carousel.mjs +29 -0
  40. package/resources/send-carousel.mjs.map +1 -0
  41. package/src/client.ts +16 -0
  42. package/src/resources/contacts/contacts.ts +63 -1
  43. package/src/resources/contacts/index.ts +2 -0
  44. package/src/resources/index.ts +3 -0
  45. package/src/resources/send-carousel.ts +117 -0
  46. package/src/version.ts +1 -1
  47. package/version.d.mts +1 -1
  48. package/version.d.ts +1 -1
  49. package/version.js +1 -1
  50. package/version.mjs +1 -1
@@ -42,7 +42,8 @@ export class Contacts extends APIResource {
42
42
  }
43
43
 
44
44
  /**
45
- * Update an existing contact
45
+ * Update an existing contact. You may set SMS opt-out with `opt_out` (boolean); it
46
+ * updates the same recipient record used for inbound keyword opt-outs.
46
47
  *
47
48
  * @example
48
49
  * ```ts
@@ -96,6 +97,23 @@ export class Contacts extends APIResource {
96
97
  return this._client.get('/api/v2/contacts/count', options);
97
98
  }
98
99
 
100
+ /**
101
+ * Opt a contact out (or back in) from receiving messages. When a recipient is
102
+ * opted out, outbound messages to that number will be blocked.
103
+ *
104
+ * Pass `opted_out: false` to opt a contact back in.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const response = await client.contacts.optOut({
109
+ * number: '+14155551234',
110
+ * });
111
+ * ```
112
+ */
113
+ optOut(body: ContactOptOutParams, options?: RequestOptions): APIPromise<ContactOptOutResponse> {
114
+ return this._client.post('/api/v2/contacts/opt-out', { body, ...options });
115
+ }
116
+
99
117
  /**
100
118
  * Send a verification message to a contact
101
119
  *
@@ -142,6 +160,11 @@ export interface Contact {
142
160
  */
143
161
  last_name?: string;
144
162
 
163
+ /**
164
+ * Whether the contact has opted out of SMS (from recipient opt-out state)
165
+ */
166
+ opt_out?: boolean;
167
+
145
168
  /**
146
169
  * Phone number in E.164 format
147
170
  */
@@ -194,6 +217,20 @@ export interface ContactCountResponse {
194
217
  count?: number;
195
218
  }
196
219
 
220
+ export interface ContactOptOutResponse {
221
+ /**
222
+ * The normalized phone number
223
+ */
224
+ number?: string;
225
+
226
+ /**
227
+ * The current opt-out status
228
+ */
229
+ opted_out?: boolean;
230
+
231
+ status?: string;
232
+ }
233
+
197
234
  export interface ContactVerifyResponse {
198
235
  status?: string;
199
236
  }
@@ -317,6 +354,17 @@ export interface ContactUpdateParams {
317
354
  */
318
355
  lastName?: string;
319
356
 
357
+ /**
358
+ * Whether the contact has opted out of SMS (updates the same recipient record used
359
+ * for inbound keyword opt-outs)
360
+ */
361
+ opt_out?: boolean;
362
+
363
+ /**
364
+ * @deprecated Deprecated, use opt_out
365
+ */
366
+ optOut?: boolean;
367
+
320
368
  /**
321
369
  * Associated Sendblue phone number (preferred)
322
370
  */
@@ -362,6 +410,18 @@ export interface ContactListParams {
362
410
  phone_number?: string;
363
411
  }
364
412
 
413
+ export interface ContactOptOutParams {
414
+ /**
415
+ * Phone number in E.164 format
416
+ */
417
+ number: string;
418
+
419
+ /**
420
+ * Set to false to opt the contact back in (defaults to true)
421
+ */
422
+ opted_out?: boolean;
423
+ }
424
+
365
425
  export interface ContactVerifyParams {
366
426
  /**
367
427
  * Phone number to verify
@@ -380,10 +440,12 @@ export declare namespace Contacts {
380
440
  type ContactListResponse as ContactListResponse,
381
441
  type ContactDeleteResponse as ContactDeleteResponse,
382
442
  type ContactCountResponse as ContactCountResponse,
443
+ type ContactOptOutResponse as ContactOptOutResponse,
383
444
  type ContactVerifyResponse as ContactVerifyResponse,
384
445
  type ContactCreateParams as ContactCreateParams,
385
446
  type ContactUpdateParams as ContactUpdateParams,
386
447
  type ContactListParams as ContactListParams,
448
+ type ContactOptOutParams as ContactOptOutParams,
387
449
  type ContactVerifyParams as ContactVerifyParams,
388
450
  };
389
451
 
@@ -16,9 +16,11 @@ export {
16
16
  type ContactListResponse,
17
17
  type ContactDeleteResponse,
18
18
  type ContactCountResponse,
19
+ type ContactOptOutResponse,
19
20
  type ContactVerifyResponse,
20
21
  type ContactCreateParams,
21
22
  type ContactUpdateParams,
22
23
  type ContactListParams,
24
+ type ContactOptOutParams,
23
25
  type ContactVerifyParams,
24
26
  } from './contacts';
@@ -9,10 +9,12 @@ export {
9
9
  type ContactListResponse,
10
10
  type ContactDeleteResponse,
11
11
  type ContactCountResponse,
12
+ type ContactOptOutResponse,
12
13
  type ContactVerifyResponse,
13
14
  type ContactCreateParams,
14
15
  type ContactUpdateParams,
15
16
  type ContactListParams,
17
+ type ContactOptOutParams,
16
18
  type ContactVerifyParams,
17
19
  } from './contacts/contacts';
18
20
  export {
@@ -33,6 +35,7 @@ export {
33
35
  type MessageGetStatusParams,
34
36
  type MessageSendParams,
35
37
  } from './messages';
38
+ export { SendCarousel, type SendCarouselSendResponse, type SendCarouselSendParams } from './send-carousel';
36
39
  export {
37
40
  TypingIndicators,
38
41
  type TypingIndicatorSendResponse,
@@ -0,0 +1,117 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ /**
8
+ * Operations for sending and managing messages
9
+ */
10
+ export class SendCarousel extends APIResource {
11
+ /**
12
+ * Send a carousel of images to a single recipient. Requires a V2 (Mac Mini) line.
13
+ * The carousel must contain between 2 and 20 HTTPS image URLs. For sending a
14
+ * single image, use `/api/send-message` with `media_url` instead.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const response = await client.sendCarousel.send({
19
+ * from_number: '+19998887777',
20
+ * media_urls: [
21
+ * 'https://example.com/image1.jpg',
22
+ * 'https://example.com/image2.jpg',
23
+ * 'https://example.com/image3.jpg',
24
+ * ],
25
+ * number: '+19998887777',
26
+ * });
27
+ * ```
28
+ */
29
+ send(body: SendCarouselSendParams, options?: RequestOptions): APIPromise<SendCarouselSendResponse> {
30
+ return this._client.post('/api/send-carousel', { body, ...options });
31
+ }
32
+ }
33
+
34
+ export interface SendCarouselSendResponse {
35
+ /**
36
+ * Email of the account that sent the message
37
+ */
38
+ accountEmail?: string;
39
+
40
+ /**
41
+ * Sending phone number
42
+ */
43
+ from_number?: string;
44
+
45
+ is_outbound?: boolean;
46
+
47
+ /**
48
+ * First media URL from the carousel
49
+ */
50
+ media_url?: string;
51
+
52
+ /**
53
+ * Unique identifier for tracking the message
54
+ */
55
+ message_handle?: string;
56
+
57
+ message_type?: string;
58
+
59
+ /**
60
+ * Recipient phone number
61
+ */
62
+ number?: string;
63
+
64
+ status?: string;
65
+ }
66
+
67
+ export interface SendCarouselSendParams {
68
+ /**
69
+ * Your Sendblue phone number in E.164 format (must be a V2/Mac Mini line)
70
+ */
71
+ from_number: string;
72
+
73
+ /**
74
+ * Array of HTTPS image URLs to send as a carousel (2-20 items)
75
+ */
76
+ media_urls: Array<string>;
77
+
78
+ /**
79
+ * Recipient phone number in E.164 format
80
+ */
81
+ number: string;
82
+
83
+ /**
84
+ * Additional metadata to attach to the message
85
+ */
86
+ metadata?: unknown;
87
+
88
+ /**
89
+ * The iMessage expressive message style
90
+ */
91
+ send_style?:
92
+ | 'celebration'
93
+ | 'shooting_star'
94
+ | 'fireworks'
95
+ | 'lasers'
96
+ | 'love'
97
+ | 'confetti'
98
+ | 'balloons'
99
+ | 'spotlight'
100
+ | 'echo'
101
+ | 'invisible'
102
+ | 'gentle'
103
+ | 'loud'
104
+ | 'slam';
105
+
106
+ /**
107
+ * Webhook URL for message status updates
108
+ */
109
+ status_callback?: string;
110
+ }
111
+
112
+ export declare namespace SendCarousel {
113
+ export {
114
+ type SendCarouselSendResponse as SendCarouselSendResponse,
115
+ type SendCarouselSendParams as SendCarouselSendParams,
116
+ };
117
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.3.1'; // x-release-please-version
1
+ export const VERSION = '3.6.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.3.1";
1
+ export declare const VERSION = "3.6.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.3.1";
1
+ export declare const VERSION = "3.6.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 = '3.3.1'; // x-release-please-version
4
+ exports.VERSION = '3.6.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.3.1'; // x-release-please-version
1
+ export const VERSION = '3.6.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map