agentphone 1.0.14 → 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 (116) 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/conversations/client/Client.d.ts +8 -6
  10. package/dist/cjs/api/resources/conversations/client/Client.js +8 -6
  11. package/dist/cjs/api/resources/conversations/client/requests/UpdateConversationRequest.d.ts +2 -0
  12. package/dist/cjs/api/resources/messages/client/Client.d.ts +0 -1
  13. package/dist/cjs/api/resources/messages/client/Client.js +0 -1
  14. package/dist/cjs/api/resources/messages/client/requests/SendMessageRequest.d.ts +4 -2
  15. package/dist/cjs/api/resources/registration/client/Client.d.ts +36 -9
  16. package/dist/cjs/api/resources/registration/client/Client.js +67 -9
  17. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.ts +8 -0
  18. package/dist/cjs/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.js +3 -0
  19. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.d.ts +52 -30
  20. package/dist/cjs/api/resources/registration/client/requests/RegistrationRequest.js +9 -0
  21. package/dist/cjs/api/resources/registration/client/requests/index.d.ts +2 -1
  22. package/dist/cjs/api/resources/registration/client/requests/index.js +3 -0
  23. package/dist/cjs/api/resources/subAccounts/client/Client.d.ts +4 -1
  24. package/dist/cjs/api/resources/subAccounts/client/Client.js +23 -10
  25. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.ts +8 -0
  26. package/dist/cjs/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.js +3 -0
  27. package/dist/cjs/api/resources/subAccounts/client/requests/index.d.ts +1 -0
  28. package/dist/cjs/api/types/AgentResponse.d.ts +3 -0
  29. package/dist/cjs/api/types/CampaignInclude.d.ts +7 -0
  30. package/dist/cjs/api/types/CampaignInclude.js +10 -0
  31. package/dist/cjs/api/types/CampaignStatusResponse.d.ts +4 -0
  32. package/dist/cjs/api/types/CampaignStatusResponse.js +3 -0
  33. package/dist/cjs/api/types/ContactCapabilitiesResponse.d.ts +6 -0
  34. package/dist/cjs/api/types/ContactCapabilitiesResponse.js +3 -0
  35. package/dist/cjs/api/types/ContactCapabilityFlags.d.ts +4 -0
  36. package/dist/cjs/api/types/ContactCapabilityFlags.js +3 -0
  37. package/dist/cjs/api/types/ContactTitle.d.ts +11 -0
  38. package/dist/cjs/api/types/ContactTitle.js +14 -0
  39. package/dist/cjs/api/types/CustomToolParam.d.ts +28 -0
  40. package/dist/cjs/api/types/CustomToolParam.js +12 -0
  41. package/dist/cjs/api/types/MessageInConversation.d.ts +1 -0
  42. package/dist/cjs/api/types/OrganizationType.d.ts +11 -0
  43. package/dist/cjs/api/types/OrganizationType.js +14 -0
  44. package/dist/cjs/api/types/RegistrationResponse.d.ts +2 -3
  45. package/dist/cjs/api/types/ReplyToInConversation.d.ts +5 -0
  46. package/dist/cjs/api/types/ReplyToInConversation.js +3 -0
  47. package/dist/cjs/api/types/SendMessageResponse.d.ts +1 -0
  48. package/dist/cjs/api/types/UseCase.d.ts +13 -0
  49. package/dist/cjs/api/types/UseCase.js +16 -0
  50. package/dist/cjs/api/types/Volume.d.ts +5 -0
  51. package/dist/cjs/api/types/Volume.js +8 -0
  52. package/dist/cjs/api/types/index.d.ts +10 -1
  53. package/dist/cjs/api/types/index.js +10 -1
  54. package/dist/cjs/version.d.ts +1 -1
  55. package/dist/cjs/version.js +1 -1
  56. package/dist/esm/BaseClient.mjs +2 -2
  57. package/dist/esm/api/resources/agents/client/requests/CreateAgentRequest.d.mts +5 -0
  58. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +5 -0
  59. package/dist/esm/api/resources/calls/client/requests/CreateOutboundCallRequest.d.mts +4 -0
  60. package/dist/esm/api/resources/contacts/client/Client.d.mts +20 -0
  61. package/dist/esm/api/resources/contacts/client/Client.mjs +62 -0
  62. package/dist/esm/api/resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.d.mts +10 -0
  63. package/dist/esm/api/resources/contacts/client/requests/index.d.mts +1 -0
  64. package/dist/esm/api/resources/conversations/client/Client.d.mts +8 -6
  65. package/dist/esm/api/resources/conversations/client/Client.mjs +8 -6
  66. package/dist/esm/api/resources/conversations/client/requests/UpdateConversationRequest.d.mts +2 -0
  67. package/dist/esm/api/resources/messages/client/Client.d.mts +0 -1
  68. package/dist/esm/api/resources/messages/client/Client.mjs +0 -1
  69. package/dist/esm/api/resources/messages/client/requests/SendMessageRequest.d.mts +4 -2
  70. package/dist/esm/api/resources/registration/client/Client.d.mts +36 -9
  71. package/dist/esm/api/resources/registration/client/Client.mjs +68 -10
  72. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.d.mts +8 -0
  73. package/dist/esm/api/resources/registration/client/requests/GetRegistrationStatusV1RegisterStatusGetRequest.mjs +2 -0
  74. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.d.mts +52 -30
  75. package/dist/esm/api/resources/registration/client/requests/RegistrationRequest.mjs +8 -1
  76. package/dist/esm/api/resources/registration/client/requests/index.d.mts +2 -1
  77. package/dist/esm/api/resources/registration/client/requests/index.mjs +1 -1
  78. package/dist/esm/api/resources/subAccounts/client/Client.d.mts +4 -1
  79. package/dist/esm/api/resources/subAccounts/client/Client.mjs +23 -10
  80. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.d.mts +8 -0
  81. package/dist/esm/api/resources/subAccounts/client/requests/ListSubAccountsV1SubAccountsGetRequest.mjs +2 -0
  82. package/dist/esm/api/resources/subAccounts/client/requests/index.d.mts +1 -0
  83. package/dist/esm/api/types/AgentResponse.d.mts +3 -0
  84. package/dist/esm/api/types/CampaignInclude.d.mts +7 -0
  85. package/dist/esm/api/types/CampaignInclude.mjs +7 -0
  86. package/dist/esm/api/types/CampaignStatusResponse.d.mts +4 -0
  87. package/dist/esm/api/types/CampaignStatusResponse.mjs +2 -0
  88. package/dist/esm/api/types/ContactCapabilitiesResponse.d.mts +6 -0
  89. package/dist/esm/api/types/ContactCapabilitiesResponse.mjs +2 -0
  90. package/dist/esm/api/types/ContactCapabilityFlags.d.mts +4 -0
  91. package/dist/esm/api/types/ContactCapabilityFlags.mjs +2 -0
  92. package/dist/esm/api/types/ContactTitle.d.mts +11 -0
  93. package/dist/esm/api/types/ContactTitle.mjs +11 -0
  94. package/dist/esm/api/types/CustomToolParam.d.mts +28 -0
  95. package/dist/esm/api/types/CustomToolParam.mjs +9 -0
  96. package/dist/esm/api/types/MessageInConversation.d.mts +1 -0
  97. package/dist/esm/api/types/OrganizationType.d.mts +11 -0
  98. package/dist/esm/api/types/OrganizationType.mjs +11 -0
  99. package/dist/esm/api/types/RegistrationResponse.d.mts +2 -3
  100. package/dist/esm/api/types/ReplyToInConversation.d.mts +5 -0
  101. package/dist/esm/api/types/ReplyToInConversation.mjs +2 -0
  102. package/dist/esm/api/types/SendMessageResponse.d.mts +1 -0
  103. package/dist/esm/api/types/UseCase.d.mts +13 -0
  104. package/dist/esm/api/types/UseCase.mjs +13 -0
  105. package/dist/esm/api/types/Volume.d.mts +5 -0
  106. package/dist/esm/api/types/Volume.mjs +5 -0
  107. package/dist/esm/api/types/index.d.mts +10 -1
  108. package/dist/esm/api/types/index.mjs +10 -1
  109. package/dist/esm/version.d.mts +1 -1
  110. package/dist/esm/version.mjs +1 -1
  111. package/package.json +1 -1
  112. package/reference.md +175 -17
  113. package/dist/cjs/api/types/FieldWarning.d.ts +0 -6
  114. package/dist/esm/api/types/FieldWarning.d.mts +0 -6
  115. /package/dist/cjs/api/{types/FieldWarning.js → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.js} +0 -0
  116. /package/dist/esm/api/{types/FieldWarning.mjs → resources/contacts/client/requests/GetContactCapabilitiesV1ContactsCapabilitiesGetRequest.mjs} +0 -0
