@sentdm/sentdm 0.32.0 → 0.33.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 +13 -0
- package/client.d.mts +9 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -6
- 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/contacts.d.mts +66 -1
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +66 -1
- package/resources/contacts.d.ts.map +1 -1
- package/resources/contacts.js +24 -0
- package/resources/contacts.js.map +1 -1
- package/resources/contacts.mjs +24 -0
- package/resources/contacts.mjs.map +1 -1
- package/resources/conversations.d.mts +160 -0
- package/resources/conversations.d.mts.map +1 -0
- package/resources/conversations.d.ts +160 -0
- package/resources/conversations.d.ts.map +1 -0
- package/resources/conversations.js +59 -0
- package/resources/conversations.js.map +1 -0
- package/resources/conversations.mjs +55 -0
- package/resources/conversations.mjs.map +1 -0
- package/resources/index.d.mts +4 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- 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/resources/messages.d.mts +5 -3
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +5 -3
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +4 -1
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +4 -1
- package/resources/messages.mjs.map +1 -1
- package/resources/profiles/campaigns.d.mts +112 -83
- package/resources/profiles/campaigns.d.mts.map +1 -1
- package/resources/profiles/campaigns.d.ts +112 -83
- package/resources/profiles/campaigns.d.ts.map +1 -1
- package/resources/profiles/campaigns.js +6 -5
- package/resources/profiles/campaigns.js.map +1 -1
- package/resources/profiles/campaigns.mjs +6 -5
- package/resources/profiles/campaigns.mjs.map +1 -1
- package/resources/profiles/index.d.mts +2 -2
- package/resources/profiles/index.d.mts.map +1 -1
- package/resources/profiles/index.d.ts +2 -2
- package/resources/profiles/index.d.ts.map +1 -1
- package/resources/profiles/profiles.d.mts +138 -135
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts +138 -135
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.js +30 -18
- package/resources/profiles/profiles.js.map +1 -1
- package/resources/profiles/profiles.mjs +30 -18
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/templates.d.mts +87 -87
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +87 -87
- package/resources/templates.d.ts.map +1 -1
- package/src/client.ts +41 -18
- package/src/resources/contacts.ts +96 -0
- package/src/resources/conversations.ts +238 -0
- package/src/resources/index.ts +19 -9
- package/src/resources/messages.ts +5 -3
- package/src/resources/profiles/campaigns.ts +160 -132
- package/src/resources/profiles/index.ts +8 -8
- package/src/resources/profiles/profiles.ts +172 -171
- package/src/resources/templates.ts +105 -105
- 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
package/src/client.ts
CHANGED
|
@@ -19,15 +19,25 @@ import * as API from './resources/index';
|
|
|
19
19
|
import { APIPromise } from './core/api-promise';
|
|
20
20
|
import {
|
|
21
21
|
APIResponseOfContact,
|
|
22
|
+
APIResponseOfContactMessageSummary,
|
|
22
23
|
ContactCreateParams,
|
|
23
24
|
ContactDeleteParams,
|
|
24
25
|
ContactListParams,
|
|
25
26
|
ContactListResponse,
|
|
27
|
+
ContactMessageSummary,
|
|
26
28
|
ContactResponse,
|
|
29
|
+
ContactRetrieveMessageSummaryParams,
|
|
27
30
|
ContactRetrieveParams,
|
|
28
31
|
ContactUpdateParams,
|
|
29
32
|
Contacts,
|
|
30
33
|
} from './resources/contacts';
|
|
34
|
+
import {
|
|
35
|
+
APIResponseOfConversationMessagesList,
|
|
36
|
+
ConversationListMessagesParams,
|
|
37
|
+
ConversationListParams,
|
|
38
|
+
ConversationMessagesList,
|
|
39
|
+
Conversations,
|
|
40
|
+
} from './resources/conversations';
|
|
31
41
|
import { Me, MeRetrieveParams, MeRetrieveResponse, ProfileSettings } from './resources/me';
|
|
32
42
|
import {
|
|
33
43
|
MessageRetrieveActivitiesParams,
|
|
@@ -41,17 +51,17 @@ import {
|
|
|
41
51
|
import { NumberLookupParams, NumberLookupResponse, Numbers } from './resources/numbers';
|
|
42
52
|
import {
|
|
43
53
|
APIResponseTemplate,
|
|
44
|
-
|
|
45
|
-
SentDmServicesCommonContractsPocOsTemplateBody,
|
|
46
|
-
SentDmServicesCommonContractsPocOsTemplateButton,
|
|
47
|
-
SentDmServicesCommonContractsPocOsTemplateButtonProps,
|
|
48
|
-
SentDmServicesCommonContractsPocOsTemplateFooter,
|
|
49
|
-
SentDmServicesCommonContractsPocOsTemplateHeader,
|
|
54
|
+
AuthenticationConfig,
|
|
50
55
|
Template,
|
|
56
|
+
TemplateBody,
|
|
51
57
|
TemplateBodyContent,
|
|
58
|
+
TemplateButton,
|
|
59
|
+
TemplateButtonProps,
|
|
52
60
|
TemplateCreateParams,
|
|
53
61
|
TemplateDefinition,
|
|
54
62
|
TemplateDeleteParams,
|
|
63
|
+
TemplateFooter,
|
|
64
|
+
TemplateHeader,
|
|
55
65
|
TemplateListParams,
|
|
56
66
|
TemplateListResponse,
|
|
57
67
|
TemplateRetrieveParams,
|
|
@@ -98,6 +108,9 @@ import {
|
|
|
98
108
|
import {
|
|
99
109
|
APIResponseOfProfileDetail,
|
|
100
110
|
BillingContactInfo,
|
|
111
|
+
BrandBusinessInfo,
|
|
112
|
+
BrandComplianceInfo,
|
|
113
|
+
BrandContactInfo,
|
|
101
114
|
BrandsBrandData,
|
|
102
115
|
DestinationCountry,
|
|
103
116
|
PaymentDetails,
|
|
@@ -111,9 +124,6 @@ import {
|
|
|
111
124
|
ProfileRetrieveParams,
|
|
112
125
|
ProfileUpdateParams,
|
|
113
126
|
Profiles,
|
|
114
|
-
SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
|
|
115
|
-
SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
|
|
116
|
-
SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
|
|
117
127
|
TcrBrandRelationship,
|
|
118
128
|
TcrVertical,
|
|
119
129
|
} from './resources/profiles/profiles';
|
|
@@ -865,6 +875,7 @@ export class Sent {
|
|
|
865
875
|
* Create, update, and manage customer contact lists
|
|
866
876
|
*/
|
|
867
877
|
contacts: API.Contacts = new API.Contacts(this);
|
|
878
|
+
conversations: API.Conversations = new API.Conversations(this);
|
|
868
879
|
/**
|
|
869
880
|
* Retrieve account details
|
|
870
881
|
*/
|
|
@@ -878,6 +889,7 @@ Sent.Profiles = Profiles;
|
|
|
878
889
|
Sent.Numbers = Numbers;
|
|
879
890
|
Sent.Messages = Messages;
|
|
880
891
|
Sent.Contacts = Contacts;
|
|
892
|
+
Sent.Conversations = Conversations;
|
|
881
893
|
Sent.Me = Me;
|
|
882
894
|
|
|
883
895
|
export declare namespace Sent {
|
|
@@ -924,15 +936,15 @@ export declare namespace Sent {
|
|
|
924
936
|
export {
|
|
925
937
|
Templates as Templates,
|
|
926
938
|
type APIResponseTemplate as APIResponseTemplate,
|
|
927
|
-
type
|
|
928
|
-
type SentDmServicesCommonContractsPocOsTemplateBody as SentDmServicesCommonContractsPocOsTemplateBody,
|
|
929
|
-
type SentDmServicesCommonContractsPocOsTemplateButton as SentDmServicesCommonContractsPocOsTemplateButton,
|
|
930
|
-
type SentDmServicesCommonContractsPocOsTemplateButtonProps as SentDmServicesCommonContractsPocOsTemplateButtonProps,
|
|
931
|
-
type SentDmServicesCommonContractsPocOsTemplateFooter as SentDmServicesCommonContractsPocOsTemplateFooter,
|
|
932
|
-
type SentDmServicesCommonContractsPocOsTemplateHeader as SentDmServicesCommonContractsPocOsTemplateHeader,
|
|
939
|
+
type AuthenticationConfig as AuthenticationConfig,
|
|
933
940
|
type Template as Template,
|
|
941
|
+
type TemplateBody as TemplateBody,
|
|
934
942
|
type TemplateBodyContent as TemplateBodyContent,
|
|
943
|
+
type TemplateButton as TemplateButton,
|
|
944
|
+
type TemplateButtonProps as TemplateButtonProps,
|
|
935
945
|
type TemplateDefinition as TemplateDefinition,
|
|
946
|
+
type TemplateFooter as TemplateFooter,
|
|
947
|
+
type TemplateHeader as TemplateHeader,
|
|
936
948
|
type TemplateVariable as TemplateVariable,
|
|
937
949
|
type TemplateListResponse as TemplateListResponse,
|
|
938
950
|
type TemplateCreateParams as TemplateCreateParams,
|
|
@@ -946,13 +958,13 @@ export declare namespace Sent {
|
|
|
946
958
|
Profiles as Profiles,
|
|
947
959
|
type APIResponseOfProfileDetail as APIResponseOfProfileDetail,
|
|
948
960
|
type BillingContactInfo as BillingContactInfo,
|
|
961
|
+
type BrandBusinessInfo as BrandBusinessInfo,
|
|
962
|
+
type BrandComplianceInfo as BrandComplianceInfo,
|
|
963
|
+
type BrandContactInfo as BrandContactInfo,
|
|
949
964
|
type BrandsBrandData as BrandsBrandData,
|
|
950
965
|
type DestinationCountry as DestinationCountry,
|
|
951
966
|
type PaymentDetails as PaymentDetails,
|
|
952
967
|
type ProfileDetail as ProfileDetail,
|
|
953
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
|
|
954
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
|
|
955
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
|
|
956
968
|
type TcrBrandRelationship as TcrBrandRelationship,
|
|
957
969
|
type TcrVertical as TcrVertical,
|
|
958
970
|
type ProfileListResponse as ProfileListResponse,
|
|
@@ -984,6 +996,8 @@ export declare namespace Sent {
|
|
|
984
996
|
export {
|
|
985
997
|
Contacts as Contacts,
|
|
986
998
|
type APIResponseOfContact as APIResponseOfContact,
|
|
999
|
+
type APIResponseOfContactMessageSummary as APIResponseOfContactMessageSummary,
|
|
1000
|
+
type ContactMessageSummary as ContactMessageSummary,
|
|
987
1001
|
type ContactResponse as ContactResponse,
|
|
988
1002
|
type ContactListResponse as ContactListResponse,
|
|
989
1003
|
type ContactCreateParams as ContactCreateParams,
|
|
@@ -991,6 +1005,15 @@ export declare namespace Sent {
|
|
|
991
1005
|
type ContactUpdateParams as ContactUpdateParams,
|
|
992
1006
|
type ContactListParams as ContactListParams,
|
|
993
1007
|
type ContactDeleteParams as ContactDeleteParams,
|
|
1008
|
+
type ContactRetrieveMessageSummaryParams as ContactRetrieveMessageSummaryParams,
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
export {
|
|
1012
|
+
Conversations as Conversations,
|
|
1013
|
+
type APIResponseOfConversationMessagesList as APIResponseOfConversationMessagesList,
|
|
1014
|
+
type ConversationMessagesList as ConversationMessagesList,
|
|
1015
|
+
type ConversationListParams as ConversationListParams,
|
|
1016
|
+
type ConversationListMessagesParams as ConversationListMessagesParams,
|
|
994
1017
|
};
|
|
995
1018
|
|
|
996
1019
|
export {
|
|
@@ -141,6 +141,35 @@ export class Contacts extends APIResource {
|
|
|
141
141
|
]),
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns aggregate message counts, time bounds, channels used, and per-channel
|
|
147
|
+
* success/fail scores (each as a percentage 0-100 of messages on that channel) for
|
|
148
|
+
* one of your contacts. Successful terminal states: SENT/DELIVERED/READ for
|
|
149
|
+
* outbound, RECEIVED for inbound. Fail: FAILED.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const apiResponseOfContactMessageSummary =
|
|
154
|
+
* await client.contacts.retrieveMessageSummary(
|
|
155
|
+
* '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
|
|
156
|
+
* );
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
retrieveMessageSummary(
|
|
160
|
+
contactID: string,
|
|
161
|
+
params: ContactRetrieveMessageSummaryParams | null | undefined = {},
|
|
162
|
+
options?: RequestOptions,
|
|
163
|
+
): APIPromise<APIResponseOfContactMessageSummary> {
|
|
164
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
165
|
+
return this._client.get(path`/v3/contacts/${contactID}/message-summary`, {
|
|
166
|
+
...options,
|
|
167
|
+
headers: buildHeaders([
|
|
168
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
169
|
+
options?.headers,
|
|
170
|
+
]),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
144
173
|
}
|
|
145
174
|
|
|
146
175
|
/**
|
|
@@ -168,6 +197,62 @@ export interface APIResponseOfContact {
|
|
|
168
197
|
success?: boolean;
|
|
169
198
|
}
|
|
170
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Standard API response envelope for all v3 endpoints
|
|
202
|
+
*/
|
|
203
|
+
export interface APIResponseOfContactMessageSummary {
|
|
204
|
+
/**
|
|
205
|
+
* The response data (null if error)
|
|
206
|
+
*/
|
|
207
|
+
data?: ContactMessageSummary | null;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Error information
|
|
211
|
+
*/
|
|
212
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Request and response metadata
|
|
216
|
+
*/
|
|
217
|
+
meta?: WebhooksAPI.APIMeta;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Indicates whether the request was successful
|
|
221
|
+
*/
|
|
222
|
+
success?: boolean;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ContactMessageSummary {
|
|
226
|
+
channel_scores?: Array<ContactMessageSummary.ChannelScore>;
|
|
227
|
+
|
|
228
|
+
channels_used?: Array<string>;
|
|
229
|
+
|
|
230
|
+
contact_id?: string;
|
|
231
|
+
|
|
232
|
+
first_message_at?: string | null;
|
|
233
|
+
|
|
234
|
+
last_message_at?: string | null;
|
|
235
|
+
|
|
236
|
+
message_count?: number;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export namespace ContactMessageSummary {
|
|
240
|
+
export interface ChannelScore {
|
|
241
|
+
channel?: string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Percentage (0-100) of messages on this channel that ended in FAILED.
|
|
245
|
+
*/
|
|
246
|
+
fail_score?: number;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Percentage (0-100) of messages on this channel that reached a successful
|
|
250
|
+
* terminal state: SENT/DELIVERED/READ for outbound, RECEIVED for inbound.
|
|
251
|
+
*/
|
|
252
|
+
success_score?: number;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
171
256
|
/**
|
|
172
257
|
* Contact response for v3 API Uses snake_case for JSON property names
|
|
173
258
|
*/
|
|
@@ -403,9 +488,19 @@ export interface ContactDeleteParams {
|
|
|
403
488
|
'x-profile-id'?: string;
|
|
404
489
|
}
|
|
405
490
|
|
|
491
|
+
export interface ContactRetrieveMessageSummaryParams {
|
|
492
|
+
/**
|
|
493
|
+
* Profile UUID to scope the request to a child profile. Only organization API keys
|
|
494
|
+
* can use this header. The profile must belong to the calling organization.
|
|
495
|
+
*/
|
|
496
|
+
'x-profile-id'?: string;
|
|
497
|
+
}
|
|
498
|
+
|
|
406
499
|
export declare namespace Contacts {
|
|
407
500
|
export {
|
|
408
501
|
type APIResponseOfContact as APIResponseOfContact,
|
|
502
|
+
type APIResponseOfContactMessageSummary as APIResponseOfContactMessageSummary,
|
|
503
|
+
type ContactMessageSummary as ContactMessageSummary,
|
|
409
504
|
type ContactResponse as ContactResponse,
|
|
410
505
|
type ContactListResponse as ContactListResponse,
|
|
411
506
|
type ContactCreateParams as ContactCreateParams,
|
|
@@ -413,5 +508,6 @@ export declare namespace Contacts {
|
|
|
413
508
|
type ContactUpdateParams as ContactUpdateParams,
|
|
414
509
|
type ContactListParams as ContactListParams,
|
|
415
510
|
type ContactDeleteParams as ContactDeleteParams,
|
|
511
|
+
type ContactRetrieveMessageSummaryParams as ContactRetrieveMessageSummaryParams,
|
|
416
512
|
};
|
|
417
513
|
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as WebhooksAPI from './webhooks';
|
|
5
|
+
import { APIPromise } from '../core/api-promise';
|
|
6
|
+
import { buildHeaders } from '../internal/headers';
|
|
7
|
+
import { RequestOptions } from '../internal/request-options';
|
|
8
|
+
import { path } from '../internal/utils/path';
|
|
9
|
+
|
|
10
|
+
export class Conversations extends APIResource {
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a paginated list of the authenticated customer's messages across all
|
|
13
|
+
* conversations, ordered by created date (most recent first).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const apiResponseOfConversationMessagesList =
|
|
18
|
+
* await client.conversations.list({
|
|
19
|
+
* page: 0,
|
|
20
|
+
* page_size: 0,
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
list(
|
|
25
|
+
params: ConversationListParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<APIResponseOfConversationMessagesList> {
|
|
28
|
+
const { 'x-profile-id': xProfileID, ...query } = params;
|
|
29
|
+
return this._client.get('/v3/conversations', {
|
|
30
|
+
query,
|
|
31
|
+
...options,
|
|
32
|
+
headers: buildHeaders([
|
|
33
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
34
|
+
options?.headers,
|
|
35
|
+
]),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves a paginated list of the messages in a single conversation (scoped to
|
|
41
|
+
* the authenticated customer), ordered by created date (most recent first).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const apiResponseOfConversationMessagesList =
|
|
46
|
+
* await client.conversations.listMessages(
|
|
47
|
+
* '08fab313-c9e2-502c-975e-08b0356c432e',
|
|
48
|
+
* { page: 0, page_size: 0 },
|
|
49
|
+
* );
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
listMessages(
|
|
53
|
+
id: string,
|
|
54
|
+
params: ConversationListMessagesParams,
|
|
55
|
+
options?: RequestOptions,
|
|
56
|
+
): APIPromise<APIResponseOfConversationMessagesList> {
|
|
57
|
+
const { 'x-profile-id': xProfileID, ...query } = params;
|
|
58
|
+
return this._client.get(path`/v3/conversations/${id}`, {
|
|
59
|
+
query,
|
|
60
|
+
...options,
|
|
61
|
+
headers: buildHeaders([
|
|
62
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
63
|
+
options?.headers,
|
|
64
|
+
]),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Standard API response envelope for all v3 endpoints
|
|
71
|
+
*/
|
|
72
|
+
export interface APIResponseOfConversationMessagesList {
|
|
73
|
+
/**
|
|
74
|
+
* A paginated list of messages — used by both conversation read endpoints.
|
|
75
|
+
*/
|
|
76
|
+
data?: ConversationMessagesList | null;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Error information
|
|
80
|
+
*/
|
|
81
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Request and response metadata
|
|
85
|
+
*/
|
|
86
|
+
meta?: WebhooksAPI.APIMeta;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Indicates whether the request was successful
|
|
90
|
+
*/
|
|
91
|
+
success?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A paginated list of messages — used by both conversation read endpoints.
|
|
96
|
+
*/
|
|
97
|
+
export interface ConversationMessagesList {
|
|
98
|
+
/**
|
|
99
|
+
* The messages on this page, most recent first.
|
|
100
|
+
*/
|
|
101
|
+
messages?: Array<ConversationMessagesList.Message>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Pagination metadata for list responses
|
|
105
|
+
*/
|
|
106
|
+
pagination?: WebhooksAPI.PaginationMeta;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export namespace ConversationMessagesList {
|
|
110
|
+
/**
|
|
111
|
+
* Message response for v3 API — same shape as v2 with snake_case JSON conventions
|
|
112
|
+
*/
|
|
113
|
+
export interface Message {
|
|
114
|
+
id?: string;
|
|
115
|
+
|
|
116
|
+
active_contact_price?: number | null;
|
|
117
|
+
|
|
118
|
+
channel?: string;
|
|
119
|
+
|
|
120
|
+
contact_id?: string;
|
|
121
|
+
|
|
122
|
+
created_at?: string;
|
|
123
|
+
|
|
124
|
+
customer_id?: string;
|
|
125
|
+
|
|
126
|
+
direction?: string;
|
|
127
|
+
|
|
128
|
+
events?: Array<Message.Event> | null;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Structured message body format for database storage. Preserves channel-specific
|
|
132
|
+
* components (header, body, footer, buttons).
|
|
133
|
+
*/
|
|
134
|
+
message_body?: Message.MessageBody | null;
|
|
135
|
+
|
|
136
|
+
phone?: string;
|
|
137
|
+
|
|
138
|
+
phone_international?: string;
|
|
139
|
+
|
|
140
|
+
price?: number | null;
|
|
141
|
+
|
|
142
|
+
region_code?: string;
|
|
143
|
+
|
|
144
|
+
status?: string;
|
|
145
|
+
|
|
146
|
+
template_category?: string | null;
|
|
147
|
+
|
|
148
|
+
template_id?: string | null;
|
|
149
|
+
|
|
150
|
+
template_name?: string | null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export namespace Message {
|
|
154
|
+
/**
|
|
155
|
+
* Represents a status change event in a message's lifecycle (v3)
|
|
156
|
+
*/
|
|
157
|
+
export interface Event {
|
|
158
|
+
status: string;
|
|
159
|
+
|
|
160
|
+
timestamp: string;
|
|
161
|
+
|
|
162
|
+
description?: string | null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Structured message body format for database storage. Preserves channel-specific
|
|
167
|
+
* components (header, body, footer, buttons).
|
|
168
|
+
*/
|
|
169
|
+
export interface MessageBody {
|
|
170
|
+
buttons?: Array<MessageBody.Button> | null;
|
|
171
|
+
|
|
172
|
+
content?: string;
|
|
173
|
+
|
|
174
|
+
footer?: string | null;
|
|
175
|
+
|
|
176
|
+
header?: string | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export namespace MessageBody {
|
|
180
|
+
export interface Button {
|
|
181
|
+
postbackData?: string | null;
|
|
182
|
+
|
|
183
|
+
text?: string | null;
|
|
184
|
+
|
|
185
|
+
type?: string;
|
|
186
|
+
|
|
187
|
+
value?: string;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ConversationListParams {
|
|
194
|
+
/**
|
|
195
|
+
* Query param
|
|
196
|
+
*/
|
|
197
|
+
page: number;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Query param
|
|
201
|
+
*/
|
|
202
|
+
page_size: number;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
206
|
+
* organization API keys can use this header. The profile must belong to the
|
|
207
|
+
* calling organization.
|
|
208
|
+
*/
|
|
209
|
+
'x-profile-id'?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface ConversationListMessagesParams {
|
|
213
|
+
/**
|
|
214
|
+
* Query param
|
|
215
|
+
*/
|
|
216
|
+
page: number;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Query param
|
|
220
|
+
*/
|
|
221
|
+
page_size: number;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
225
|
+
* organization API keys can use this header. The profile must belong to the
|
|
226
|
+
* calling organization.
|
|
227
|
+
*/
|
|
228
|
+
'x-profile-id'?: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare namespace Conversations {
|
|
232
|
+
export {
|
|
233
|
+
type APIResponseOfConversationMessagesList as APIResponseOfConversationMessagesList,
|
|
234
|
+
type ConversationMessagesList as ConversationMessagesList,
|
|
235
|
+
type ConversationListParams as ConversationListParams,
|
|
236
|
+
type ConversationListMessagesParams as ConversationListMessagesParams,
|
|
237
|
+
};
|
|
238
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export {
|
|
4
4
|
Contacts,
|
|
5
5
|
type APIResponseOfContact,
|
|
6
|
+
type APIResponseOfContactMessageSummary,
|
|
7
|
+
type ContactMessageSummary,
|
|
6
8
|
type ContactResponse,
|
|
7
9
|
type ContactListResponse,
|
|
8
10
|
type ContactCreateParams,
|
|
@@ -10,7 +12,15 @@ export {
|
|
|
10
12
|
type ContactUpdateParams,
|
|
11
13
|
type ContactListParams,
|
|
12
14
|
type ContactDeleteParams,
|
|
15
|
+
type ContactRetrieveMessageSummaryParams,
|
|
13
16
|
} from './contacts';
|
|
17
|
+
export {
|
|
18
|
+
Conversations,
|
|
19
|
+
type APIResponseOfConversationMessagesList,
|
|
20
|
+
type ConversationMessagesList,
|
|
21
|
+
type ConversationListParams,
|
|
22
|
+
type ConversationListMessagesParams,
|
|
23
|
+
} from './conversations';
|
|
14
24
|
export { Me, type ProfileSettings, type MeRetrieveResponse, type MeRetrieveParams } from './me';
|
|
15
25
|
export {
|
|
16
26
|
Messages,
|
|
@@ -26,13 +36,13 @@ export {
|
|
|
26
36
|
Profiles,
|
|
27
37
|
type APIResponseOfProfileDetail,
|
|
28
38
|
type BillingContactInfo,
|
|
39
|
+
type BrandBusinessInfo,
|
|
40
|
+
type BrandComplianceInfo,
|
|
41
|
+
type BrandContactInfo,
|
|
29
42
|
type BrandsBrandData,
|
|
30
43
|
type DestinationCountry,
|
|
31
44
|
type PaymentDetails,
|
|
32
45
|
type ProfileDetail,
|
|
33
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
|
|
34
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
|
|
35
|
-
type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
|
|
36
46
|
type TcrBrandRelationship,
|
|
37
47
|
type TcrVertical,
|
|
38
48
|
type ProfileListResponse,
|
|
@@ -47,15 +57,15 @@ export {
|
|
|
47
57
|
export {
|
|
48
58
|
Templates,
|
|
49
59
|
type APIResponseTemplate,
|
|
50
|
-
type
|
|
51
|
-
type SentDmServicesCommonContractsPocOsTemplateBody,
|
|
52
|
-
type SentDmServicesCommonContractsPocOsTemplateButton,
|
|
53
|
-
type SentDmServicesCommonContractsPocOsTemplateButtonProps,
|
|
54
|
-
type SentDmServicesCommonContractsPocOsTemplateFooter,
|
|
55
|
-
type SentDmServicesCommonContractsPocOsTemplateHeader,
|
|
60
|
+
type AuthenticationConfig,
|
|
56
61
|
type Template,
|
|
62
|
+
type TemplateBody,
|
|
57
63
|
type TemplateBodyContent,
|
|
64
|
+
type TemplateButton,
|
|
65
|
+
type TemplateButtonProps,
|
|
58
66
|
type TemplateDefinition,
|
|
67
|
+
type TemplateFooter,
|
|
68
|
+
type TemplateHeader,
|
|
59
69
|
type TemplateVariable,
|
|
60
70
|
type TemplateListResponse,
|
|
61
71
|
type TemplateCreateParams,
|
|
@@ -68,7 +68,10 @@ export class Messages extends APIResource {
|
|
|
68
68
|
* multi-channel broadcast — when multiple channels are specified (e.g. ["sms",
|
|
69
69
|
* "whatsapp"]), a separate message is created for each (recipient, channel) pair.
|
|
70
70
|
* Returns immediately with per-recipient message IDs for async tracking via
|
|
71
|
-
* webhooks or the GET /messages/{id} endpoint.
|
|
71
|
+
* webhooks or the GET /messages/{id} endpoint. Account-level preconditions such as
|
|
72
|
+
* insufficient balance do not reject the request: the send is accepted with 202
|
|
73
|
+
* and the affected messages are reported as BLOCKED on GET /messages/{id} and the
|
|
74
|
+
* message status webhook.
|
|
72
75
|
*
|
|
73
76
|
* @example
|
|
74
77
|
* ```ts
|
|
@@ -320,8 +323,7 @@ export namespace MessageSendResponse {
|
|
|
320
323
|
recipients?: Array<Data.Recipient>;
|
|
321
324
|
|
|
322
325
|
/**
|
|
323
|
-
* Overall request status: "QUEUED" when the batch has been accepted
|
|
324
|
-
* to Kafka.
|
|
326
|
+
* Overall request status: "QUEUED" when the batch has been accepted for delivery.
|
|
325
327
|
*/
|
|
326
328
|
status?: string;
|
|
327
329
|
|