telnyx 6.7.0 → 6.8.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 (240) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/client.d.mts +10 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +10 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +9 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +9 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/assistants/assistants.d.mts +5 -5
  12. package/resources/ai/assistants/assistants.d.mts.map +1 -1
  13. package/resources/ai/assistants/assistants.d.ts +5 -5
  14. package/resources/ai/assistants/assistants.d.ts.map +1 -1
  15. package/resources/ai/chat.d.mts +6 -0
  16. package/resources/ai/chat.d.mts.map +1 -1
  17. package/resources/ai/chat.d.ts +6 -0
  18. package/resources/ai/chat.d.ts.map +1 -1
  19. package/resources/index.d.mts +2 -0
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +2 -0
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +6 -2
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +2 -0
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/messaging-10dlc/brand/brand.d.mts +1 -1
  28. package/resources/messaging-10dlc/brand/brand.d.mts.map +1 -1
  29. package/resources/messaging-10dlc/brand/brand.d.ts +1 -1
  30. package/resources/messaging-10dlc/brand/brand.d.ts.map +1 -1
  31. package/resources/messaging-10dlc/brand/brand.js.map +1 -1
  32. package/resources/messaging-10dlc/brand/brand.mjs.map +1 -1
  33. package/resources/shared.d.mts +25 -0
  34. package/resources/shared.d.mts.map +1 -1
  35. package/resources/shared.d.ts +25 -0
  36. package/resources/shared.d.ts.map +1 -1
  37. package/resources/sim-cards/actions.d.mts +39 -115
  38. package/resources/sim-cards/actions.d.mts.map +1 -1
  39. package/resources/sim-cards/actions.d.ts +39 -115
  40. package/resources/sim-cards/actions.d.ts.map +1 -1
  41. package/resources/sim-cards/index.d.mts +1 -1
  42. package/resources/sim-cards/index.d.mts.map +1 -1
  43. package/resources/sim-cards/index.d.ts +1 -1
  44. package/resources/sim-cards/index.d.ts.map +1 -1
  45. package/resources/sim-cards/index.js.map +1 -1
  46. package/resources/sim-cards/index.mjs.map +1 -1
  47. package/resources/sim-cards/sim-cards.d.mts +2 -2
  48. package/resources/sim-cards/sim-cards.d.mts.map +1 -1
  49. package/resources/sim-cards/sim-cards.d.ts +2 -2
  50. package/resources/sim-cards/sim-cards.d.ts.map +1 -1
  51. package/resources/sim-cards/sim-cards.js.map +1 -1
  52. package/resources/sim-cards/sim-cards.mjs.map +1 -1
  53. package/resources/text-to-speech/internal-base.d.mts +3 -3
  54. package/resources/text-to-speech/internal-base.d.ts +3 -3
  55. package/resources/text-to-speech/internal-base.js +1 -1
  56. package/resources/text-to-speech/internal-base.js.map +1 -1
  57. package/resources/text-to-speech/internal-base.mjs +1 -1
  58. package/resources/text-to-speech/internal-base.mjs.map +1 -1
  59. package/resources/text-to-speech/text-to-speech.d.mts +5 -3
  60. package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
  61. package/resources/text-to-speech/text-to-speech.d.ts +5 -3
  62. package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
  63. package/resources/whatsapp/business-accounts/business-accounts.d.mts +132 -0
  64. package/resources/whatsapp/business-accounts/business-accounts.d.mts.map +1 -0
  65. package/resources/whatsapp/business-accounts/business-accounts.d.ts +132 -0
  66. package/resources/whatsapp/business-accounts/business-accounts.d.ts.map +1 -0
  67. package/resources/whatsapp/business-accounts/business-accounts.js +67 -0
  68. package/resources/whatsapp/business-accounts/business-accounts.js.map +1 -0
  69. package/resources/whatsapp/business-accounts/business-accounts.mjs +62 -0
  70. package/resources/whatsapp/business-accounts/business-accounts.mjs.map +1 -0
  71. package/resources/whatsapp/business-accounts/index.d.mts +4 -0
  72. package/resources/whatsapp/business-accounts/index.d.mts.map +1 -0
  73. package/resources/whatsapp/business-accounts/index.d.ts +4 -0
  74. package/resources/whatsapp/business-accounts/index.d.ts.map +1 -0
  75. package/resources/whatsapp/business-accounts/index.js +11 -0
  76. package/resources/whatsapp/business-accounts/index.js.map +1 -0
  77. package/resources/whatsapp/business-accounts/index.mjs +5 -0
  78. package/resources/whatsapp/business-accounts/index.mjs.map +1 -0
  79. package/resources/whatsapp/business-accounts/phone-numbers.d.mts +76 -0
  80. package/resources/whatsapp/business-accounts/phone-numbers.d.mts.map +1 -0
  81. package/resources/whatsapp/business-accounts/phone-numbers.d.ts +76 -0
  82. package/resources/whatsapp/business-accounts/phone-numbers.d.ts.map +1 -0
  83. package/resources/whatsapp/business-accounts/phone-numbers.js +49 -0
  84. package/resources/whatsapp/business-accounts/phone-numbers.js.map +1 -0
  85. package/resources/whatsapp/business-accounts/phone-numbers.mjs +45 -0
  86. package/resources/whatsapp/business-accounts/phone-numbers.mjs.map +1 -0
  87. package/resources/whatsapp/business-accounts/settings.d.mts +85 -0
  88. package/resources/whatsapp/business-accounts/settings.d.mts.map +1 -0
  89. package/resources/whatsapp/business-accounts/settings.d.ts +85 -0
  90. package/resources/whatsapp/business-accounts/settings.d.ts.map +1 -0
  91. package/resources/whatsapp/business-accounts/settings.js +41 -0
  92. package/resources/whatsapp/business-accounts/settings.js.map +1 -0
  93. package/resources/whatsapp/business-accounts/settings.mjs +37 -0
  94. package/resources/whatsapp/business-accounts/settings.mjs.map +1 -0
  95. package/resources/whatsapp/business-accounts.d.mts +2 -0
  96. package/resources/whatsapp/business-accounts.d.mts.map +1 -0
  97. package/resources/whatsapp/business-accounts.d.ts +2 -0
  98. package/resources/whatsapp/business-accounts.d.ts.map +1 -0
  99. package/resources/whatsapp/business-accounts.js +6 -0
  100. package/resources/whatsapp/business-accounts.js.map +1 -0
  101. package/resources/whatsapp/business-accounts.mjs +3 -0
  102. package/resources/whatsapp/business-accounts.mjs.map +1 -0
  103. package/resources/whatsapp/index.d.mts +5 -0
  104. package/resources/whatsapp/index.d.mts.map +1 -0
  105. package/resources/whatsapp/index.d.ts +5 -0
  106. package/resources/whatsapp/index.d.ts.map +1 -0
  107. package/resources/whatsapp/index.js +13 -0
  108. package/resources/whatsapp/index.js.map +1 -0
  109. package/resources/whatsapp/index.mjs +6 -0
  110. package/resources/whatsapp/index.mjs.map +1 -0
  111. package/resources/whatsapp/phone-numbers/calling-settings.d.mts +58 -0
  112. package/resources/whatsapp/phone-numbers/calling-settings.d.mts.map +1 -0
  113. package/resources/whatsapp/phone-numbers/calling-settings.d.ts +58 -0
  114. package/resources/whatsapp/phone-numbers/calling-settings.d.ts.map +1 -0
  115. package/resources/whatsapp/phone-numbers/calling-settings.js +45 -0
  116. package/resources/whatsapp/phone-numbers/calling-settings.js.map +1 -0
  117. package/resources/whatsapp/phone-numbers/calling-settings.mjs +41 -0
  118. package/resources/whatsapp/phone-numbers/calling-settings.mjs.map +1 -0
  119. package/resources/whatsapp/phone-numbers/index.d.mts +4 -0
  120. package/resources/whatsapp/phone-numbers/index.d.mts.map +1 -0
  121. package/resources/whatsapp/phone-numbers/index.d.ts +4 -0
  122. package/resources/whatsapp/phone-numbers/index.d.ts.map +1 -0
  123. package/resources/whatsapp/phone-numbers/index.js +11 -0
  124. package/resources/whatsapp/phone-numbers/index.js.map +1 -0
  125. package/resources/whatsapp/phone-numbers/index.mjs +5 -0
  126. package/resources/whatsapp/phone-numbers/index.mjs.map +1 -0
  127. package/resources/whatsapp/phone-numbers/phone-numbers.d.mts +101 -0
  128. package/resources/whatsapp/phone-numbers/phone-numbers.d.mts.map +1 -0
  129. package/resources/whatsapp/phone-numbers/phone-numbers.d.ts +101 -0
  130. package/resources/whatsapp/phone-numbers/phone-numbers.d.ts.map +1 -0
  131. package/resources/whatsapp/phone-numbers/phone-numbers.js +89 -0
  132. package/resources/whatsapp/phone-numbers/phone-numbers.js.map +1 -0
  133. package/resources/whatsapp/phone-numbers/phone-numbers.mjs +84 -0
  134. package/resources/whatsapp/phone-numbers/phone-numbers.mjs.map +1 -0
  135. package/resources/whatsapp/phone-numbers/profile/index.d.mts +3 -0
  136. package/resources/whatsapp/phone-numbers/profile/index.d.mts.map +1 -0
  137. package/resources/whatsapp/phone-numbers/profile/index.d.ts +3 -0
  138. package/resources/whatsapp/phone-numbers/profile/index.d.ts.map +1 -0
  139. package/resources/whatsapp/phone-numbers/profile/index.js +9 -0
  140. package/resources/whatsapp/phone-numbers/profile/index.js.map +1 -0
  141. package/resources/whatsapp/phone-numbers/profile/index.mjs +4 -0
  142. package/resources/whatsapp/phone-numbers/profile/index.mjs.map +1 -0
  143. package/resources/whatsapp/phone-numbers/profile/photo.d.mts +47 -0
  144. package/resources/whatsapp/phone-numbers/profile/photo.d.mts.map +1 -0
  145. package/resources/whatsapp/phone-numbers/profile/photo.d.ts +47 -0
  146. package/resources/whatsapp/phone-numbers/profile/photo.d.ts.map +1 -0
  147. package/resources/whatsapp/phone-numbers/profile/photo.js +46 -0
  148. package/resources/whatsapp/phone-numbers/profile/photo.js.map +1 -0
  149. package/resources/whatsapp/phone-numbers/profile/photo.mjs +42 -0
  150. package/resources/whatsapp/phone-numbers/profile/photo.mjs.map +1 -0
  151. package/resources/whatsapp/phone-numbers/profile/profile.d.mts +73 -0
  152. package/resources/whatsapp/phone-numbers/profile/profile.d.mts.map +1 -0
  153. package/resources/whatsapp/phone-numbers/profile/profile.d.ts +73 -0
  154. package/resources/whatsapp/phone-numbers/profile/profile.d.ts.map +1 -0
  155. package/resources/whatsapp/phone-numbers/profile/profile.js +49 -0
  156. package/resources/whatsapp/phone-numbers/profile/profile.js.map +1 -0
  157. package/resources/whatsapp/phone-numbers/profile/profile.mjs +44 -0
  158. package/resources/whatsapp/phone-numbers/profile/profile.mjs.map +1 -0
  159. package/resources/whatsapp/phone-numbers/profile.d.mts +2 -0
  160. package/resources/whatsapp/phone-numbers/profile.d.mts.map +1 -0
  161. package/resources/whatsapp/phone-numbers/profile.d.ts +2 -0
  162. package/resources/whatsapp/phone-numbers/profile.d.ts.map +1 -0
  163. package/resources/whatsapp/phone-numbers/profile.js +6 -0
  164. package/resources/whatsapp/phone-numbers/profile.js.map +1 -0
  165. package/resources/whatsapp/phone-numbers/profile.mjs +3 -0
  166. package/resources/whatsapp/phone-numbers/profile.mjs.map +1 -0
  167. package/resources/whatsapp/phone-numbers.d.mts +2 -0
  168. package/resources/whatsapp/phone-numbers.d.mts.map +1 -0
  169. package/resources/whatsapp/phone-numbers.d.ts +2 -0
  170. package/resources/whatsapp/phone-numbers.d.ts.map +1 -0
  171. package/resources/whatsapp/phone-numbers.js +6 -0
  172. package/resources/whatsapp/phone-numbers.js.map +1 -0
  173. package/resources/whatsapp/phone-numbers.mjs +3 -0
  174. package/resources/whatsapp/phone-numbers.mjs.map +1 -0
  175. package/resources/whatsapp/templates.d.mts +73 -0
  176. package/resources/whatsapp/templates.d.mts.map +1 -0
  177. package/resources/whatsapp/templates.d.ts +73 -0
  178. package/resources/whatsapp/templates.d.ts.map +1 -0
  179. package/resources/whatsapp/templates.js +44 -0
  180. package/resources/whatsapp/templates.js.map +1 -0
  181. package/resources/whatsapp/templates.mjs +40 -0
  182. package/resources/whatsapp/templates.mjs.map +1 -0
  183. package/resources/whatsapp/whatsapp.d.mts +18 -0
  184. package/resources/whatsapp/whatsapp.d.mts.map +1 -0
  185. package/resources/whatsapp/whatsapp.d.ts +18 -0
  186. package/resources/whatsapp/whatsapp.d.ts.map +1 -0
  187. package/resources/whatsapp/whatsapp.js +25 -0
  188. package/resources/whatsapp/whatsapp.js.map +1 -0
  189. package/resources/whatsapp/whatsapp.mjs +20 -0
  190. package/resources/whatsapp/whatsapp.mjs.map +1 -0
  191. package/resources/whatsapp-message-templates.d.mts +37 -0
  192. package/resources/whatsapp-message-templates.d.mts.map +1 -0
  193. package/resources/whatsapp-message-templates.d.ts +37 -0
  194. package/resources/whatsapp-message-templates.d.ts.map +1 -0
  195. package/resources/whatsapp-message-templates.js +35 -0
  196. package/resources/whatsapp-message-templates.js.map +1 -0
  197. package/resources/whatsapp-message-templates.mjs +31 -0
  198. package/resources/whatsapp-message-templates.mjs.map +1 -0
  199. package/resources/whatsapp.d.mts +2 -0
  200. package/resources/whatsapp.d.mts.map +1 -0
  201. package/resources/whatsapp.d.ts +2 -0
  202. package/resources/whatsapp.d.ts.map +1 -0
  203. package/resources/whatsapp.js +6 -0
  204. package/resources/whatsapp.js.map +1 -0
  205. package/resources/whatsapp.mjs +3 -0
  206. package/resources/whatsapp.mjs.map +1 -0
  207. package/src/client.ts +24 -0
  208. package/src/resources/ai/assistants/assistants.ts +5 -5
  209. package/src/resources/ai/chat.ts +7 -0
  210. package/src/resources/index.ts +7 -0
  211. package/src/resources/messaging-10dlc/brand/brand.ts +17 -11
  212. package/src/resources/shared.ts +37 -0
  213. package/src/resources/sim-cards/actions.ts +43 -126
  214. package/src/resources/sim-cards/index.ts +1 -0
  215. package/src/resources/sim-cards/sim-cards.ts +2 -0
  216. package/src/resources/text-to-speech/internal-base.ts +4 -4
  217. package/src/resources/text-to-speech/text-to-speech.ts +3 -3
  218. package/src/resources/whatsapp/business-accounts/business-accounts.ts +217 -0
  219. package/src/resources/whatsapp/business-accounts/index.ts +23 -0
  220. package/src/resources/whatsapp/business-accounts/phone-numbers.ts +127 -0
  221. package/src/resources/whatsapp/business-accounts/settings.ts +116 -0
  222. package/src/resources/whatsapp/business-accounts.ts +3 -0
  223. package/src/resources/whatsapp/index.ts +24 -0
  224. package/src/resources/whatsapp/phone-numbers/calling-settings.ts +86 -0
  225. package/src/resources/whatsapp/phone-numbers/index.ts +24 -0
  226. package/src/resources/whatsapp/phone-numbers/phone-numbers.ts +193 -0
  227. package/src/resources/whatsapp/phone-numbers/profile/index.ts +10 -0
  228. package/src/resources/whatsapp/phone-numbers/profile/photo.ts +70 -0
  229. package/src/resources/whatsapp/phone-numbers/profile/profile.ts +121 -0
  230. package/src/resources/whatsapp/phone-numbers/profile.ts +3 -0
  231. package/src/resources/whatsapp/phone-numbers.ts +3 -0
  232. package/src/resources/whatsapp/templates.ts +101 -0
  233. package/src/resources/whatsapp/whatsapp.ts +60 -0
  234. package/src/resources/whatsapp-message-templates.ts +63 -0
  235. package/src/resources/whatsapp.ts +3 -0
  236. package/src/version.ts +1 -1
  237. package/version.d.mts +1 -1
  238. package/version.d.ts +1 -1
  239. package/version.js +1 -1
  240. package/version.mjs +1 -1
