agentphone 1.0.15 → 1.0.16

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 (96) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/requests/CreateAgentRequest.d.ts +5 -0
  3. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +5 -0
  4. package/dist/cjs/api/resources/calls/client/requests/CreateOutboundCallRequest.d.ts +4 -0
  5. package/dist/cjs/api/resources/contacts/client/Client.d.ts +20 -0
  6. package/dist/cjs/api/resources/contacts/client/Client.js +62 -0
  7. package/dist/cjs/api/resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.d.ts +10 -0
  8. package/dist/cjs/api/resources/contacts/client/requests/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/registration/client/Client.d.ts +36 -9
  10. package/dist/cjs/api/resources/registration/client/Client.js +67 -9
  11. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.ts +8 -0
  12. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.js +3 -0
  13. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.d.ts +52 -30
  14. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.js +9 -0
  15. package/dist/cjs/api/resources/registration/client/requests/index.d.ts +2 -1
  16. package/dist/cjs/api/resources/registration/client/requests/index.js +3 -0
  17. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +4 -1
  18. package/dist/cjs/api/resources/subAccounts/client/Client.js +23 -10
  19. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.ts +8 -0
  20. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.js +3 -0
  21. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +1 -0
  22. package/dist/cjs/api/types/AgentResponse.d.ts +3 -0
  23. package/dist/cjs/api/types/CampaignInclude.d.ts +7 -0
  24. package/dist/cjs/api/types/CampaignInclude.js +10 -0
  25. package/dist/cjs/api/types/CampaignStatusResponse.d.ts +4 -0
  26. package/dist/cjs/api/types/CampaignStatusResponse.js +3 -0
  27. package/dist/cjs/api/types/ContactCapabilitiesResponse.d.ts +6 -0
  28. package/dist/cjs/api/types/ContactCapabilitiesResponse.js +3 -0
  29. package/dist/cjs/api/types/ContactCapabilityFlags.d.ts +4 -0
  30. package/dist/cjs/api/types/ContactCapabilityFlags.js +3 -0
  31. package/dist/cjs/api/types/ContactTitle.d.ts +11 -0
  32. package/dist/cjs/api/types/ContactTitle.js +14 -0
  33. package/dist/cjs/api/types/CustomToolParam.d.ts +28 -0
  34. package/dist/cjs/api/types/CustomToolParam.js +12 -0
  35. package/dist/cjs/api/types/OrganizationType.d.ts +11 -0
  36. package/dist/cjs/api/types/OrganizationType.js +14 -0
  37. package/dist/cjs/api/types/RegistrationResponse.d.ts +2 -3
  38. package/dist/cjs/api/types/UseCase.d.ts +13 -0
  39. package/dist/cjs/api/types/UseCase.js +16 -0
  40. package/dist/cjs/api/types/Volume.d.ts +5 -0
  41. package/dist/cjs/api/types/Volume.js +8 -0
  42. package/dist/cjs/api/types/index.d.ts +9 -1
  43. package/dist/cjs/api/types/index.js +9 -1
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +5 -0
  48. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +5 -0
  49. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +4 -0
  50. package/dist/esm/api/resources/contacts/client/Client.d.mts +20 -0
  51. package/dist/esm/api/resources/contacts/client/Client.mjs +62 -0
  52. package/dist/esm/api/resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.d.mts +10 -0
  53. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -0
  54. package/dist/esm/api/resources/registration/client/Client.d.mts +36 -9
  55. package/dist/esm/api/resources/registration/client/Client.mjs +68 -10
  56. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.mts +8 -0
  57. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.mjs +2 -0
  58. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.d.mts +52 -30
  59. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.mjs +8 -1
  60. package/dist/esm/api/resources/registration/client/requests/index.d.mts +2 -1
  61. package/dist/esm/api/resources/registration/client/requests/index.mjs +1 -1
  62. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +4 -1
  63. package/dist/esm/api/resources/subAccounts/client/Client.mjs +23 -10
  64. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.mts +8 -0
  65. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.mjs +2 -0
  66. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +1 -0
  67. package/dist/esm/api/types/AgentResponse.d.mts +3 -0
  68. package/dist/esm/api/types/CampaignInclude.d.mts +7 -0
  69. package/dist/esm/api/types/CampaignInclude.mjs +7 -0
  70. package/dist/esm/api/types/CampaignStatusResponse.d.mts +4 -0
  71. package/dist/esm/api/types/CampaignStatusResponse.mjs +2 -0
  72. package/dist/esm/api/types/ContactCapabilitiesResponse.d.mts +6 -0
  73. package/dist/esm/api/types/ContactCapabilitiesResponse.mjs +2 -0
  74. package/dist/esm/api/types/ContactCapabilityFlags.d.mts +4 -0
  75. package/dist/esm/api/types/ContactCapabilityFlags.mjs +2 -0
  76. package/dist/esm/api/types/ContactTitle.d.mts +11 -0
  77. package/dist/esm/api/types/ContactTitle.mjs +11 -0
  78. package/dist/esm/api/types/CustomToolParam.d.mts +28 -0
  79. package/dist/esm/api/types/CustomToolParam.mjs +9 -0
  80. package/dist/esm/api/types/OrganizationType.d.mts +11 -0
  81. package/dist/esm/api/types/OrganizationType.mjs +11 -0
  82. package/dist/esm/api/types/RegistrationResponse.d.mts +2 -3
  83. package/dist/esm/api/types/UseCase.d.mts +13 -0
  84. package/dist/esm/api/types/UseCase.mjs +13 -0
  85. package/dist/esm/api/types/Volume.d.mts +5 -0
  86. package/dist/esm/api/types/Volume.mjs +5 -0
  87. package/dist/esm/api/types/index.d.mts +9 -1
  88. package/dist/esm/api/types/index.mjs +9 -1
  89. package/dist/esm/version.d.mts +1 -1
  90. package/dist/esm/version.mjs +1 -1
  91. package/package.json +1 -1
  92. package/reference.md +167 -10
  93. package/dist/cjs/api/types/FieldWarning.d.ts +0 -6
  94. package/dist/esm/api/types/FieldWarning.d.mts +0 -6
  95. /package/dist/cjs/api/{types/FieldWarning.js → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.js} +0 -0
  96. /package/dist/esm/api/{types/FieldWarning.mjs → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.mjs} +0 -0
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentphone",
46
- "X-Fern-SDK-Version": "1.0.15",
47
- "User-Agent": "agentphone/1.0.15",
46
+ "X-Fern-SDK-Version": "1.0.16",
47
+ "User-Agent": "agentphone/1.0.16",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,3 +1,4 @@
1
+ import type * as AgentPhone from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -17,7 +18,11 @@ export interface CreateAgentRequest {
17
18
  beginMessage?: string | null;
18
19
  voice?: string | null;
19
20
  transferNumber?: string | null;
21
+ /** Hosted-mode only. User-defined function tools the agent can call during a call (look up a record, save call notes, etc.). Each points at your HTTPS endpoint; the voice provider invokes it and feeds the JSON response back to the agent. Ignored in webhook mode. Maximum 20 tools. */
22
+ customTools?: AgentPhone.CustomToolParam[] | null;
20
23
  voicemailMessage?: string | null;
24
+ callScreeningIdentity?: string | null;
25
+ callScreeningPurpose?: string | null;
21
26
  /** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
22
27
  sttMode?: CreateAgentRequest.SttMode;
23
28
  /** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
@@ -1,3 +1,4 @@
1
+ import type * as AgentPhone from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -18,7 +19,11 @@ export interface UpdateAgentRequest {
18
19
  beginMessage?: string | null;
19
20
  voice?: string | null;
20
21
  transferNumber?: string | null;
22
+ /** Hosted-mode only. User-defined function tools the agent can call during a call. Replaces the full set on each update; send [] to clear all tools, or omit to leave unchanged. Ignored in webhook mode. Maximum 20 tools. */
23
+ customTools?: AgentPhone.CustomToolParam[] | null;
21
24
  voicemailMessage?: string | null;
25
+ callScreeningIdentity?: string | null;
26
+ callScreeningPurpose?: string | null;
22
27
  /** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
23
28
  sttMode?: UpdateAgentRequest.SttMode;
24
29
  /** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */
@@ -22,4 +22,8 @@ export interface CreateOutboundCallRequest {
22
22
  systemPrompt?: string | null;
23
23
  /** Optional per-call dynamic variables. Values are substituted into ``{{var_name}}`` placeholders in the agent's system prompt and initial greeting at call time. Requires either ``systemPrompt`` or a hosted-mode agent. */
24
24
  variables?: Record<string, string | null> | null;
25
+ /** For outbound calls that hit an automated call screener (e.g. iOS 26 Call Screening or Android Call Screen): the identity the agent gives when asked who is calling. Overrides the agent's stored default for this call. Both identity and purpose are required to enable screening; if only a purpose is set, the agent's name is used. */
26
+ callScreeningIdentity?: string | null;
27
+ /** For outbound calls that hit an automated call screener: the purpose the agent gives when asked why it is calling. Overrides the agent's stored default for this call. */
28
+ callScreeningPurpose?: string | null;
25
29
  }
@@ -44,6 +44,26 @@ export declare class ContactsClient {
44
44
  */
45
45
  createContact(request: AgentPhone.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactResponse>;
46
46
  private __createContact;
47
+ /**
48
+ * Check which messaging channels a phone number supports, without sending
49
+ * a message.
50
+ *
51
+ * Runs a live check (typically 1-2 seconds), so the result reflects the
52
+ * number right now. Capabilities can still change by the time you send.
53
+ * Requires at least one active iMessage-capable number on the account.
54
+ *
55
+ * @param {AgentPhone.GetContactCapabilitiesV1ContactsCapabilitiesGetRequest} request
56
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link AgentPhone.UnprocessableEntityError}
59
+ *
60
+ * @example
61
+ * await client.contacts.getContactCapabilities({
62
+ * phone_number: "phone_number"
63
+ * })
64
+ */
65
+ getContactCapabilities(request: AgentPhone.GetContactCapabilitiesV1ContactsCapabilitiesGetRequest, requestOptions?: ContactsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ContactCapabilitiesResponse>;
66
+ private __getContactCapabilities;
47
67
  /**
48
68
  * Get a single contact by ID.
49
69
  *
@@ -178,6 +178,68 @@ class ContactsClient {
178
178
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/contacts");
179
179
  });
180
180
  }
181
+ /**
182
+ * Check which messaging channels a phone number supports, without sending
183
+ * a message.
184
+ *
185
+ * Runs a live check (typically 1-2 seconds), so the result reflects the
186
+ * number right now. Capabilities can still change by the time you send.
187
+ * Requires at least one active iMessage-capable number on the account.
188
+ *
189
+ * @param {AgentPhone.GetContactCapabilitiesV1ContactsCapabilitiesGetRequest} request
190
+ * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration.
191
+ *
192
+ * @throws {@link AgentPhone.UnprocessableEntityError}
193
+ *
194
+ * @example
195
+ * await client.contacts.getContactCapabilities({
196
+ * phone_number: "phone_number"
197
+ * })
198
+ */
199
+ getContactCapabilities(request, requestOptions) {
200
+ return core.HttpResponsePromise.fromPromise(this.__getContactCapabilities(request, requestOptions));
201
+ }
202
+ __getContactCapabilities(request, requestOptions) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
205
+ const { phone_number: phoneNumber } = request;
206
+ const _queryParams = {
207
+ phone_number: phoneNumber,
208
+ };
209
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
210
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
211
+ const _response = yield core.fetcher({
212
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v1/contacts/capabilities"),
213
+ method: "GET",
214
+ headers: _headers,
215
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
216
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
217
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
218
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
219
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
220
+ logging: this._options.logging,
221
+ });
222
+ if (_response.ok) {
223
+ return {
224
+ data: _response.body,
225
+ rawResponse: _response.rawResponse,
226
+ };
227
+ }
228
+ if (_response.error.reason === "status-code") {
229
+ switch (_response.error.statusCode) {
230
+ case 422:
231
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
232
+ default:
233
+ throw new errors.AgentPhoneError({
234
+ statusCode: _response.error.statusCode,
235
+ body: _response.error.body,
236
+ rawResponse: _response.rawResponse,
237
+ });
238
+ }
239
+ }
240
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/contacts/capabilities");
241
+ });
242
+ }
181
243
  /**
182
244
  * Get a single contact by ID.
183
245
  *
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * phone_number: "phone_number"
5
+ * }
6
+ */
7
+ export interface GetContactCapabilitiesV1ContactsCapabilitiesGetRequest {
8
+ /** Phone number to check (E.164 preferred; URL-encode + as %2B) */
9
+ phone_number: string;
10
+ }
@@ -1,5 +1,6 @@
1
1
  export type { CreateContactRequest } from "./CreateContactRequest.js";
2
2
  export type { DeleteContactV1ContactsContactIdDeleteRequest } from "./DeleteContactV1ContactsContactIdDeleteRequest.js";
3
+ export type { GetContactCapabilitiesV1ContactsCapabilitiesGetRequest } from "./GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.js";
3
4
  export type { GetContactV1ContactsContactIdGetRequest } from "./GetContactV1ContactsContactIdGetRequest.js";
4
5
  export type { ListContactsV1ContactsGetRequest } from "./ListContactsV1ContactsGetRequest.js";
5
6
  export type { UpdateContactRequest } from "./UpdateContactRequest.js";
@@ -10,6 +10,27 @@ export declare namespace RegistrationClient {
10
10
  export declare class RegistrationClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<RegistrationClient.Options>;
12
12
  constructor(options?: RegistrationClient.Options);
13
+ /**
14
+ * Check the status of your A2P 10DLC registration.
15
+ *
16
+ * ### Sub-account status
17
+ *
18
+ * To check the registration status of a sub-account, pass the `X-Sub-Account-Id` header with the sub-account ID returned from `POST /v1/register`.
19
+ *
20
+ * ### Possible statuses
21
+ *
22
+ * - `none` -- No registration submitted.
23
+ * - `pending` -- Registration is under review.
24
+ * - `approved` -- Registration approved. Your account is ready to send messages.
25
+ *
26
+ * @param {AgentPhone.GetRegistrationStatusV1RegisterStatusGetRequest} request
27
+ * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @example
30
+ * await client.registration.getRegistrationStatus()
31
+ */
32
+ getRegistrationStatus(request?: AgentPhone.GetRegistrationStatusV1RegisterStatusGetRequest, requestOptions?: RegistrationClient.RequestOptions): core.HttpResponsePromise<AgentPhone.CampaignStatusResponse>;
33
+ private __getRegistrationStatus;
13
34
  /**
14
35
  * Submit an A2P 10DLC registration to enable outbound SMS on your account.
15
36
  *
@@ -18,15 +39,18 @@ export declare class RegistrationClient {
18
39
  * ### How it works
19
40
  *
20
41
  * 1. Submit your registration details via this endpoint
21
- * 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
22
- * 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
23
- * 4. After payment, we submit your registration to the carriers on your behalf
24
- * 5. Carrier approval typically takes 7-10 business days
42
+ * 2. A one-time $25 registration fee is deducted from your account balance
43
+ * 3. We submit your registration to the carriers on your behalf
44
+ * 4. Carrier approval typically takes 7-10 business days
25
45
  *
26
46
  * ### Registration types
27
47
  *
28
- * - **`sole_proprietor`** For individuals or small businesses. Simpler requirements, fewer fields.
29
- * - **`standard_brand`** For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
48
+ * - **`sole_proprietor`** -- For individuals or small businesses. Simpler requirements, fewer fields.
49
+ * - **`standard_brand`** -- For established businesses. Requires `business_name`, `organization_type`, `ein`, `privacy_policy_url`, `terms_of_service_url`.
50
+ *
51
+ * ### Sub-accounts
52
+ *
53
+ * Parent accounts can set `create_sub_account: true` (the default) to create a dedicated sub-account for each registration. This lets you manage multiple campaigns independently. The $25 fee is always charged to the parent account.
30
54
  *
31
55
  * ### Opt-in image
32
56
  *
@@ -34,7 +58,7 @@ export declare class RegistrationClient {
34
58
  *
35
59
  * ### Re-submitting
36
60
  *
37
- * If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
61
+ * If your previous registration was rejected, you can call this endpoint again to re-register.
38
62
  *
39
63
  * @param {AgentPhone.RegistrationRequest} request
40
64
  * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -43,7 +67,7 @@ export declare class RegistrationClient {
43
67
  *
44
68
  * @example
45
69
  * await client.registration.registerA2P({
46
- * registration_type: "registration_type",
70
+ * registration_type: "sole_proprietor",
47
71
  * first_name: "first_name",
48
72
  * last_name: "last_name",
49
73
  * email: "email",
@@ -52,7 +76,10 @@ export declare class RegistrationClient {
52
76
  * city: "city",
53
77
  * state: "state",
54
78
  * zip_code: "zip_code",
55
- * use_case_description: "use_case_description",
79
+ * description: "description",
80
+ * use_cases: ["account_notification"],
81
+ * message_samples: ["message_samples"],
82
+ * consent_flow: "consent_flow",
56
83
  * opt_in_image_url: "opt_in_image_url"
57
84
  * })
58
85
  */
@@ -55,6 +55,58 @@ class RegistrationClient {
55
55
  constructor(options = {}) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * Check the status of your A2P 10DLC registration.
60
+ *
61
+ * ### Sub-account status
62
+ *
63
+ * To check the registration status of a sub-account, pass the `X-Sub-Account-Id` header with the sub-account ID returned from `POST /v1/register`.
64
+ *
65
+ * ### Possible statuses
66
+ *
67
+ * - `none` -- No registration submitted.
68
+ * - `pending` -- Registration is under review.
69
+ * - `approved` -- Registration approved. Your account is ready to send messages.
70
+ *
71
+ * @param {AgentPhone.GetRegistrationStatusV1RegisterStatusGetRequest} request
72
+ * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
73
+ *
74
+ * @example
75
+ * await client.registration.getRegistrationStatus()
76
+ */
77
+ getRegistrationStatus(request = {}, requestOptions) {
78
+ return core.HttpResponsePromise.fromPromise(this.__getRegistrationStatus(request, requestOptions));
79
+ }
80
+ __getRegistrationStatus() {
81
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
82
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
+ const { "X-Sub-Account-Id": subAccountId } = request;
84
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
85
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
86
+ const _response = yield core.fetcher({
87
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v1/register/status"),
88
+ method: "GET",
89
+ headers: _headers,
90
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
91
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
92
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
93
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
94
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
95
+ logging: this._options.logging,
96
+ });
97
+ if (_response.ok) {
98
+ return { data: _response.body, rawResponse: _response.rawResponse };
99
+ }
100
+ if (_response.error.reason === "status-code") {
101
+ throw new errors.AgentPhoneError({
102
+ statusCode: _response.error.statusCode,
103
+ body: _response.error.body,
104
+ rawResponse: _response.rawResponse,
105
+ });
106
+ }
107
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/register/status");
108
+ });
109
+ }
58
110
  /**
59
111
  * Submit an A2P 10DLC registration to enable outbound SMS on your account.
60
112
  *
@@ -63,15 +115,18 @@ class RegistrationClient {
63
115
  * ### How it works
64
116
  *
65
117
  * 1. Submit your registration details via this endpoint
66
- * 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
67
- * 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
68
- * 4. After payment, we submit your registration to the carriers on your behalf
69
- * 5. Carrier approval typically takes 7-10 business days
118
+ * 2. A one-time $25 registration fee is deducted from your account balance
119
+ * 3. We submit your registration to the carriers on your behalf
120
+ * 4. Carrier approval typically takes 7-10 business days
70
121
  *
71
122
  * ### Registration types
72
123
  *
73
- * - **`sole_proprietor`** For individuals or small businesses. Simpler requirements, fewer fields.
74
- * - **`standard_brand`** For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
124
+ * - **`sole_proprietor`** -- For individuals or small businesses. Simpler requirements, fewer fields.
125
+ * - **`standard_brand`** -- For established businesses. Requires `business_name`, `organization_type`, `ein`, `privacy_policy_url`, `terms_of_service_url`.
126
+ *
127
+ * ### Sub-accounts
128
+ *
129
+ * Parent accounts can set `create_sub_account: true` (the default) to create a dedicated sub-account for each registration. This lets you manage multiple campaigns independently. The $25 fee is always charged to the parent account.
75
130
  *
76
131
  * ### Opt-in image
77
132
  *
@@ -79,7 +134,7 @@ class RegistrationClient {
79
134
  *
80
135
  * ### Re-submitting
81
136
  *
82
- * If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
137
+ * If your previous registration was rejected, you can call this endpoint again to re-register.
83
138
  *
84
139
  * @param {AgentPhone.RegistrationRequest} request
85
140
  * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -88,7 +143,7 @@ class RegistrationClient {
88
143
  *
89
144
  * @example
90
145
  * await client.registration.registerA2P({
91
- * registration_type: "registration_type",
146
+ * registration_type: "sole_proprietor",
92
147
  * first_name: "first_name",
93
148
  * last_name: "last_name",
94
149
  * email: "email",
@@ -97,7 +152,10 @@ class RegistrationClient {
97
152
  * city: "city",
98
153
  * state: "state",
99
154
  * zip_code: "zip_code",
100
- * use_case_description: "use_case_description",
155
+ * description: "description",
156
+ * use_cases: ["account_notification"],
157
+ * message_samples: ["message_samples"],
158
+ * consent_flow: "consent_flow",
101
159
  * opt_in_image_url: "opt_in_image_url"
102
160
  * })
103
161
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface GetRegistrationStatusV1RegisterStatusGetRequest {
6
+ /** Check a sub-account's registration status. Pass the sub-account ID returned from `POST /v1/register`. Omit to check the master account. */
7
+ "X-Sub-Account-Id"?: string;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,8 @@
1
+ import type * as AgentPhone from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
4
- * registration_type: "registration_type",
5
+ * registration_type: "sole_proprietor",
5
6
  * first_name: "first_name",
6
7
  * last_name: "last_name",
7
8
  * email: "email",
@@ -10,52 +11,73 @@
10
11
  * city: "city",
11
12
  * state: "state",
12
13
  * zip_code: "zip_code",
13
- * use_case_description: "use_case_description",
14
+ * description: "description",
15
+ * use_cases: ["account_notification"],
16
+ * message_samples: ["message_samples"],
17
+ * consent_flow: "consent_flow",
14
18
  * opt_in_image_url: "opt_in_image_url"
15
19
  * }
