@surgeapi/node 0.39.0 → 0.41.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.
- package/CHANGELOG.md +35 -0
- package/README.md +8 -8
- package/client.d.mts +5 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -2
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/accounts.d.mts +21 -21
- package/resources/accounts.d.mts.map +1 -1
- package/resources/accounts.d.ts +21 -21
- package/resources/accounts.d.ts.map +1 -1
- package/resources/audiences.d.mts +80 -0
- package/resources/audiences.d.mts.map +1 -0
- package/resources/audiences.d.ts +80 -0
- package/resources/audiences.d.ts.map +1 -0
- package/resources/audiences.js +59 -0
- package/resources/audiences.js.map +1 -0
- package/resources/audiences.mjs +55 -0
- package/resources/audiences.mjs.map +1 -0
- package/resources/campaigns.d.mts +146 -2
- package/resources/campaigns.d.mts.map +1 -1
- package/resources/campaigns.d.ts +146 -2
- package/resources/campaigns.d.ts.map +1 -1
- package/resources/campaigns.js +38 -0
- package/resources/campaigns.js.map +1 -1
- package/resources/campaigns.mjs +38 -0
- package/resources/campaigns.mjs.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +19 -0
- package/src/resources/accounts.ts +21 -21
- package/src/resources/audiences.ts +117 -0
- package/src/resources/campaigns.ts +173 -1
- package/src/resources/index.ts +8 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as ContactsAPI from './contacts';
|
|
5
|
+
import { ContactsCursor } from './contacts';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class Audiences extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new audience.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const audience = await client.audiences.create(
|
|
18
|
+
* 'acct_01j9a43avnfqzbjfch6pygv1td',
|
|
19
|
+
* { name: 'The Family' },
|
|
20
|
+
* );
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
create(
|
|
24
|
+
accountID: string,
|
|
25
|
+
body: AudienceCreateParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<AudienceCreateResponse> {
|
|
28
|
+
return this._client.post(path`/accounts/${accountID}/audiences`, { body, ...options });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Adds an existing contact to a manual audience.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const contact = await client.audiences.addContact(
|
|
37
|
+
* 'aud_01j9a43avnfqzbjfch6pygv1td',
|
|
38
|
+
* { id: 'ctc_01j9dy8mdzfn3r0e8x1tbdrdrf' },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
addContact(
|
|
43
|
+
audienceID: string,
|
|
44
|
+
body: AudienceAddContactParams,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<ContactsAPI.Contact> {
|
|
47
|
+
return this._client.post(path`/audiences/${audienceID}/contacts`, { body, ...options });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* List all contacts in an audience with cursor-based pagination. The account is
|
|
52
|
+
* inferred from the audience.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* // Automatically fetches more pages as needed.
|
|
57
|
+
* for await (const contact of client.audiences.listContacts(
|
|
58
|
+
* 'aud_01j9a43avnfqzbjfch6pygv1td',
|
|
59
|
+
* )) {
|
|
60
|
+
* // ...
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
listContacts(
|
|
65
|
+
audienceID: string,
|
|
66
|
+
query: AudienceListContactsParams | null | undefined = {},
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): PagePromise<ContactsCursor, ContactsAPI.Contact> {
|
|
69
|
+
return this._client.getAPIList(path`/audiences/${audienceID}/contacts`, Cursor<ContactsAPI.Contact>, {
|
|
70
|
+
query,
|
|
71
|
+
...options,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A group of contacts used for targeting messages.
|
|
78
|
+
*/
|
|
79
|
+
export interface AudienceCreateResponse {
|
|
80
|
+
/**
|
|
81
|
+
* Unique identifier for the object.
|
|
82
|
+
*/
|
|
83
|
+
id: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A name to identify this Audience. This name will only be visible within Surge.
|
|
87
|
+
*/
|
|
88
|
+
name: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface AudienceCreateParams {
|
|
92
|
+
/**
|
|
93
|
+
* The audience name.
|
|
94
|
+
*/
|
|
95
|
+
name: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface AudienceAddContactParams {
|
|
99
|
+
/**
|
|
100
|
+
* The ID of the contact to add. The contact must belong to the same account as the
|
|
101
|
+
* audience.
|
|
102
|
+
*/
|
|
103
|
+
id: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface AudienceListContactsParams extends CursorParams {}
|
|
107
|
+
|
|
108
|
+
export declare namespace Audiences {
|
|
109
|
+
export {
|
|
110
|
+
type AudienceCreateResponse as AudienceCreateResponse,
|
|
111
|
+
type AudienceCreateParams as AudienceCreateParams,
|
|
112
|
+
type AudienceAddContactParams as AudienceAddContactParams,
|
|
113
|
+
type AudienceListContactsParams as AudienceListContactsParams,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { type ContactsCursor };
|
|
@@ -25,6 +25,8 @@ export class Campaigns extends APIResource {
|
|
|
25
25
|
* 'Your car is ready to go. See your invoice here: https://l.fastauto.shop/s034ij',
|
|
26
26
|
* ],
|
|
27
27
|
* privacy_policy_url: 'https://fastauto.shop/sms-privacy',
|
|
28
|
+
* terms_and_conditions_url:
|
|
29
|
+
* 'https://fastauto.shop/terms-and-conditions',
|
|
28
30
|
* use_cases: [
|
|
29
31
|
* 'account_notification',
|
|
30
32
|
* 'customer_care',
|
|
@@ -53,6 +55,43 @@ export class Campaigns extends APIResource {
|
|
|
53
55
|
return this._client.get(path`/campaigns/${id}`, options);
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Updates a campaign that has not yet been approved. This can be used to fix
|
|
60
|
+
* issues flagged during review and resubmit the campaign. Returns an error if the
|
|
61
|
+
* campaign is currently in review, has already been approved, or has been
|
|
62
|
+
* deactivated.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const campaign = await client.campaigns.update(
|
|
67
|
+
* 'cpn_01k0qczvhbet4azgn5xm2ccfst',
|
|
68
|
+
* {
|
|
69
|
+
* consent_flow:
|
|
70
|
+
* 'When customers bring in their car for service, they will fill out this web form for intake: https://fastauto.shop/bp108c In it they can choose to opt in to text message notifications. If they choose to opt in, we will send them notifications to let them know if our mechanics find issues and once the car is ready to go, as well as links to invoices and to leave us feedback.',
|
|
71
|
+
* description:
|
|
72
|
+
* 'This phone number will send auto maintenance notifications to end users that have opted in. It will also be used for responding to customer inquiries and sending some marketing offers.',
|
|
73
|
+
* message_samples: [
|
|
74
|
+
* 'You are now opted in to receive repair notifications from DT Precision Auto. Frequency varies. Msg&data rates apply. Reply STOP to opt out.',
|
|
75
|
+
* "You're lucky that hundred shot of NOS didn't blow the welds on the intake!",
|
|
76
|
+
* 'Your car is ready to go. See your invoice here: https://l.fastauto.shop/s034ij',
|
|
77
|
+
* ],
|
|
78
|
+
* privacy_policy_url: 'https://fastauto.shop/sms-privacy',
|
|
79
|
+
* terms_and_conditions_url:
|
|
80
|
+
* 'https://fastauto.shop/terms-and-conditions',
|
|
81
|
+
* use_cases: [
|
|
82
|
+
* 'account_notification',
|
|
83
|
+
* 'customer_care',
|
|
84
|
+
* 'marketing',
|
|
85
|
+
* ],
|
|
86
|
+
* volume: 'high',
|
|
87
|
+
* },
|
|
88
|
+
* );
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
update(id: string, body: CampaignUpdateParams, options?: RequestOptions): APIPromise<Campaign> {
|
|
92
|
+
return this._client.patch(path`/campaigns/${id}`, { body, ...options });
|
|
93
|
+
}
|
|
94
|
+
|
|
56
95
|
/**
|
|
57
96
|
* List all campaigns for an account with cursor-based pagination.
|
|
58
97
|
*
|
|
@@ -251,6 +290,14 @@ export declare namespace CampaignCreateParams {
|
|
|
251
290
|
*/
|
|
252
291
|
privacy_policy_url: string;
|
|
253
292
|
|
|
293
|
+
/**
|
|
294
|
+
* The URL of the terms and conditions presented to end users when they opt in to
|
|
295
|
+
* messaging. These terms and conditions may be shared among all of a platform's
|
|
296
|
+
* customers if they're the terms that are presented to end users when they opt in
|
|
297
|
+
* to messaging.
|
|
298
|
+
*/
|
|
299
|
+
terms_and_conditions_url: string;
|
|
300
|
+
|
|
254
301
|
/**
|
|
255
302
|
* A list containing 1-5 types of messages that will be sent with this campaign.
|
|
256
303
|
*
|
|
@@ -327,6 +374,53 @@ export declare namespace CampaignCreateParams {
|
|
|
327
374
|
* to disable automatic link shortening.
|
|
328
375
|
*/
|
|
329
376
|
link_sample?: string;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface ExternalCampaignParams {
|
|
380
|
+
/**
|
|
381
|
+
* The Campaign Registry (TCR) ID for the externally registered campaign
|
|
382
|
+
*/
|
|
383
|
+
tcr_id: string;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export type CampaignUpdateParams =
|
|
388
|
+
| CampaignUpdateParams.StandardCampaignParams
|
|
389
|
+
| CampaignUpdateParams.ExternalCampaignParams;
|
|
390
|
+
|
|
391
|
+
export declare namespace CampaignUpdateParams {
|
|
392
|
+
export interface StandardCampaignParams {
|
|
393
|
+
/**
|
|
394
|
+
* A string explaining the method through which end users will opt in to receive
|
|
395
|
+
* messages from the brand. Typically this should include URLs for opt-in forms or
|
|
396
|
+
* screenshots that might be helpful in explaining the flow to someone unfamiliar
|
|
397
|
+
* with the organization's purpose.
|
|
398
|
+
*/
|
|
399
|
+
consent_flow: string;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* An explanation of the organization's purpose and how it will be using text
|
|
403
|
+
* messaging to accomplish that purpose.
|
|
404
|
+
*/
|
|
405
|
+
description: string;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* An array of 2-5 strings with examples of the messages that will be sent from
|
|
409
|
+
* this campaign. Typically the first sample should be a compliance message like
|
|
410
|
+
* `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
|
|
411
|
+
* These samples don't necessarily need to be the only templates that will be used
|
|
412
|
+
* for the campaign, but they should reflect the purpose of the messages that will
|
|
413
|
+
* be sent. Any variable content can be reflected by wrapping it in square brackets
|
|
414
|
+
* like `[customer name]`.
|
|
415
|
+
*/
|
|
416
|
+
message_samples: Array<string>;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* The URL of the privacy policy for the brand in question. This may be a shared
|
|
420
|
+
* privacy policy if it's the policy that is displayed to end users when they opt
|
|
421
|
+
* in to messaging.
|
|
422
|
+
*/
|
|
423
|
+
privacy_policy_url: string;
|
|
330
424
|
|
|
331
425
|
/**
|
|
332
426
|
* The URL of the terms and conditions presented to end users when they opt in to
|
|
@@ -334,7 +428,84 @@ export declare namespace CampaignCreateParams {
|
|
|
334
428
|
* customers if they're the terms that are presented to end users when they opt in
|
|
335
429
|
* to messaging.
|
|
336
430
|
*/
|
|
337
|
-
terms_and_conditions_url
|
|
431
|
+
terms_and_conditions_url: string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* A list containing 1-5 types of messages that will be sent with this campaign.
|
|
435
|
+
*
|
|
436
|
+
* The following use cases are typically available to all brands:
|
|
437
|
+
*
|
|
438
|
+
* - `account_notification` - For sending reminders, alerts, and general
|
|
439
|
+
* account-related notifications like booking confirmations or appointment
|
|
440
|
+
* reminders.
|
|
441
|
+
* - `customer_care` - For account support, troubleshooting, and general customer
|
|
442
|
+
* service communication.
|
|
443
|
+
* - `delivery_notification` - For notifying customers about the status of product
|
|
444
|
+
* or service deliveries.
|
|
445
|
+
* - `fraud_alert` - For warning customers about suspicious or potentially
|
|
446
|
+
* fraudulent activity.
|
|
447
|
+
* - `higher_education` - For messaging related to colleges, universities, and
|
|
448
|
+
* school districts outside of K–12.
|
|
449
|
+
* - `marketing` - For promotional or advertising messages intended to market
|
|
450
|
+
* products or services.
|
|
451
|
+
* - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
|
|
452
|
+
* - `public_service_announcement` - For raising awareness about social issues or
|
|
453
|
+
* important public information.
|
|
454
|
+
* - `security_alert` - For alerts related to potential security breaches or
|
|
455
|
+
* compromised systems requiring user action.
|
|
456
|
+
* - `two_factor_authentication` - For sending one-time passwords or verification
|
|
457
|
+
* codes for login or password reset.
|
|
458
|
+
*
|
|
459
|
+
* For access to special use cases not shown here, reach out to support@surge.app.
|
|
460
|
+
*/
|
|
461
|
+
use_cases: Array<
|
|
462
|
+
| 'account_notification'
|
|
463
|
+
| 'customer_care'
|
|
464
|
+
| 'delivery_notification'
|
|
465
|
+
| 'fraud_alert'
|
|
466
|
+
| 'higher_education'
|
|
467
|
+
| 'marketing'
|
|
468
|
+
| 'polling_voting'
|
|
469
|
+
| 'public_service_announcement'
|
|
470
|
+
| 'security_alert'
|
|
471
|
+
| 'two_factor_authentication'
|
|
472
|
+
>;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* This will be one of the following:
|
|
476
|
+
*
|
|
477
|
+
* - `low` - The campaign will be allowed to send up to 2000 SMS segments to
|
|
478
|
+
* T-Mobile customers each day. In this case your platform will be charged for
|
|
479
|
+
* the setup fee for a low volume number upon receipt of the API request.
|
|
480
|
+
* - `high` - The campaign will be allowed to send up to 200k SMS segments to
|
|
481
|
+
* T-Mobile customers each day, depending on the trust score assigned by The
|
|
482
|
+
* Campaign Registry. Your platform will be charged for the setup fee for a high
|
|
483
|
+
* volume number upon receipt of the API request, and phone numbers will be
|
|
484
|
+
* charged as high volume numbers going forward.
|
|
485
|
+
*/
|
|
486
|
+
volume: 'high' | 'low';
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* A list of properties that this campaign should include. These properties can be
|
|
490
|
+
* any of the following values:
|
|
491
|
+
*
|
|
492
|
+
* - `links` - whether the campaign might send links in messages
|
|
493
|
+
* - `phone_numbers` - whether the campaign might send phone numbers in messages
|
|
494
|
+
* - `age_gated` - whether the campaign contains age gated content (controlled
|
|
495
|
+
* substances or adult content)
|
|
496
|
+
* - `direct_lending` - whether the campaign contains content related to direct
|
|
497
|
+
* lending or other loan arrangements
|
|
498
|
+
*/
|
|
499
|
+
includes?: Array<'links' | 'phone_numbers' | 'age_gated' | 'direct_lending'>;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* A sample link that might be sent by this campaign. If links from other domains
|
|
503
|
+
* are sent through this campaign, they are much more likely to be filtered by the
|
|
504
|
+
* carriers. If link shortening is enabled for the account, the link shortener URL
|
|
505
|
+
* will be used instead of what is provided. Reach out to support if you would like
|
|
506
|
+
* to disable automatic link shortening.
|
|
507
|
+
*/
|
|
508
|
+
link_sample?: string;
|
|
338
509
|
}
|
|
339
510
|
|
|
340
511
|
export interface ExternalCampaignParams {
|
|
@@ -352,6 +523,7 @@ export declare namespace Campaigns {
|
|
|
352
523
|
type Campaign as Campaign,
|
|
353
524
|
type CampaignsCursor as CampaignsCursor,
|
|
354
525
|
type CampaignCreateParams as CampaignCreateParams,
|
|
526
|
+
type CampaignUpdateParams as CampaignUpdateParams,
|
|
355
527
|
type CampaignListParams as CampaignListParams,
|
|
356
528
|
};
|
|
357
529
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -10,11 +10,19 @@ export {
|
|
|
10
10
|
type AccountUpdateParams,
|
|
11
11
|
type AccountRetrieveStatusParams,
|
|
12
12
|
} from './accounts';
|
|
13
|
+
export {
|
|
14
|
+
Audiences,
|
|
15
|
+
type AudienceCreateResponse,
|
|
16
|
+
type AudienceCreateParams,
|
|
17
|
+
type AudienceAddContactParams,
|
|
18
|
+
type AudienceListContactsParams,
|
|
19
|
+
} from './audiences';
|
|
13
20
|
export { Blasts, type Blast, type BlastCreateParams } from './blasts';
|
|
14
21
|
export {
|
|
15
22
|
Campaigns,
|
|
16
23
|
type Campaign,
|
|
17
24
|
type CampaignCreateParams,
|
|
25
|
+
type CampaignUpdateParams,
|
|
18
26
|
type CampaignListParams,
|
|
19
27
|
type CampaignsCursor,
|
|
20
28
|
} from './campaigns';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.41.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.41.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.41.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.41.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|