@@ -42,14 +42,16 @@ export declare class ConversationsClient {
42
42
  getConversation(request: AgentPhone.GetConversationV1ConversationsConversationIdGetRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<AgentPhone.ConversationDetail>;
43
43
  private __getConversation;
44
44
  /**
45
- * Update conversation metadata (state).
45
+ * Update a conversation.
46
46
  *
47
- * Use this to store custom context for AI agents:
48
- * - Customer information (name, account ID)
49
- * - Business context (order ID, ticket number)
50
- * - Session state (current topic, preferences)
47
+ * - `metadata`: store custom context for AI agents (customer info, order/ticket
48
+ * ids, session state). Replaces the stored object; surfaced in webhook
49
+ * payloads as `conversationState`.
50
+ * - `group_name`: rename a group conversation (iMessage groups only). Also
51
+ * renames the underlying iMessage thread.
51
52
  *
52
- * The metadata is included in webhook payloads as `conversationState`.
53
+ * Only the fields you include are changed: a rename-only PATCH leaves metadata
54
+ * untouched, and vice versa.
53
55
  *
54
56
  * @param {AgentPhone.UpdateConversationRequest} request
55
57
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -143,14 +143,16 @@ export class ConversationsClient {
143
143
  });
144
144
  }
145
145
  /**
146
- * Update conversation metadata (state).
146
+ * Update a conversation.
147
147
  *
148
- * Use this to store custom context for AI agents:
149
- * - Customer information (name, account ID)
150
- * - Business context (order ID, ticket number)
151
- * - Session state (current topic, preferences)
148
+ * - `metadata`: store custom context for AI agents (customer info, order/ticket
149
+ * ids, session state). Replaces the stored object; surfaced in webhook
150
+ * payloads as `conversationState`.
151
+ * - `group_name`: rename a group conversation (iMessage groups only). Also
152
+ * renames the underlying iMessage thread.
152
153
  *
153
- * The metadata is included in webhook payloads as `conversationState`.
154
+ * Only the fields you include are changed: a rename-only PATCH leaves metadata
155
+ * untouched, and vice versa.
154
156
  *
155
157
  * @param {AgentPhone.UpdateConversationRequest} request
156
158
  * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -7,4 +7,6 @@
7
7
  export interface UpdateConversationRequest {
8
8
  conversation_id: string;
9
9
  metadata?: Record<string, unknown> | null;
10
+ /** New display name for a group conversation. iMessage groups only; also renames the underlying iMessage thread. Ignored (omit) for 1:1 chats. */
11
+ group_name?: string | null;
10
12
  }
@@ -36,7 +36,6 @@ export declare class MessagesClient {
36
36
  *
37
37
  * @example
38
38
  * await client.messages.sendMessage({
39
- * to_number: "to_number",
40
39
  * body: "body"
41
40
  * })
42
41
  */
@@ -56,7 +56,6 @@ export class MessagesClient {
56
56
  *
57
57
  * @example
58
58
  * await client.messages.sendMessage({
59
- * to_number: "to_number",
60
59
  * body: "body"
61
60
  * })
62
61
  */
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * to_number: "to_number",
5
4
  * body: "body"
6
5
  * }
7
6
  */
8
7
  export interface SendMessageRequest {
9
8
  agent_id?: string | null;
10
- to_number: string;
9
+ /** Recipient of an existing chat: a phone (any format, normalized to E.164), US short code, email, or a group id (grp_...). Provide this OR `recipients` (to start a new group), not both. */
10
+ to_number?: string | null;
11
+ /** Start a NEW iMessage group by listing 2 or more recipients (phones or emails). The first message is delivered to all of them, an iMessage group is created, and the response `to_number` returns the new group id (grp_...) to use for follow-up sends. iMessage numbers only. */
12
+ recipients?: string[] | null;
11
13
  body: string;
12
14
  media_url?: string | null;
13
15
  media_urls?: string[] | null;
@@ -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
  */
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
- import { mergeHeaders } from "../../../../core/headers.mjs";
12
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import * as environments from "../../../../environments.mjs";
15
15
  import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
@@ -19,6 +19,58 @@ export class RegistrationClient {
19
19
  constructor(options = {}) {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
+ /**
23
+ * Check the status of your A2P 10DLC registration.
24
+ *
25
+ * ### Sub-account status
26
+ *
27
+ * 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`.
28
+ *
29
+ * ### Possible statuses
30
+ *
31
+ * - `none` -- No registration submitted.
32
+ * - `pending` -- Registration is under review.
33
+ * - `approved` -- Registration approved. Your account is ready to send messages.
34
+ *
35
+ * @param {AgentPhone.GetRegistrationStatusV1RegisterStatusGetRequest} request
36
+ * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
37
+ *
38
+ * @example
39
+ * await client.registration.getRegistrationStatus()
40
+ */
41
+ getRegistrationStatus(request = {}, requestOptions) {
42
+ return core.HttpResponsePromise.fromPromise(this.__getRegistrationStatus(request, requestOptions));
43
+ }
44
+ __getRegistrationStatus() {
45
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
47
+ const { "X-Sub-Account-Id": subAccountId } = request;
48
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
49
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Sub-Account-Id": subAccountId }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
50
+ const _response = yield core.fetcher({
51
+ 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"),
52
+ method: "GET",
53
+ headers: _headers,
54
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
55
+ 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,
56
+ 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,
57
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
59
+ logging: this._options.logging,
60
+ });
61
+ if (_response.ok) {
62
+ return { data: _response.body, rawResponse: _response.rawResponse };
63
+ }
64
+ if (_response.error.reason === "status-code") {
65
+ throw new errors.AgentPhoneError({
66
+ statusCode: _response.error.statusCode,
67
+ body: _response.error.body,
68
+ rawResponse: _response.rawResponse,
69
+ });
70
+ }
71
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/register/status");
72
+ });
73
+ }
22
74
  /**
23
75
  * Submit an A2P 10DLC registration to enable outbound SMS on your account.
24
76
  *
@@ -27,15 +79,18 @@ export class RegistrationClient {
27
79
  * ### How it works
28
80
  *
29
81
  * 1. Submit your registration details via this endpoint
30
- * 2. We validate your submission and flag any issues (RED = blocked, YELLOW = warning)
31
- * 3. On success, you receive a Stripe payment URL to pay the one-time registration fee
32
- * 4. After payment, we submit your registration to the carriers on your behalf
33
- * 5. Carrier approval typically takes 7-10 business days
82
+ * 2. A one-time $25 registration fee is deducted from your account balance
83
+ * 3. We submit your registration to the carriers on your behalf
84
+ * 4. Carrier approval typically takes 7-10 business days
34
85
  *
35
86
  * ### Registration types
36
87
  *
37
- * - **`sole_proprietor`** For individuals or small businesses. Simpler requirements, fewer fields.
38
- * - **`standard_brand`** For established businesses. Requires `business_name`, `privacy_policy_url`, `terms_of_service_url`, `sample_message_1`, and `sample_message_2`.
88
+ * - **`sole_proprietor`** -- For individuals or small businesses. Simpler requirements, fewer fields.
89
+ * - **`standard_brand`** -- For established businesses. Requires `business_name`, `organization_type`, `ein`, `privacy_policy_url`, `terms_of_service_url`.
90
+ *
91
+ * ### Sub-accounts
92
+ *
93
+ * 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.
39
94
  *
40
95
  * ### Opt-in image
41
96
  *
@@ -43,7 +98,7 @@ export class RegistrationClient {
43
98
  *
44
99
  * ### Re-submitting
45
100
  *
46
- * If you've already submitted but haven't completed payment, calling this endpoint again returns the payment URL without re-sending the registration email.
101
+ * If your previous registration was rejected, you can call this endpoint again to re-register.
47
102
  *
48
103
  * @param {AgentPhone.RegistrationRequest} request
49
104
  * @param {RegistrationClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -52,7 +107,7 @@ export class RegistrationClient {
52
107
  *
53
108
  * @example
54
109
  * await client.registration.registerA2P({
55
- * registration_type: "registration_type",
110
+ * registration_type: "sole_proprietor",
56
111
  * first_name: "first_name",
57
112
  * last_name: "last_name",
58
113
  * email: "email",
@@ -61,7 +116,10 @@ export class RegistrationClient {
61
116
  * city: "city",
62
117
  * state: "state",
63
118
  * zip_code: "zip_code",
64
- * use_case_description: "use_case_description",
119
+ * description: "description",
120
+ * use_cases: ["account_notification"],
121
+ * message_samples: ["message_samples"],
122
+ * consent_flow: "consent_flow",
65
123
  * opt_in_image_url: "opt_in_image_url"
66
124
  * })
67
125
  */
@@ -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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,7 +1,8 @@
1
+ import type * as AgentPhone from "../../../../index.mjs";
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,2 +1,9 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var RegistrationRequest;
3
+ (function (RegistrationRequest) {
4
+ /** 'sole_proprietor' or 'standard_brand' */
5
+ RegistrationRequest.RegistrationType = {
6
+ SoleProprietor: "sole_proprietor",
7
+ StandardBrand: "standard_brand",
8
+ };
9
+ })(RegistrationRequest || (RegistrationRequest = {}));
@@ -1 +1,2 @@
1
- export type { RegistrationRequest } from "./RegistrationRequest.mjs";
1
+ export type { GetRegistrationStatusV1RegisterStatusGetRequest } from "./GetRegistrationStatusV1RegisterStatusGetRequest.mjs";
2
+ export { RegistrationRequest } from "./RegistrationRequest.mjs";
@@ -1 +1 @@
1
- export {};
1
+ export { RegistrationRequest } from "./RegistrationRequest.mjs";
@@ -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
@@ -31,24 +31,32 @@ export class SubAccountsClient {
31
31
  this._options = normalizeClientOptionsWithAuth(options);
32
32
  }
33
33
  /**
34
+ * @param {AgentPhone.ListSubAccountsV1SubAccountsGetRequest} request
34
35
  * @param {SubAccountsClient.RequestOptions} requestOptions - Request-specific configuration.
35
36
  *
37
+ * @throws {@link AgentPhone.UnprocessableEntityError}
38
+ *
36
39
  * @example
37
40
  * await client.subAccounts.listSubAccounts()
38
41
  */
39
- listSubAccounts(requestOptions) {
40
- return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(requestOptions));
42
+ listSubAccounts(request = {}, requestOptions) {
43
+ return core.HttpResponsePromise.fromPromise(this.__listSubAccounts(request, requestOptions));
41
44
  }
42
- __listSubAccounts(requestOptions) {
43
- return __awaiter(this, void 0, void 0, function* () {
45
+ __listSubAccounts() {
46
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
44
47
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
48
+ const { limit, offset } = request;
49
+ const _queryParams = {
50
+ limit,
51
+ offset,
52
+ };
45
53
  const _authRequest = yield this._options.authProvider.getAuthRequest();
46
54
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
47
55
  const _response = yield core.fetcher({
48
56
  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"),
49
57
  method: "GET",
50
58
  headers: _headers,
51
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
59
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
52
60
  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,
53
61
  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,
54
62
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -59,11 +67,16 @@ export class SubAccountsClient {
59
67
  return { data: _response.body, rawResponse: _response.rawResponse };
60
68
  }
61
69
  if (_response.error.reason === "status-code") {
62
- throw new errors.AgentPhoneError({
63
- statusCode: _response.error.statusCode,
64
- body: _response.error.body,
65
- rawResponse: _response.rawResponse,
66
- });
70
+ switch (_response.error.statusCode) {
71
+ case 422:
72
+ throw new AgentPhone.UnprocessableEntityError(_response.error.body, _response.rawResponse);
73
+ default:
74
+ throw new errors.AgentPhoneError({
75
+ statusCode: _response.error.statusCode,
76
+ body: _response.error.body,
77
+ rawResponse: _response.rawResponse,
78
+ });
79
+ }
67
80
  }
68
81
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/sub-accounts");
69
82
  });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListSubAccountsV1SubAccountsGetRequest {
6
+ limit?: number | null;
7
+ offset?: number;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,4 @@
1
1
  export type { CreateSubAccountRequest } from "./CreateSubAccountRequest.mjs";
2
2
  export type { DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest } from "./DeleteSubAccountV1SubAccountsSubAccountIdDeleteRequest.mjs";
3
+ export type { ListSubAccountsV1SubAccountsGetRequest } from "./ListSubAccountsV1SubAccountsGetRequest.mjs";
3
4
  export type { UpdateSubAccountRequest } from "./UpdateSubAccountRequest.mjs";
@@ -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. */
@@ -0,0 +1,7 @@
1
+ export declare const CampaignInclude: {
2
+ readonly Links: "links";
3
+ readonly PhoneNumbers: "phone_numbers";
4
+ readonly AgeGated: "age_gated";
5
+ readonly DirectLending: "direct_lending";
6
+ };
7
+ export type CampaignInclude = (typeof CampaignInclude)[keyof typeof CampaignInclude];
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CampaignInclude = {
3
+ Links: "links",
4
+ PhoneNumbers: "phone_numbers",
5
+ AgeGated: "age_gated",
6
+ DirectLending: "direct_lending",
7
+ };
@@ -0,0 +1,4 @@
1
+ export interface CampaignStatusResponse {
2
+ campaign_status: string;
3
+ message: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as AgentPhone from "../index.mjs";
2
+ export interface ContactCapabilitiesResponse {
3
+ phoneNumber: string;
4
+ capabilities: AgentPhone.ContactCapabilityFlags;
5
+ checkedAt: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface ContactCapabilityFlags {
2
+ imessage: boolean;
3
+ sms: boolean;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare const ContactTitle: {
2
+ readonly Ceo: "ceo";
3
+ readonly Cfo: "cfo";
4
+ readonly Cto: "cto";
5
+ readonly Coo: "coo";
6
+ readonly Vp: "vp";
7
+ readonly Gm: "gm";
8
+ readonly Director: "director";
9
+ readonly Other: "other";
10
+ };
11
+ export type ContactTitle = (typeof ContactTitle)[keyof typeof ContactTitle];
@@ -0,0 +1,11 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const ContactTitle = {
3
+ Ceo: "ceo",
4
+ Cfo: "cfo",
5
+ Cto: "cto",
6
+ Coo: "coo",
7
+ Vp: "vp",
8
+ Gm: "gm",
9
+ Director: "director",
10
+ Other: "other",
11
+ };