16
20
  */
17
21
  export interface RegistrationRequest {
18
22
  /** 'sole_proprietor' or 'standard_brand' */
19
- registration_type: string;
20
- /** Required for standard_brand */
21
- business_name?: string | null;
23
+ registration_type: RegistrationRequest.RegistrationType;
22
24
  first_name: string;
23
25
  last_name: string;
24
26
  email: string;
25
27
  /** E.164 format, e.g. +15551234567 */
26
28
  phone_number: string;
27
- /** Number of phone numbers you plan to use */
28
- planned_numbers?: number;
29
+ /** Legal/registered business name. Required for standard_brand. */
30
+ business_name?: string | null;
31
+ /** Public-facing brand name if different from business_name. */
32
+ brand_name?: string | null;
33
+ /** Required for standard_brand. */
34
+ organization_type?: AgentPhone.OrganizationType | null;
35
+ /** Your role. Required for standard_brand. */
36
+ contact_title?: AgentPhone.ContactTitle | null;
37
+ /** Custom title when contact_title is 'other'. */
38
+ contact_title_other?: string | null;
39
+ /** EIN / Tax ID. Required for standard_brand. */
40
+ ein?: string | null;
41
+ website_url?: string | null;
42
+ /** e.g. technology, real_estate, retail, healthcare */
43
+ industry?: string | null;
44
+ business_regions?: string[];
29
45
  street_address: string;
46
+ street_address_2?: string | null;
30
47
  city: string;
31
48
  state: string;
32
49
  zip_code: string;
33
50
  country?: string;
34
- business_type?: string | null;
35
- business_industry?: string | null;
36
- position_in_company?: string | null;
37
- /** EIN / Tax ID (standard_brand only) */
38
- ein?: string | null;
39
- registration_id_type?: string | null;
40
- company_type?: string | null;
41
- website_url?: string | null;
42
- social_media_url?: string | null;
43
- business_regions?: string | null;
44
- /** Required for standard_brand */
51
+ /** Number of phone numbers you plan to use */
52
+ planned_numbers?: number;
53
+ /** What your business does, who you message, and what types of messages you send. Min 40 chars. */
54
+ description: string;
55
+ /** 1-5 specific use cases for your SMS campaign. */
56
+ use_cases: AgentPhone.UseCase[];
57
+ /** Expected message volume. */
58
+ volume?: AgentPhone.Volume;
59
+ /** 2-5 example messages. Each must be 20-1024 chars and include your brand name. */
60
+ message_samples: string[];
61
+ /** How users opt in to receive messages. Min 40 chars. */
62
+ consent_flow: string;
63
+ /** Required for standard_brand. */
45
64
  privacy_policy_url?: string | null;
46
- /** Required for standard_brand */
65
+ /** Required for standard_brand. */
47
66
  terms_of_service_url?: string | null;
48
- use_case?: string | null;
49
- /** Who you message, why, and how. Minimum 40 characters. */
50
- use_case_description: string;
51
- /** Required for standard_brand. Min 20 chars, include brand name. */
52
- sample_message_1?: string | null;
53
- /** Required for standard_brand. Min 20 chars, include brand name. */
54
- sample_message_2?: string | null;
55
- /** How users opt in to receive messages */
56
- message_flow?: string | null;
57
67
  /** Publicly accessible URL to a screenshot of your opt-in flow (PNG, JPG, WEBP, or GIF, max 2MB) */
58
68
  opt_in_image_url: string;
59
- has_embedded_links?: boolean;
60
- has_embedded_phone?: boolean;
69
+ /** Content types included in messages. */
70
+ includes?: AgentPhone.CampaignInclude[];
71
+ /** Example URL if messages contain links. */
72
+ link_sample?: string | null;
73
+ /** Create a dedicated sub-account for this campaign. Set false to register on your main account. */
74
+ create_sub_account?: boolean;
75
+ }
76
+ export declare namespace RegistrationRequest {
77
+ /** 'sole_proprietor' or 'standard_brand' */
78
+ const RegistrationType: {
79
+ readonly SoleProprietor: "sole_proprietor";
80
+ readonly StandardBrand: "standard_brand";
81
+ };
82
+ type RegistrationType = (typeof RegistrationType)[keyof typeof RegistrationType];
61
83
  }
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RegistrationRequest = void 0;
5
+ var RegistrationRequest;
6
+ (function (RegistrationRequest) {
7
+ /** 'sole_proprietor' or 'standard_brand' */
8
+ RegistrationRequest.RegistrationType = {
9
+ SoleProprietor: "sole_proprietor",
10
+ StandardBrand: "standard_brand",
11
+ };
12
+ })(RegistrationRequest || (exports.RegistrationRequest = RegistrationRequest = {}));
@@ -1 +1,2 @@
1
- export type { RegistrationRequest } from "./RegistrationRequest.js";
1
+ export type { GetRegistrationStatusV1RegisterStatusGetRequest } from "./GetRegistrationStatusV1RegisterStatusGetRequest.js";
2
+ export { RegistrationRequest } from "./RegistrationRequest.js";
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegistrationRequest = void 0;
4
+ var RegistrationRequest_js_1 = require("./RegistrationRequest.js");
5
+ Object.defineProperty(exports, "RegistrationRequest", { enumerable: true, get: function () { return RegistrationRequest_js_1.RegistrationRequest; } });
@@ -11,12 +11,15 @@ export declare class SubAccountsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<SubAccountsClient.Options>;
12
12
  constructor(options?: SubAccountsClient.Options);