@@ -22,7 +22,7 @@ export class WebSocketError extends TelnyxError {
22
22
 
23
23
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
24
24
 
25
- type WebsocketEvents = Simplify<
25
+ type WebSocketEvents = Simplify<
26
26
  {
27
27
  event: (event: TextToSpeechAPI.StreamServerEvent) => void;
28
28
  error: (error: WebSocketError) => void;
@@ -33,14 +33,14 @@ type WebsocketEvents = Simplify<
33
33
  }
34
34
  >;
35
35
 
36
- export abstract class TextToSpeechEmitter extends EventEmitter<WebsocketEvents> {
36
+ export abstract class TextToSpeechEmitter extends EventEmitter<WebSocketEvents> {
37
37
  /**
38
38
  * Send an event to the API.
39
39
  */
40
40
  abstract send(event: TextToSpeechAPI.StreamClientEvent): void;
41
41
 
42
42
  /**
43
- * Close the websocket connection.
43
+ * Close the WebSocket connection.
44
44
  */
45
45
  abstract close(props?: { code: number; reason: string }): void;
46
46
 
@@ -80,7 +80,7 @@ export function buildURL(client: Telnyx, query?: object | null): URL {
80
80
  if (query) {
81
81
  url.search = stringifyQuery(query);
82
82
  }
83
- url.protocol = 'wss';
83
+ url.protocol = url.protocol === 'http:' ? 'ws:' : 'wss:';
84
84
  return url;
85
85
  }
86
86
 
@@ -125,7 +125,7 @@ export interface StreamClientEvent {
125
125
  */
126
126
  export type StreamServerEvent =
127
127
  | StreamServerEvent.AudioChunkFrame
128
- | StreamServerEvent.FinalFrame
128
+ | StreamServerEvent.FinalFrameEvent
129
129
  | StreamServerEvent.ErrorFrame;
130
130
 
131
131
  export namespace StreamServerEvent {
@@ -170,7 +170,7 @@ export namespace StreamServerEvent {
170
170
  /**
171
171
  * Server-to-client frame indicating synthesis is complete for the current text.
172
172
  */
173
- export interface FinalFrame {
173
+ export interface FinalFrameEvent {
174
174
  /**
175
175
  * Always `null` for the final frame.
176
176
  */
@@ -238,7 +238,7 @@ export interface TextToSpeechGenerateParams {
238
238
  /**
239
239
  * Inworld provider-specific parameters.
240
240
  */
241
- inworld?: unknown;
241
+ inworld?: { [key: string]: unknown };
242
242
 
243
243
  /**
244
244
  * Language code (e.g. `en-US`). Usage varies by provider.
@@ -0,0 +1,217 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as PhoneNumbersAPI from './phone-numbers';
5
+ import {
6
+ PhoneNumberInitializeVerificationParams,
7
+ PhoneNumberListParams,
8
+ PhoneNumberListResponse,
9
+ PhoneNumberListResponsesDefaultFlatPagination,
10
+ PhoneNumbers,
11
+ } from './phone-numbers';
12
+ import * as SettingsAPI from './settings';
13
+ import {
14
+ SettingRetrieveResponse,
15
+ SettingUpdateParams,
16
+ SettingUpdateResponse,
17
+ Settings,
18
+ WabaSettings,
19
+ } from './settings';
20
+ import { APIPromise } from '../../../core/api-promise';
21
+ import {
22
+ DefaultFlatPagination,
23
+ type DefaultFlatPaginationParams,
24
+ PagePromise,
25
+ } from '../../../core/pagination';
26
+ import { buildHeaders } from '../../../internal/headers';
27
+ import { RequestOptions } from '../../../internal/request-options';
28
+ import { path } from '../../../internal/utils/path';
29
+
30
+ /**
31
+ * Manage Whatsapp business accounts
32
+ */
33
+ export class BusinessAccounts extends APIResource {
34
+ phoneNumbers: PhoneNumbersAPI.PhoneNumbers = new PhoneNumbersAPI.PhoneNumbers(this._client);
35
+ settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client);
36
+
37
+ /**
38
+ * Get a single Whatsapp Business Account
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const businessAccount =
43
+ * await client.whatsapp.businessAccounts.retrieve('id');
44
+ * ```
45
+ */
46
+ retrieve(id: string, options?: RequestOptions): APIPromise<BusinessAccountRetrieveResponse> {
47
+ return this._client.get(path`/v2/whatsapp/business_accounts/${id}`, options);
48
+ }
49
+
50
+ /**
51
+ * List Whatsapp Business Accounts
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * // Automatically fetches more pages as needed.
56
+ * for await (const businessAccountListResponse of client.whatsapp.businessAccounts.list()) {
57
+ * // ...
58
+ * }
59
+ * ```
60
+ */
61
+ list(
62
+ query: BusinessAccountListParams | null | undefined = {},
63
+ options?: RequestOptions,
64
+ ): PagePromise<BusinessAccountListResponsesDefaultFlatPagination, BusinessAccountListResponse> {
65
+ return this._client.getAPIList(
66
+ '/v2/whatsapp/business_accounts',
67
+ DefaultFlatPagination<BusinessAccountListResponse>,
68
+ { query, ...options },
69
+ );
70
+ }
71
+
72
+ /**
73
+ * Delete a Whatsapp Business Account
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * await client.whatsapp.businessAccounts.delete('id');
78
+ * ```
79
+ */
80
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
81
+ return this._client.delete(path`/v2/whatsapp/business_accounts/${id}`, {
82
+ ...options,
83
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
84
+ });
85
+ }
86
+ }
87
+
88
+ export type BusinessAccountListResponsesDefaultFlatPagination =
89
+ DefaultFlatPagination<BusinessAccountListResponse>;
90
+
91
+ export interface BusinessAccountRetrieveResponse {
92
+ data?: BusinessAccountRetrieveResponse.Data;
93
+ }
94
+
95
+ export namespace BusinessAccountRetrieveResponse {
96
+ export interface Data {
97
+ /**
98
+ * Internal ID of Whatsapp business account
99
+ */
100
+ id?: string;
101
+
102
+ /**
103
+ * Account review status of Whatsapp business account
104
+ */
105
+ account_review_status?: string;
106
+
107
+ /**
108
+ * Business verification status of Whatsapp business account
109
+ */
110
+ business_verification_status?: string;
111
+
112
+ /**
113
+ * Country associated with Whatsapp business account
114
+ */
115
+ country?: string;
116
+
117
+ created_at?: string;
118
+
119
+ /**
120
+ * Name of Whatsapp business account
121
+ */
122
+ name?: string;
123
+
124
+ /**
125
+ * Count of phone numbers associated with Whatsapp business account
126
+ */
127
+ phone_numbers_count?: number;
128
+
129
+ record_type?: string;
130
+
131
+ /**
132
+ * Status of Whatsapp business account
133
+ */
134
+ status?: string;
135
+
136
+ /**
137
+ * WABA ID of Whatsapp business account
138
+ */
139
+ waba_id?: string;
140
+ }
141
+ }
142
+
143
+ export interface BusinessAccountListResponse {
144
+ /**
145
+ * Internal ID of Whatsapp business account
146
+ */
147
+ id?: string;
148
+
149
+ /**
150
+ * Account review status of Whatsapp business account
151
+ */
152
+ account_review_status?: string;
153
+
154
+ /**
155
+ * Business verification status of Whatsapp business account
156
+ */
157
+ business_verification_status?: string;
158
+
159
+ /**
160
+ * Country associated with Whatsapp business account
161
+ */
162
+ country?: string;
163
+
164
+ created_at?: string;
165
+
166
+ /**
167
+ * Name of Whatsapp business account
168
+ */
169
+ name?: string;
170
+
171
+ /**
172
+ * Count of phone numbers associated with Whatsapp business account
173
+ */
174
+ phone_numbers_count?: number;
175
+
176
+ record_type?: string;
177
+
178
+ /**
179
+ * Status of Whatsapp business account
180
+ */
181
+ status?: string;
182
+
183
+ /**
184
+ * WABA ID of Whatsapp business account
185
+ */
186
+ waba_id?: string;
187
+ }
188
+
189
+ export interface BusinessAccountListParams extends DefaultFlatPaginationParams {}
190
+
191
+ BusinessAccounts.PhoneNumbers = PhoneNumbers;
192
+ BusinessAccounts.Settings = Settings;
193
+
194
+ export declare namespace BusinessAccounts {
195
+ export {
196
+ type BusinessAccountRetrieveResponse as BusinessAccountRetrieveResponse,
197
+ type BusinessAccountListResponse as BusinessAccountListResponse,
198
+ type BusinessAccountListResponsesDefaultFlatPagination as BusinessAccountListResponsesDefaultFlatPagination,
199
+ type BusinessAccountListParams as BusinessAccountListParams,
200
+ };
201
+
202
+ export {
203
+ PhoneNumbers as PhoneNumbers,
204
+ type PhoneNumberListResponse as PhoneNumberListResponse,
205
+ type PhoneNumberListResponsesDefaultFlatPagination as PhoneNumberListResponsesDefaultFlatPagination,
206
+ type PhoneNumberListParams as PhoneNumberListParams,
207
+ type PhoneNumberInitializeVerificationParams as PhoneNumberInitializeVerificationParams,
208
+ };
209
+
210
+ export {
211
+ Settings as Settings,
212
+ type WabaSettings as WabaSettings,
213
+ type SettingRetrieveResponse as SettingRetrieveResponse,
214
+ type SettingUpdateResponse as SettingUpdateResponse,
215
+ type SettingUpdateParams as SettingUpdateParams,
216
+ };
217
+ }
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ BusinessAccounts,
5
+ type BusinessAccountRetrieveResponse,
6
+ type BusinessAccountListResponse,
7
+ type BusinessAccountListParams,
8
+ type BusinessAccountListResponsesDefaultFlatPagination,
9
+ } from './business-accounts';
10
+ export {
11
+ PhoneNumbers,
12
+ type PhoneNumberListResponse,
13
+ type PhoneNumberListParams,
14
+ type PhoneNumberInitializeVerificationParams,
15
+ type PhoneNumberListResponsesDefaultFlatPagination,
16
+ } from './phone-numbers';
17
+ export {
18
+ Settings,
19
+ type WabaSettings,
20
+ type SettingRetrieveResponse,
21
+ type SettingUpdateResponse,
22
+ type SettingUpdateParams,
23
+ } from './settings';
@@ -0,0 +1,127 @@
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 {
6
+ DefaultFlatPagination,
7
+ type DefaultFlatPaginationParams,
8
+ PagePromise,
9
+ } from '../../../core/pagination';
10
+ import { buildHeaders } from '../../../internal/headers';
11
+ import { RequestOptions } from '../../../internal/request-options';
12
+ import { path } from '../../../internal/utils/path';
13
+
14
+ export class PhoneNumbers extends APIResource {
15
+ /**
16
+ * List phone numbers for a WABA
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Automatically fetches more pages as needed.
21
+ * for await (const phoneNumberListResponse of client.whatsapp.businessAccounts.phoneNumbers.list(
22
+ * 'id',
23
+ * )) {
24
+ * // ...
25
+ * }
26
+ * ```
27
+ */
28
+ list(
29
+ id: string,
30
+ query: PhoneNumberListParams | null | undefined = {},
31
+ options?: RequestOptions,
32
+ ): PagePromise<PhoneNumberListResponsesDefaultFlatPagination, PhoneNumberListResponse> {
33
+ return this._client.getAPIList(
34
+ path`/v2/whatsapp/business_accounts/${id}/phone_numbers`,
35
+ DefaultFlatPagination<PhoneNumberListResponse>,
36
+ { query, ...options },
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Initialize Whatsapp phone number verification
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * await client.whatsapp.businessAccounts.phoneNumbers.initializeVerification(
46
+ * 'id',
47
+ * {
48
+ * display_name: 'display_name',
49
+ * phone_number: 'phone_number',
50
+ * },
51
+ * );
52
+ * ```
53
+ */
54
+ initializeVerification(
55
+ id: string,
56
+ body: PhoneNumberInitializeVerificationParams,
57
+ options?: RequestOptions,
58
+ ): APIPromise<void> {
59
+ return this._client.post(path`/v2/whatsapp/business_accounts/${id}/phone_numbers`, {
60
+ body,
61
+ ...options,
62
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
63
+ });
64
+ }
65
+ }
66
+
67
+ export type PhoneNumberListResponsesDefaultFlatPagination = DefaultFlatPagination<PhoneNumberListResponse>;
68
+
69
+ export interface PhoneNumberListResponse {
70
+ calling_enabled?: boolean;
71
+
72
+ created_at?: string;
73
+
74
+ display_name?: string;
75
+
76
+ enabled?: boolean;
77
+
78
+ /**
79
+ * Phone number in E164 format
80
+ */
81
+ phone_number?: string;
82
+
83
+ /**
84
+ * Whatsapp phone number ID
85
+ */
86
+ phone_number_id?: string;
87
+
88
+ /**
89
+ * Whatsapp quality rating
90
+ */
91
+ quality_rating?: string;
92
+
93
+ record_type?: string;
94
+
95
+ status?: string;
96
+
97
+ /**
98
+ * User ID
99
+ */
100
+ user_id?: string;
101
+
102
+ /**
103
+ * WABA ID of Whatsapp business account
104
+ */
105
+ waba_id?: string;
106
+ }
107
+
108
+ export interface PhoneNumberListParams extends DefaultFlatPaginationParams {}
109
+
110
+ export interface PhoneNumberInitializeVerificationParams {
111
+ display_name: string;
112
+
113
+ phone_number: string;
114
+
115
+ language?: string;
116
+
117
+ verification_method?: 'sms' | 'voice';
118
+ }
119
+
120
+ export declare namespace PhoneNumbers {
121
+ export {
122
+ type PhoneNumberListResponse as PhoneNumberListResponse,
123
+ type PhoneNumberListResponsesDefaultFlatPagination as PhoneNumberListResponsesDefaultFlatPagination,
124
+ type PhoneNumberListParams as PhoneNumberListParams,
125
+ type PhoneNumberInitializeVerificationParams as PhoneNumberInitializeVerificationParams,
126
+ };
127
+ }
@@ -0,0 +1,116 @@
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
+ import { path } from '../../../internal/utils/path';
7
+
8
+ /**
9
+ * Manage Whatsapp business accounts
10
+ */
11
+ export class Settings extends APIResource {
12
+ /**
13
+ * Get WABA settings
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const setting =
18
+ * await client.whatsapp.businessAccounts.settings.retrieve(
19
+ * 'id',
20
+ * );
21
+ * ```
22
+ */
23
+ retrieve(id: string, options?: RequestOptions): APIPromise<SettingRetrieveResponse> {
24
+ return this._client.get(path`/v2/whatsapp/business_accounts/${id}/settings`, options);
25
+ }
26
+
27
+ /**
28
+ * Update WABA settings
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const setting =
33
+ * await client.whatsapp.businessAccounts.settings.update(
34
+ * 'id',
35
+ * );
36
+ * ```
37
+ */
38
+ update(id: string, body: SettingUpdateParams, options?: RequestOptions): APIPromise<SettingUpdateResponse> {
39
+ return this._client.patch(path`/v2/whatsapp/business_accounts/${id}/settings`, { body, ...options });
40
+ }
41
+ }
42
+
43
+ export interface WabaSettings {
44
+ /**
45
+ * Internal ID of Whatsapp business account
46
+ */
47
+ id?: string;
48
+
49
+ name?: string;
50
+
51
+ record_type?: string;
52
+
53
+ timezone?: string;
54
+
55
+ updated_at?: string;
56
+
57
+ /**
58
+ * Enable/disable receiving Whatsapp events
59
+ */
60
+ webhook_enabled?: boolean;
61
+
62
+ webhook_events?: Array<string>;
63
+
64
+ /**
65
+ * Failover URL to receive Whatsapp events
66
+ */
67
+ webhook_failover_url?: string;
68
+
69
+ /**
70
+ * URL to receive Whatsapp events
71
+ */
72
+ webhook_url?: string;
73
+ }
74
+
75
+ export interface SettingRetrieveResponse {
76
+ data?: WabaSettings;
77
+ }
78
+
79
+ export interface SettingUpdateResponse {
80
+ data?: WabaSettings;
81
+ }
82
+
83
+ export interface SettingUpdateParams {
84
+ name?: string;
85
+
86
+ /**
87
+ * IANA timezone identifier
88
+ */
89
+ timezone?: string;
90
+
91
+ /**
92
+ * Enable/disable receiving Whatsapp events
93
+ */
94
+ webhook_enabled?: boolean;
95
+
96
+ webhook_events?: Array<string>;
97
+
98
+ /**
99
+ * Failover URL to send Whatsapp events
100
+ */
101
+ webhook_failover_url?: string;
102
+
103
+ /**
104
+ * URL to send Whatsapp events
105
+ */
106
+ webhook_url?: string;
107
+ }
108
+
109
+ export declare namespace Settings {
110
+ export {
111
+ type WabaSettings as WabaSettings,
112
+ type SettingRetrieveResponse as SettingRetrieveResponse,
113
+ type SettingUpdateResponse as SettingUpdateResponse,
114
+ type SettingUpdateParams as SettingUpdateParams,
115
+ };
116
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './business-accounts/index';
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ BusinessAccounts,
5
+ type BusinessAccountRetrieveResponse,
6
+ type BusinessAccountListResponse,
7
+ type BusinessAccountListParams,
8
+ type BusinessAccountListResponsesDefaultFlatPagination,
9
+ } from './business-accounts/index';
10
+ export {
11
+ PhoneNumbers,
12
+ type PhoneNumberListResponse,
13
+ type PhoneNumberListParams,
14
+ type PhoneNumberResendVerificationParams,
15
+ type PhoneNumberVerifyParams,
16
+ type PhoneNumberListResponsesDefaultFlatPagination,
17
+ } from './phone-numbers/index';
18
+ export {
19
+ Templates,
20
+ type TemplateCreateResponse,
21
+ type TemplateCreateParams,
22
+ type TemplateListParams,
23
+ } from './templates';
24
+ export { Whatsapp } from './whatsapp';
@@ -0,0 +1,86 @@
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
+ import { path } from '../../../internal/utils/path';
7
+
8
+ /**
9
+ * Manage Whatsapp phone numbers
10
+ */
11
+ export class CallingSettings extends APIResource {
12
+ /**
13
+ * Get calling settings for a phone number
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const callingSetting =
18
+ * await client.whatsapp.phoneNumbers.callingSettings.retrieve(
19
+ * 'phone_number',
20
+ * );
21
+ * ```
22
+ */
23
+ retrieve(phoneNumber: string, options?: RequestOptions): APIPromise<CallingSettingRetrieveResponse> {
24
+ return this._client.get(path`/v2/whatsapp/phone_numbers/${phoneNumber}/calling_settings`, options);
25
+ }
26
+
27
+ /**
28
+ * Enable or disable Whatsapp calling for a phone number
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const callingSetting =
33
+ * await client.whatsapp.phoneNumbers.callingSettings.update(
34
+ * 'phone_number',
35
+ * { enabled: true },
36
+ * );
37
+ * ```
38
+ */
39
+ update(
40
+ phoneNumber: string,
41
+ body: CallingSettingUpdateParams,
42
+ options?: RequestOptions,
43
+ ): APIPromise<CallingSettingUpdateResponse> {
44
+ return this._client.patch(path`/v2/whatsapp/phone_numbers/${phoneNumber}/calling_settings`, {
45
+ body,
46
+ ...options,
47
+ });
48
+ }
49
+ }
50
+
51
+ export interface WhatsappCallingSettingsData {
52
+ /**
53
+ * True if calling is enabled on the phone
54
+ */
55
+ enabled?: boolean;
56
+
57
+ /**
58
+ * Phone number in E164 format
59
+ */
60
+ phone_number?: string;
61
+
62
+ record_type?: string;
63
+
64
+ updated_at?: string;
65
+ }
66
+
67
+ export interface CallingSettingRetrieveResponse {
68
+ data?: WhatsappCallingSettingsData;
69
+ }
70
+
71
+ export interface CallingSettingUpdateResponse {
72
+ data?: WhatsappCallingSettingsData;
73
+ }
74
+
75
+ export interface CallingSettingUpdateParams {
76
+ enabled: boolean;
77
+ }
78
+
79
+ export declare namespace CallingSettings {
80
+ export {
81
+ type WhatsappCallingSettingsData as WhatsappCallingSettingsData,
82
+ type CallingSettingRetrieveResponse as CallingSettingRetrieveResponse,
83
+ type CallingSettingUpdateResponse as CallingSettingUpdateResponse,
84
+ type CallingSettingUpdateParams as CallingSettingUpdateParams,
85
+ };
86
+ }
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ CallingSettings,
5
+ type WhatsappCallingSettingsData,
6
+ type CallingSettingRetrieveResponse,
7
+ type CallingSettingUpdateResponse,
8
+ type CallingSettingUpdateParams,
9
+ } from './calling-settings';
10
+ export {
11
+ PhoneNumbers,
12
+ type PhoneNumberListResponse,
13
+ type PhoneNumberListParams,
14
+ type PhoneNumberResendVerificationParams,
15
+ type PhoneNumberVerifyParams,
16
+ type PhoneNumberListResponsesDefaultFlatPagination,
17
+ } from './phone-numbers';
18
+ export {
19
+ Profile,
20
+ type WhatsappProfileData,
21
+ type ProfileRetrieveResponse,
22
+ type ProfileUpdateResponse,
23
+ type ProfileUpdateParams,
24
+ } from './profile/index';