sendblue 2.1.0 → 3.3.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 (126) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/LICENSE +1 -1
  3. package/README.md +34 -5
  4. package/client.d.mts +25 -3
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +25 -3
  7. package/client.d.ts.map +1 -1
  8. package/client.js +41 -17
  9. package/client.js.map +1 -1
  10. package/client.mjs +41 -17
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/internal/utils/query.d.mts +5 -0
  19. package/internal/utils/query.d.mts.map +1 -0
  20. package/internal/utils/query.d.ts +5 -0
  21. package/internal/utils/query.d.ts.map +1 -0
  22. package/internal/utils/query.js +23 -0
  23. package/internal/utils/query.js.map +1 -0
  24. package/internal/utils/query.mjs +20 -0
  25. package/internal/utils/query.mjs.map +1 -0
  26. package/internal/utils.d.mts +1 -0
  27. package/internal/utils.d.ts +1 -0
  28. package/internal/utils.js +1 -0
  29. package/internal/utils.js.map +1 -1
  30. package/internal/utils.mjs +1 -0
  31. package/package.json +1 -1
  32. package/resources/contacts/bulk.d.mts +25 -3
  33. package/resources/contacts/bulk.d.mts.map +1 -1
  34. package/resources/contacts/bulk.d.ts +25 -3
  35. package/resources/contacts/bulk.d.ts.map +1 -1
  36. package/resources/contacts/bulk.js +3 -0
  37. package/resources/contacts/bulk.js.map +1 -1
  38. package/resources/contacts/bulk.mjs +3 -0
  39. package/resources/contacts/bulk.mjs.map +1 -1
  40. package/resources/contacts/contacts.d.mts +105 -18
  41. package/resources/contacts/contacts.d.mts.map +1 -1
  42. package/resources/contacts/contacts.d.ts +105 -18
  43. package/resources/contacts/contacts.d.ts.map +1 -1
  44. package/resources/contacts/contacts.js +5 -2
  45. package/resources/contacts/contacts.js.map +1 -1
  46. package/resources/contacts/contacts.mjs +5 -2
  47. package/resources/contacts/contacts.mjs.map +1 -1
  48. package/resources/contacts/index.d.mts +1 -1
  49. package/resources/contacts/index.d.mts.map +1 -1
  50. package/resources/contacts/index.d.ts +1 -1
  51. package/resources/contacts/index.d.ts.map +1 -1
  52. package/resources/contacts/index.js.map +1 -1
  53. package/resources/contacts/index.mjs.map +1 -1
  54. package/resources/groups.d.mts +3 -0
  55. package/resources/groups.d.mts.map +1 -1
  56. package/resources/groups.d.ts +3 -0
  57. package/resources/groups.d.ts.map +1 -1
  58. package/resources/groups.js +3 -0
  59. package/resources/groups.js.map +1 -1
  60. package/resources/groups.mjs +3 -0
  61. package/resources/groups.mjs.map +1 -1
  62. package/resources/index.d.mts +1 -1
  63. package/resources/index.d.mts.map +1 -1
  64. package/resources/index.d.ts +1 -1
  65. package/resources/index.d.ts.map +1 -1
  66. package/resources/index.js.map +1 -1
  67. package/resources/index.mjs.map +1 -1
  68. package/resources/lookups.d.mts +3 -0
  69. package/resources/lookups.d.mts.map +1 -1
  70. package/resources/lookups.d.ts +3 -0
  71. package/resources/lookups.d.ts.map +1 -1
  72. package/resources/lookups.js +3 -0
  73. package/resources/lookups.js.map +1 -1
  74. package/resources/lookups.mjs +3 -0
  75. package/resources/lookups.mjs.map +1 -1
  76. package/resources/media-objects.d.mts +3 -0
  77. package/resources/media-objects.d.mts.map +1 -1
  78. package/resources/media-objects.d.ts +3 -0
  79. package/resources/media-objects.d.ts.map +1 -1
  80. package/resources/media-objects.js +3 -0
  81. package/resources/media-objects.js.map +1 -1
  82. package/resources/media-objects.mjs +3 -0
  83. package/resources/media-objects.mjs.map +1 -1
  84. package/resources/messages.d.mts +50 -7
  85. package/resources/messages.d.mts.map +1 -1
  86. package/resources/messages.d.ts +50 -7
  87. package/resources/messages.d.ts.map +1 -1
  88. package/resources/messages.js +19 -0
  89. package/resources/messages.js.map +1 -1
  90. package/resources/messages.mjs +19 -0
  91. package/resources/messages.mjs.map +1 -1
  92. package/resources/typing-indicators.d.mts +10 -2
  93. package/resources/typing-indicators.d.mts.map +1 -1
  94. package/resources/typing-indicators.d.ts +10 -2
  95. package/resources/typing-indicators.d.ts.map +1 -1
  96. package/resources/typing-indicators.js +5 -2
  97. package/resources/typing-indicators.js.map +1 -1
  98. package/resources/typing-indicators.mjs +5 -2
  99. package/resources/typing-indicators.mjs.map +1 -1
  100. package/resources/webhooks.d.mts +149 -145
  101. package/resources/webhooks.d.mts.map +1 -1
  102. package/resources/webhooks.d.ts +149 -145
  103. package/resources/webhooks.d.ts.map +1 -1
  104. package/resources/webhooks.js +11 -57
  105. package/resources/webhooks.js.map +1 -1
  106. package/resources/webhooks.mjs +11 -57
  107. package/resources/webhooks.mjs.map +1 -1
  108. package/src/client.ts +48 -22
  109. package/src/internal/parse.ts +6 -0
  110. package/src/internal/utils/query.ts +23 -0
  111. package/src/internal/utils.ts +1 -0
  112. package/src/resources/contacts/bulk.ts +24 -3
  113. package/src/resources/contacts/contacts.ts +118 -18
  114. package/src/resources/contacts/index.ts +1 -0
  115. package/src/resources/groups.ts +3 -0
  116. package/src/resources/index.ts +1 -0
  117. package/src/resources/lookups.ts +3 -0
  118. package/src/resources/media-objects.ts +3 -0
  119. package/src/resources/messages.ts +52 -7
  120. package/src/resources/typing-indicators.ts +11 -2
  121. package/src/resources/webhooks.ts +185 -154
  122. package/src/version.ts +1 -1
  123. package/version.d.mts +1 -1
  124. package/version.d.ts +1 -1
  125. package/version.js +1 -1
  126. package/version.mjs +1 -1