13
13
  /**
14
+ * @param {AgentPhone.ListSubAccountsV1SubAccountsGetRequest} request
14
15
  * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
15
16
  *
17
+ * @throws {@link AgentPhone.UnprocessableEntityError}
18
+ *
16
19
  * @example
17
20
  * await client.subAccounts.listSubAccounts()
18
21
  */
19
- listSubAccounts(requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
22
+ listSubAccounts(request?: AgentPhone.ListSubAccountsV1SubAccountsGetRequest, requestOptions?: SubAccountsClient.RequestOptions): core.HttpResponsePromise<unknown>;
20
23
  private __listSubAccounts;
21
24
  /**
22
25
  * @param {AgentPhone.CreateSubAccountRequest} request
@@ -67,24 +67,32 @@ class SubAccountsClient {
67
67
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
68
68
  }
69
69
  /**
70
+ * @param {AgentPhone.ListSubAccountsV1SubAccountsGetRequest} request
70
71
  * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
71
72
  *
73
+ * @throws {@link AgentPhone.UnprocessableEntityError}
74
+ *
72
75
  * @example
73
76
  * await client.subAccounts.listSubAccounts()
74
77
  */
75
- listSubAccounts(requestOptions) {
76
- return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(requestOptions));
78
+ listSubAccounts(request = {}, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(request, requestOptions));
77
80
  }
78
- __listSubAccounts(requestOptions) {
79
- return __awaiter(this, void 0, void 0, function* () {
81
+ __listSubAccounts() {
82
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
83
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
84
+ const { limit, offset } = request;
85
+ const _queryParams = {
86
+ limit,
87
+ offset,
88
+ };
81
89
  const _authRequest = yield this._options.authProvider.getAuthRequest();
82
90
  const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
83
91
  const _response = yield core.fetcher({
84
92
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentPhoneEnvironment.Production, "v1/sub-accounts"),
85
93
  method: "GET",
86
94
  headers: _headers,
87
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
95
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
88
96
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
89
97
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
90
98
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -95,11 +103,16 @@ class SubAccountsClient {
95
103
  return { data: _response.body, rawResponse: _response.rawResponse };
96
104
  }
97
105
  if (_response.error.reason === "status-code") {
98
- throw new errors.AgentPhoneError({
99
- statusCode: _response.error.statusCode,
100
- body: _response.error.body,
101
- rawResponse: _response.rawResponse,
102
- });
106
+ switch (_response.error.statusCode) {
107
+ case 422:
108
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
109
+ default:
110
+ throw new errors.AgentPhoneError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.body,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ }
103
116
  }
104
117
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/sub-accounts");
105
118
  });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListSubAccountsV1SubAccountsGetRequest {
6
+ limit?: number | null;
7
+ offset?: number;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
1
  export type { CreateSubAccountRequest } from "./CreateSubAccountRequest.js";
2
2
  export type { DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest } from "./DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.js";
3
+ export type { ListSubAccountsV1SubAccountsGetRequest } from "./ListSubAccountsV1SubAccountsGetRequest.js";
3
4
  export type { UpdateSubAccountRequest } from "./UpdateSubAccountRequest.js";
@@ -10,7 +10,10 @@ export interface AgentResponse {
10
10
  beginMessage?: string | null;
11
11
  voice: string;
12
12
  transferNumber?: string | null;
13
+ customTools?: Record<string, unknown>[] | null;
13
14
  voicemailMessage?: string | null;
15
+ callScreeningIdentity?: string | null;
16
+ callScreeningPurpose?: string | null;
14
17
  /** Speech-to-text mode. 'fast' optimizes for latency, 'accurate' optimizes for transcription accuracy (~200ms additional latency). */
15
18
  sttMode?: AgentResponse.SttMode;
16
19
  /** Background ambience to mask synthetic silence between turns. 'none' disables; 'office', 'coffee-shop', 'outdoor' enable a quiet bed. */