@@ -4,15 +4,18 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Operations for sending and managing messages
9
+ */
7
10
  export class TypingIndicators extends APIResource {
8
11
  /**
9
12
  * Send an indication that you are typing to a user. This shows up as the animated
10
- * three dots on the recipient's device. Only available for existing chats and not
11
- * supported in group chats.
13
+ * three dots on the recipient's device. Not supported in group chats.
12
14
  *
13
15
  * @example
14
16
  * ```ts
15
17
  * const response = await client.typingIndicators.send({
18
+ * from_number: '+16292925296',
16
19
  * number: '+19998887777',
17
20
  * });
18
21
  * ```
@@ -40,6 +43,12 @@ export interface TypingIndicatorSendResponse {
40
43
  }
41
44
 
42
45
  export interface TypingIndicatorSendParams {
46
+ /**
47
+ * The Sendblue phone number you want to send the typing indicator from (E.164
48
+ * format). This should be the number you use to send messages.
49
+ */
50
+ from_number: string;
51
+
43
52
  /**
44
53
  * The number you want to send a typing indicator to (E.164 format)
45
54
  */
@@ -1,261 +1,285 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
+ import * as WebhooksAPI from './webhooks';
4
5
  import { APIPromise } from '../core/api-promise';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
 
8
+ /**
9
+ * Operations for managing webhook subscriptions
10
+ */
7
11
  export class Webhooks extends APIResource {
8
12
  /**
9
- * Add new webhooks to your account. This endpoint appends webhooks to the existing
10
- * list.
11
- *
12
- * @example
13
- * ```ts
14
- * const webhook = await client.webhooks.create({
15
- * webhooks: [
16
- * 'https://example.com/new-webhook',
17
- * {
18
- * url: 'https://example.com/webhook-with-secret',
19
- * secret: 'my-webhook-secret',
20
- * },
21
- * ],
22
- * globalSecret: 'optional-global-secret',
23
- * type: 'receive',
24
- * });
25
- * ```
13
+ * Add new webhooks to the account. Webhooks are appended to existing ones.
26
14
  */
27
15
  create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse> {
28
- return this._client.post('/api/v2/account/webhooks', { body, ...options });
16
+ return this._client.post('/api/account/webhooks', { body, ...options });
29
17
  }
30
18
 
31
19
  /**
32
- * Replace all webhooks for your account. This endpoint completely replaces the
33
- * existing webhook configuration.
34
- *
35
- * @example
36
- * ```ts
37
- * const webhook = await client.webhooks.update({
38
- * webhooks: {
39
- * receive: [
40
- * 'https://example.com/webhook1',
41
- * {
42
- * url: 'https://example.com/webhook2',
43
- * secret: 'webhook-secret',
44
- * },
45
- * ],
46
- * call_log: ['https://example.com/call-webhook'],
47
- * contact_created: [
48
- * 'https://example.com/contact-webhook',
49
- * ],
50
- * globalSecret: 'my-global-secret',
51
- * },
52
- * });
53
- * ```
20
+ * Replace all webhooks for the account. This overwrites existing webhooks.
54
21
  */
55
22
  update(body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookUpdateResponse> {
56
- return this._client.put('/api/v2/account/webhooks', { body, ...options });
23
+ return this._client.put('/api/account/webhooks', { body, ...options });
57
24
  }
58
25
 
59
26
  /**
60
- * Get all webhooks configured for your account.
61
- *
62
- * @example
63
- * ```ts
64
- * const webhooks = await client.webhooks.list();
65
- * ```
27
+ * Get all webhooks configured for the authenticated account
66
28
  */
67
29
  list(options?: RequestOptions): APIPromise<WebhookListResponse> {
68
- return this._client.get('/api/v2/account/webhooks', options);
30
+ return this._client.get('/api/account/webhooks', options);
69
31
  }
70
32
 
71
33
  /**
72
- * Delete specific webhooks from your account.
73
- *
74
- * @example
75
- * ```ts
76
- * const webhook = await client.webhooks.delete({
77
- * webhooks: ['https://example.com'],
78
- * });
79
- * ```
34
+ * Delete specific webhooks from the account
80
35
  */
81
36
  delete(body: WebhookDeleteParams, options?: RequestOptions): APIPromise<WebhookDeleteResponse> {
82
- return this._client.delete('/api/v2/account/webhooks', { body, ...options });
37
+ return this._client.delete('/api/account/webhooks', { body, ...options });
83
38
  }
84
39
  }
85
40
 
86
41
  export interface WebhookConfiguration {
87
42
  /**
88
- * Webhooks for call logs
43
+ * Webhook endpoint URL for receiving callbacks
89
44
  */
90
- call_log?: Array<string | WebhookConfiguration.WebhookObject>;
45
+ url: string;
91
46
 
92
47
  /**
93
- * Webhooks for contact creation (URL strings only)
48
+ * Secret for webhook signature verification
94
49
  */
95
- contact_created?: Array<string>;
50
+ secret?: string;
51
+ }
96
52
 
97
- /**
98
- * Global secret applied to all webhooks
99
- */
100
- globalSecret?: string;
53
+ export interface WebhookCreateResponse {
54
+ message?: string;
101
55
 
102
- /**
103
- * Webhooks for line assignment
104
- */
105
- line_assigned?: Array<string | WebhookConfiguration.WebhookObject>;
56
+ status?: string;
106
57
 
107
- /**
108
- * Webhooks for blocked lines
109
- */
110
- line_blocked?: Array<string | WebhookConfiguration.WebhookObject>;
58
+ webhooks?: WebhookCreateResponse.Webhooks;
59
+ }
111
60
 
112
- /**
113
- * Webhooks for outbound messages
114
- */
115
- outbound?: Array<string | WebhookConfiguration.WebhookObject>;
61
+ export namespace WebhookCreateResponse {
62
+ export interface Webhooks {
63
+ /**
64
+ * Webhooks for call log events
65
+ */
66
+ call_log?: Array<string | WebhooksAPI.WebhookConfiguration>;
116
67
 
117
- /**
118
- * Webhooks for inbound messages
119
- */
120
- receive?: Array<string | WebhookConfiguration.WebhookObject>;
68
+ /**
69
+ * Webhooks for contact created events (URL strings only)
70
+ */
71
+ contact_created?: Array<string>;
121
72
 
122
- /**
123
- * Legacy secret field
124
- */
125
- secret?: string;
126
- }
73
+ /**
74
+ * Global secret applied to all webhooks
75
+ */
76
+ globalSecret?: string;
127
77
 
128
- export namespace WebhookConfiguration {
129
- export interface WebhookObject {
130
78
  /**
131
- * Webhook URL (HTTPS only)
79
+ * Webhooks for line assigned events
132
80
  */
133
- url: string;
81
+ line_assigned?: Array<string | WebhooksAPI.WebhookConfiguration>;
134
82
 
135
83
  /**
136
- * Secret for webhook verification
84
+ * Webhooks for line blocked events
137
85
  */
138
- secret?: string;
139
- }
86
+ line_blocked?: Array<string | WebhooksAPI.WebhookConfiguration>;
87
+
88
+ /**
89
+ * Webhooks for outbound message status updates
90
+ */
91
+ outbound?: Array<string | WebhooksAPI.WebhookConfiguration>;
140
92
 
141
- export interface WebhookObject {
142
93
  /**
143
- * Webhook URL (HTTPS only)
94
+ * Webhooks for inbound message events
144
95
  */
145
- url: string;
96
+ receive?: Array<string | WebhooksAPI.WebhookConfiguration>;
146
97
 
147
98
  /**
148
- * Secret for webhook verification
99
+ * Webhooks for typing indicator events
149
100
  */
150
- secret?: string;
101
+ typing_indicator?: Array<string | WebhooksAPI.WebhookConfiguration>;
151
102
  }
103
+ }
152
104
 
153
- export interface WebhookObject {
105
+ export interface WebhookUpdateResponse {
106
+ message?: string;
107
+
108
+ status?: string;
109
+
110
+ webhooks?: WebhookUpdateResponse.Webhooks;
111
+ }
112
+
113
+ export namespace WebhookUpdateResponse {
114
+ export interface Webhooks {
154
115
  /**
155
- * Webhook URL (HTTPS only)
116
+ * Webhooks for call log events
156
117
  */
157
- url: string;
118
+ call_log?: Array<string | WebhooksAPI.WebhookConfiguration>;
158
119
 
159
120
  /**
160
- * Secret for webhook verification
121
+ * Webhooks for contact created events (URL strings only)
161
122
  */
162
- secret?: string;
163
- }
123
+ contact_created?: Array<string>;
164
124
 
165
- export interface WebhookObject {
166
125
  /**
167
- * Webhook URL (HTTPS only)
126
+ * Global secret applied to all webhooks
168
127
  */
169
- url: string;
128
+ globalSecret?: string;
170
129
 
171
130
  /**
172
- * Secret for webhook verification
131
+ * Webhooks for line assigned events
173
132
  */
174
- secret?: string;
175
- }
133
+ line_assigned?: Array<string | WebhooksAPI.WebhookConfiguration>;
176
134
 
177
- export interface WebhookObject {
178
135
  /**
179
- * Webhook URL (HTTPS only)
136
+ * Webhooks for line blocked events
180
137
  */
181
- url: string;
138
+ line_blocked?: Array<string | WebhooksAPI.WebhookConfiguration>;
182
139
 
183
140
  /**
184
- * Secret for webhook verification
141
+ * Webhooks for outbound message status updates
185
142
  */
186
- secret?: string;
143
+ outbound?: Array<string | WebhooksAPI.WebhookConfiguration>;
144
+
145
+ /**
146
+ * Webhooks for inbound message events
147
+ */
148
+ receive?: Array<string | WebhooksAPI.WebhookConfiguration>;
149
+
150
+ /**
151
+ * Webhooks for typing indicator events
152
+ */
153
+ typing_indicator?: Array<string | WebhooksAPI.WebhookConfiguration>;
187
154
  }
188
155
  }
189
156
 
190
- export interface WebhookCreateResponse {
191
- status: 'OK' | 'ERROR';
192
-
193
- message?: string;
157
+ export interface WebhookListResponse {
158
+ status?: string;
194
159
 
195
- /**
196
- * Updated webhook configration (partial)
197
- */
198
- webhooks?: WebhookConfiguration;
160
+ webhooks?: WebhookListResponse.Webhooks;
199
161
  }
200
162
 
201
- export interface WebhookUpdateResponse {
202
- status: 'OK' | 'ERROR';
163
+ export namespace WebhookListResponse {
164
+ export interface Webhooks {
165
+ /**
166
+ * Webhooks for call log events
167
+ */
168
+ call_log?: Array<string | WebhooksAPI.WebhookConfiguration>;
203
169
 
204
- message?: string;
170
+ /**
171
+ * Webhooks for contact created events (URL strings only)
172
+ */
173
+ contact_created?: Array<string>;
205
174
 
206
- /**
207
- * Updated webhook configration (partial)
208
- */
209
- webhooks?: WebhookConfiguration;
210
- }
175
+ /**
176
+ * Global secret applied to all webhooks
177
+ */
178
+ globalSecret?: string;
211
179
 
212
- export interface WebhookListResponse {
213
- status: 'OK' | 'ERROR';
180
+ /**
181
+ * Webhooks for line assigned events
182
+ */
183
+ line_assigned?: Array<string | WebhooksAPI.WebhookConfiguration>;
214
184
 
215
- message?: string;
185
+ /**
186
+ * Webhooks for line blocked events
187
+ */
188
+ line_blocked?: Array<string | WebhooksAPI.WebhookConfiguration>;
216
189
 
217
- webhooks?: WebhookConfiguration;
190
+ /**
191
+ * Webhooks for outbound message status updates
192
+ */
193
+ outbound?: Array<string | WebhooksAPI.WebhookConfiguration>;
194
+
195
+ /**
196
+ * Webhooks for inbound message events
197
+ */
198
+ receive?: Array<string | WebhooksAPI.WebhookConfiguration>;
199
+
200
+ /**
201
+ * Webhooks for typing indicator events
202
+ */
203
+ typing_indicator?: Array<string | WebhooksAPI.WebhookConfiguration>;
204
+ }
218
205
  }
219
206
 
220
207
  export interface WebhookDeleteResponse {
221
- status: 'OK' | 'ERROR';
222
-
223
208
  message?: string;
209
+
210
+ status?: string;
224
211
  }
225
212
 
226
213
  export interface WebhookCreateParams {
227
214
  /**
228
- * Array of webhook URLs or webhook objects to add
215
+ * Array of webhook URLs or webhook objects
229
216
  */
230
- webhooks: Array<string | WebhookCreateParams.WebhookObject>;
217
+ webhooks: Array<string | WebhookConfiguration>;
231
218
 
232
219
  /**
233
- * Optional global secret to apply to all webhooks
220
+ * Global secret for webhook signature verification
234
221
  */
235
222
  globalSecret?: string;
236
223
 
237
224
  /**
238
- * Webhook type (default to 'receive')
225
+ * Type of webhook to add
239
226
  */
240
- type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
227
+ type?:
228
+ | 'receive'
229
+ | 'line_blocked'
230
+ | 'line_assigned'
231
+ | 'outbound'
232
+ | 'typing_indicator'
233
+ | 'call_log'
234
+ | 'contact_created';
235
+ }
236
+
237
+ export interface WebhookUpdateParams {
238
+ webhooks: WebhookUpdateParams.Webhooks;
241
239
  }
242
240
 
243
- export namespace WebhookCreateParams {
244
- export interface WebhookObject {
241
+ export namespace WebhookUpdateParams {
242
+ export interface Webhooks {
245
243
  /**
246
- * Webhook URL (HTTPS only)
244
+ * Webhooks for call log events
247
245
  */
248
- url: string;
246
+ call_log?: Array<string | WebhooksAPI.WebhookConfiguration>;
249
247
 
250
248
  /**
251
- * Secret for webhook verification
249
+ * Webhooks for contact created events (URL strings only)
252
250
  */
253
- secret?: string;
254
- }
255
- }
251
+ contact_created?: Array<string>;
256
252
 
257
- export interface WebhookUpdateParams {
258
- webhooks: WebhookConfiguration;
253
+ /**
254
+ * Global secret applied to all webhooks
255
+ */
256
+ globalSecret?: string;
257
+
258
+ /**
259
+ * Webhooks for line assigned events
260
+ */
261
+ line_assigned?: Array<string | WebhooksAPI.WebhookConfiguration>;
262
+
263
+ /**
264
+ * Webhooks for line blocked events
265
+ */
266
+ line_blocked?: Array<string | WebhooksAPI.WebhookConfiguration>;
267
+
268
+ /**
269
+ * Webhooks for outbound message status updates
270
+ */
271
+ outbound?: Array<string | WebhooksAPI.WebhookConfiguration>;
272
+
273
+ /**
274
+ * Webhooks for inbound message events
275
+ */
276
+ receive?: Array<string | WebhooksAPI.WebhookConfiguration>;
277
+
278
+ /**
279
+ * Webhooks for typing indicator events
280
+ */
281
+ typing_indicator?: Array<string | WebhooksAPI.WebhookConfiguration>;
282
+ }
259
283
  }
260
284
 
261
285
  export interface WebhookDeleteParams {
@@ -265,9 +289,16 @@ export interface WebhookDeleteParams {
265
289
  webhooks: Array<string>;
266
290
 
267
291
  /**
268
- * Webhook type (default to 'receive')
292
+ * Type of webhook to delete from
269
293
  */
270
- type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
294
+ type?:
295
+ | 'receive'
296
+ | 'line_blocked'
297
+ | 'line_assigned'
298
+ | 'outbound'
299
+ | 'typing_indicator'
300
+ | 'call_log'
301
+ | 'contact_created';
271
302
  }
272
303
 
273
304
  export declare namespace Webhooks {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.1.0'; // x-release-please-version
1
+ export const VERSION = '3.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.1.0";
1
+ export declare const VERSION = "3.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.1.0";
1
+ export declare const VERSION = "3.3.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 = '2.1.0'; // x-release-please-version
4
+ exports.VERSION = '3.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.1.0'; // x-release-please-version
1
+ export const VERSION = '3.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map