@sendly/node 3.24.0 → 3.27.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/dist/index.d.mts +98 -1
- package/dist/index.d.ts +98 -1
- package/dist/index.js +85 -0
- package/dist/index.mjs +85 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -267,6 +267,65 @@ interface SuggestRepliesResponse {
|
|
|
267
267
|
basedOnMessageId?: string;
|
|
268
268
|
model?: string;
|
|
269
269
|
}
|
|
270
|
+
interface ConversationContext {
|
|
271
|
+
context: string;
|
|
272
|
+
conversation: {
|
|
273
|
+
id: string;
|
|
274
|
+
phoneNumber: string;
|
|
275
|
+
status: string;
|
|
276
|
+
messageCount: number;
|
|
277
|
+
unreadCount: number;
|
|
278
|
+
};
|
|
279
|
+
tokenEstimate: number;
|
|
280
|
+
business?: {
|
|
281
|
+
name: string;
|
|
282
|
+
useCase?: string;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
interface AutoLabelRule {
|
|
286
|
+
id: string;
|
|
287
|
+
name: string;
|
|
288
|
+
conditions: {
|
|
289
|
+
intent?: string | string[];
|
|
290
|
+
sentiment?: string | string[];
|
|
291
|
+
intentConfidenceMin?: number;
|
|
292
|
+
sentimentConfidenceMin?: number;
|
|
293
|
+
};
|
|
294
|
+
actions: {
|
|
295
|
+
addLabels: string[];
|
|
296
|
+
closeConversation?: boolean;
|
|
297
|
+
};
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
priority: number;
|
|
300
|
+
createdAt: string;
|
|
301
|
+
updatedAt: string;
|
|
302
|
+
}
|
|
303
|
+
interface AutoLabelRuleListResponse {
|
|
304
|
+
data: AutoLabelRule[];
|
|
305
|
+
}
|
|
306
|
+
interface CreateAutoLabelRuleRequest {
|
|
307
|
+
name: string;
|
|
308
|
+
conditions: AutoLabelRule["conditions"];
|
|
309
|
+
actions: AutoLabelRule["actions"];
|
|
310
|
+
priority?: number;
|
|
311
|
+
}
|
|
312
|
+
interface UpdateAutoLabelRuleRequest {
|
|
313
|
+
name?: string;
|
|
314
|
+
conditions?: AutoLabelRule["conditions"];
|
|
315
|
+
actions?: AutoLabelRule["actions"];
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
priority?: number;
|
|
318
|
+
}
|
|
319
|
+
interface GenerateTemplateRequest {
|
|
320
|
+
description: string;
|
|
321
|
+
category?: string;
|
|
322
|
+
}
|
|
323
|
+
interface GeneratedTemplate {
|
|
324
|
+
name: string;
|
|
325
|
+
text: string;
|
|
326
|
+
variables: string[];
|
|
327
|
+
category: string;
|
|
328
|
+
}
|
|
270
329
|
interface Label {
|
|
271
330
|
id: string;
|
|
272
331
|
name: string;
|
|
@@ -1730,6 +1789,7 @@ interface ProvisionWorkspaceOptions {
|
|
|
1730
1789
|
keyType?: "test" | "live";
|
|
1731
1790
|
webhookUrl?: string;
|
|
1732
1791
|
generateOptInPage?: boolean;
|
|
1792
|
+
generateBusinessPage?: boolean;
|
|
1733
1793
|
}
|
|
1734
1794
|
interface ProvisionWorkspaceResult {
|
|
1735
1795
|
workspace: {
|
|
@@ -2001,6 +2061,20 @@ interface QuotaSettings {
|
|
|
2001
2061
|
interface UpdateQuotaOptions {
|
|
2002
2062
|
monthlyMessageQuota: number | null;
|
|
2003
2063
|
}
|
|
2064
|
+
interface GenerateBusinessPageOptions {
|
|
2065
|
+
businessName: string;
|
|
2066
|
+
useCase?: string;
|
|
2067
|
+
useCaseSummary?: string;
|
|
2068
|
+
contactEmail?: string;
|
|
2069
|
+
contactPhone?: string;
|
|
2070
|
+
businessAddress?: string;
|
|
2071
|
+
socialUrl?: string;
|
|
2072
|
+
}
|
|
2073
|
+
interface GenerateBusinessPageResponse {
|
|
2074
|
+
slug: string;
|
|
2075
|
+
url: string;
|
|
2076
|
+
pageId: string;
|
|
2077
|
+
}
|
|
2004
2078
|
|
|
2005
2079
|
/**
|
|
2006
2080
|
* HTTP Client Utility
|
|
@@ -3074,6 +3148,7 @@ declare class TemplatesResource {
|
|
|
3074
3148
|
name?: string;
|
|
3075
3149
|
}): Promise<Template>;
|
|
3076
3150
|
private transformTemplate;
|
|
3151
|
+
generate(request: GenerateTemplateRequest): Promise<GeneratedTemplate>;
|
|
3077
3152
|
}
|
|
3078
3153
|
|
|
3079
3154
|
/**
|
|
@@ -3677,6 +3752,15 @@ declare class EnterpriseResource {
|
|
|
3677
3752
|
constructor(http: HttpClient);
|
|
3678
3753
|
getAccount(): Promise<EnterpriseAccount>;
|
|
3679
3754
|
provision(options: ProvisionWorkspaceOptions): Promise<ProvisionWorkspaceResult>;
|
|
3755
|
+
generateBusinessPage(options: GenerateBusinessPageOptions): Promise<GenerateBusinessPageResponse>;
|
|
3756
|
+
uploadVerificationDocument(file: Buffer | Blob, options?: {
|
|
3757
|
+
workspaceId?: string;
|
|
3758
|
+
verificationId?: string;
|
|
3759
|
+
filename?: string;
|
|
3760
|
+
}): Promise<{
|
|
3761
|
+
url: string;
|
|
3762
|
+
id: string;
|
|
3763
|
+
}>;
|
|
3680
3764
|
}
|
|
3681
3765
|
|
|
3682
3766
|
declare class ConversationsResource {
|
|
@@ -3689,6 +3773,9 @@ declare class ConversationsResource {
|
|
|
3689
3773
|
markRead(id: string): Promise<Conversation>;
|
|
3690
3774
|
close(id: string): Promise<Conversation>;
|
|
3691
3775
|
reopen(id: string): Promise<Conversation>;
|
|
3776
|
+
getContext(conversationId: string, options?: {
|
|
3777
|
+
maxMessages?: number;
|
|
3778
|
+
}): Promise<ConversationContext>;
|
|
3692
3779
|
suggestReplies(conversationId: string): Promise<SuggestRepliesResponse>;
|
|
3693
3780
|
addLabels(conversationId: string, labelIds: string[]): Promise<LabelListResponse>;
|
|
3694
3781
|
removeLabel(conversationId: string, labelId: string): Promise<void>;
|
|
@@ -3713,6 +3800,15 @@ declare class DraftsResource {
|
|
|
3713
3800
|
reject(id: string, reason?: string): Promise<MessageDraft>;
|
|
3714
3801
|
}
|
|
3715
3802
|
|
|
3803
|
+
declare class RulesResource {
|
|
3804
|
+
private readonly http;
|
|
3805
|
+
constructor(http: HttpClient);
|
|
3806
|
+
list(): Promise<AutoLabelRuleListResponse>;
|
|
3807
|
+
create(request: CreateAutoLabelRuleRequest): Promise<AutoLabelRule>;
|
|
3808
|
+
update(id: string, request: UpdateAutoLabelRuleRequest): Promise<AutoLabelRule>;
|
|
3809
|
+
delete(id: string): Promise<void>;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3716
3812
|
/**
|
|
3717
3813
|
* Sendly Client
|
|
3718
3814
|
* @packageDocumentation
|
|
@@ -3769,6 +3865,7 @@ declare class Sendly {
|
|
|
3769
3865
|
readonly conversations: ConversationsResource;
|
|
3770
3866
|
readonly labels: LabelsResource;
|
|
3771
3867
|
readonly drafts: DraftsResource;
|
|
3868
|
+
readonly rules: RulesResource;
|
|
3772
3869
|
/**
|
|
3773
3870
|
* Webhooks API resource
|
|
3774
3871
|
*
|
|
@@ -4375,4 +4472,4 @@ declare class Webhooks {
|
|
|
4375
4472
|
*/
|
|
4376
4473
|
type WebhookMessageData = WebhookMessageObject;
|
|
4377
4474
|
|
|
4378
|
-
export { ALL_SUPPORTED_COUNTRIES, type Account, type AddLabelsRequest, type AnalyticsOverview, type AnalyticsPeriod, type ApiErrorResponse, type ApiKey, AuthenticationError, type AutoTopUpSettings, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, type BillingBreakdown, type BillingBreakdownOptions, type BulkProvisionResult, type BulkProvisionResultItem, type BulkProvisionWorkspace, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type Conversation, type ConversationListResponse, type ConversationStatus, type ConversationWithMessages, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateDraftRequest, type CreateKeyOptions, type CreateLabelRequest, type CreateOptInPageOptions, type CreateOptInPageResult, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreateWorkspaceOptions, type CreatedApiKey, type CreditAnalytics, type CreditAnalyticsDataPoint, type CreditTransaction, type Credits, type DeliveryAnalyticsItem, type DeliveryStatus, type DnsRecord, type DraftListResponse, type DraftStatus, type EnterpriseAccount, type EnterpriseWebhook, type EnterpriseWebhookTestResult, type EnterpriseWorkspace, type EnterpriseWorkspaceDetail, type EnterpriseWorkspaceSummary, type GetConversationOptions, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type Invitation, type Label, type LabelListResponse, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListConversationsOptions, type ListDraftsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type MediaFile, type MediaUploadOptions, type Message, type MessageAnalytics, type MessageAnalyticsDataPoint, type MessageDraft, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type OptInPage, type PricingTier, type ProvisionWorkspaceOptions, type ProvisionWorkspaceResult, type QuotaSettings, RateLimitError, type RateLimitInfo, type ReplyToConversationRequest, type ResumeWorkspaceResult, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendInvitationOptions, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type SetCustomDomainResult, type SetWorkspaceWebhookOptions, type SetWorkspaceWebhookResult, type SuggestRepliesResponse, type SuggestedReply, type SuspendWorkspaceOptions, type SuspendWorkspaceResult, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type TransferCreditsOptions, type TransferCreditsResult, type UpdateAutoTopUpOptions, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateConversationRequest, type UpdateDraftRequest, type UpdateOptInPageOptions, type UpdateQuotaOptions, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, type WorkspaceBillingItem, type WorkspaceCredits, type WorkspaceWebhook, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
|
|
4475
|
+
export { ALL_SUPPORTED_COUNTRIES, type Account, type AddLabelsRequest, type AnalyticsOverview, type AnalyticsPeriod, type ApiErrorResponse, type ApiKey, AuthenticationError, type AutoTopUpSettings, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, type BillingBreakdown, type BillingBreakdownOptions, type BulkProvisionResult, type BulkProvisionResultItem, type BulkProvisionWorkspace, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type Conversation, type ConversationListResponse, type ConversationStatus, type ConversationWithMessages, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateDraftRequest, type CreateKeyOptions, type CreateLabelRequest, type CreateOptInPageOptions, type CreateOptInPageResult, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreateWorkspaceOptions, type CreatedApiKey, type CreditAnalytics, type CreditAnalyticsDataPoint, type CreditTransaction, type Credits, type DeliveryAnalyticsItem, type DeliveryStatus, type DnsRecord, type DraftListResponse, type DraftStatus, type EnterpriseAccount, type EnterpriseWebhook, type EnterpriseWebhookTestResult, type EnterpriseWorkspace, type EnterpriseWorkspaceDetail, type EnterpriseWorkspaceSummary, type GenerateBusinessPageOptions, type GenerateBusinessPageResponse, type GetConversationOptions, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type Invitation, type Label, type LabelListResponse, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListConversationsOptions, type ListDraftsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type MediaFile, type MediaUploadOptions, type Message, type MessageAnalytics, type MessageAnalyticsDataPoint, type MessageDraft, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type OptInPage, type PricingTier, type ProvisionWorkspaceOptions, type ProvisionWorkspaceResult, type QuotaSettings, RateLimitError, type RateLimitInfo, type ReplyToConversationRequest, type ResumeWorkspaceResult, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendInvitationOptions, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type SetCustomDomainResult, type SetWorkspaceWebhookOptions, type SetWorkspaceWebhookResult, type SuggestRepliesResponse, type SuggestedReply, type SuspendWorkspaceOptions, type SuspendWorkspaceResult, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type TransferCreditsOptions, type TransferCreditsResult, type UpdateAutoTopUpOptions, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateConversationRequest, type UpdateDraftRequest, type UpdateOptInPageOptions, type UpdateQuotaOptions, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, type WorkspaceBillingItem, type WorkspaceCredits, type WorkspaceWebhook, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -267,6 +267,65 @@ interface SuggestRepliesResponse {
|
|
|
267
267
|
basedOnMessageId?: string;
|
|
268
268
|
model?: string;
|
|
269
269
|
}
|
|
270
|
+
interface ConversationContext {
|
|
271
|
+
context: string;
|
|
272
|
+
conversation: {
|
|
273
|
+
id: string;
|
|
274
|
+
phoneNumber: string;
|
|
275
|
+
status: string;
|
|
276
|
+
messageCount: number;
|
|
277
|
+
unreadCount: number;
|
|
278
|
+
};
|
|
279
|
+
tokenEstimate: number;
|
|
280
|
+
business?: {
|
|
281
|
+
name: string;
|
|
282
|
+
useCase?: string;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
interface AutoLabelRule {
|
|
286
|
+
id: string;
|
|
287
|
+
name: string;
|
|
288
|
+
conditions: {
|
|
289
|
+
intent?: string | string[];
|
|
290
|
+
sentiment?: string | string[];
|
|
291
|
+
intentConfidenceMin?: number;
|
|
292
|
+
sentimentConfidenceMin?: number;
|
|
293
|
+
};
|
|
294
|
+
actions: {
|
|
295
|
+
addLabels: string[];
|
|
296
|
+
closeConversation?: boolean;
|
|
297
|
+
};
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
priority: number;
|
|
300
|
+
createdAt: string;
|
|
301
|
+
updatedAt: string;
|
|
302
|
+
}
|
|
303
|
+
interface AutoLabelRuleListResponse {
|
|
304
|
+
data: AutoLabelRule[];
|
|
305
|
+
}
|
|
306
|
+
interface CreateAutoLabelRuleRequest {
|
|
307
|
+
name: string;
|
|
308
|
+
conditions: AutoLabelRule["conditions"];
|
|
309
|
+
actions: AutoLabelRule["actions"];
|
|
310
|
+
priority?: number;
|
|
311
|
+
}
|
|
312
|
+
interface UpdateAutoLabelRuleRequest {
|
|
313
|
+
name?: string;
|
|
314
|
+
conditions?: AutoLabelRule["conditions"];
|
|
315
|
+
actions?: AutoLabelRule["actions"];
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
priority?: number;
|
|
318
|
+
}
|
|
319
|
+
interface GenerateTemplateRequest {
|
|
320
|
+
description: string;
|
|
321
|
+
category?: string;
|
|
322
|
+
}
|
|
323
|
+
interface GeneratedTemplate {
|
|
324
|
+
name: string;
|
|
325
|
+
text: string;
|
|
326
|
+
variables: string[];
|
|
327
|
+
category: string;
|
|
328
|
+
}
|
|
270
329
|
interface Label {
|
|
271
330
|
id: string;
|
|
272
331
|
name: string;
|
|
@@ -1730,6 +1789,7 @@ interface ProvisionWorkspaceOptions {
|
|
|
1730
1789
|
keyType?: "test" | "live";
|
|
1731
1790
|
webhookUrl?: string;
|
|
1732
1791
|
generateOptInPage?: boolean;
|
|
1792
|
+
generateBusinessPage?: boolean;
|
|
1733
1793
|
}
|
|
1734
1794
|
interface ProvisionWorkspaceResult {
|
|
1735
1795
|
workspace: {
|
|
@@ -2001,6 +2061,20 @@ interface QuotaSettings {
|
|
|
2001
2061
|
interface UpdateQuotaOptions {
|
|
2002
2062
|
monthlyMessageQuota: number | null;
|
|
2003
2063
|
}
|
|
2064
|
+
interface GenerateBusinessPageOptions {
|
|
2065
|
+
businessName: string;
|
|
2066
|
+
useCase?: string;
|
|
2067
|
+
useCaseSummary?: string;
|
|
2068
|
+
contactEmail?: string;
|
|
2069
|
+
contactPhone?: string;
|
|
2070
|
+
businessAddress?: string;
|
|
2071
|
+
socialUrl?: string;
|
|
2072
|
+
}
|
|
2073
|
+
interface GenerateBusinessPageResponse {
|
|
2074
|
+
slug: string;
|
|
2075
|
+
url: string;
|
|
2076
|
+
pageId: string;
|
|
2077
|
+
}
|
|
2004
2078
|
|
|
2005
2079
|
/**
|
|
2006
2080
|
* HTTP Client Utility
|
|
@@ -3074,6 +3148,7 @@ declare class TemplatesResource {
|
|
|
3074
3148
|
name?: string;
|
|
3075
3149
|
}): Promise<Template>;
|
|
3076
3150
|
private transformTemplate;
|
|
3151
|
+
generate(request: GenerateTemplateRequest): Promise<GeneratedTemplate>;
|
|
3077
3152
|
}
|
|
3078
3153
|
|
|
3079
3154
|
/**
|
|
@@ -3677,6 +3752,15 @@ declare class EnterpriseResource {
|
|
|
3677
3752
|
constructor(http: HttpClient);
|
|
3678
3753
|
getAccount(): Promise<EnterpriseAccount>;
|
|
3679
3754
|
provision(options: ProvisionWorkspaceOptions): Promise<ProvisionWorkspaceResult>;
|
|
3755
|
+
generateBusinessPage(options: GenerateBusinessPageOptions): Promise<GenerateBusinessPageResponse>;
|
|
3756
|
+
uploadVerificationDocument(file: Buffer | Blob, options?: {
|
|
3757
|
+
workspaceId?: string;
|
|
3758
|
+
verificationId?: string;
|
|
3759
|
+
filename?: string;
|
|
3760
|
+
}): Promise<{
|
|
3761
|
+
url: string;
|
|
3762
|
+
id: string;
|
|
3763
|
+
}>;
|
|
3680
3764
|
}
|
|
3681
3765
|
|
|
3682
3766
|
declare class ConversationsResource {
|
|
@@ -3689,6 +3773,9 @@ declare class ConversationsResource {
|
|
|
3689
3773
|
markRead(id: string): Promise<Conversation>;
|
|
3690
3774
|
close(id: string): Promise<Conversation>;
|
|
3691
3775
|
reopen(id: string): Promise<Conversation>;
|
|
3776
|
+
getContext(conversationId: string, options?: {
|
|
3777
|
+
maxMessages?: number;
|
|
3778
|
+
}): Promise<ConversationContext>;
|
|
3692
3779
|
suggestReplies(conversationId: string): Promise<SuggestRepliesResponse>;
|
|
3693
3780
|
addLabels(conversationId: string, labelIds: string[]): Promise<LabelListResponse>;
|
|
3694
3781
|
removeLabel(conversationId: string, labelId: string): Promise<void>;
|
|
@@ -3713,6 +3800,15 @@ declare class DraftsResource {
|
|
|
3713
3800
|
reject(id: string, reason?: string): Promise<MessageDraft>;
|
|
3714
3801
|
}
|
|
3715
3802
|
|
|
3803
|
+
declare class RulesResource {
|
|
3804
|
+
private readonly http;
|
|
3805
|
+
constructor(http: HttpClient);
|
|
3806
|
+
list(): Promise<AutoLabelRuleListResponse>;
|
|
3807
|
+
create(request: CreateAutoLabelRuleRequest): Promise<AutoLabelRule>;
|
|
3808
|
+
update(id: string, request: UpdateAutoLabelRuleRequest): Promise<AutoLabelRule>;
|
|
3809
|
+
delete(id: string): Promise<void>;
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3716
3812
|
/**
|
|
3717
3813
|
* Sendly Client
|
|
3718
3814
|
* @packageDocumentation
|
|
@@ -3769,6 +3865,7 @@ declare class Sendly {
|
|
|
3769
3865
|
readonly conversations: ConversationsResource;
|
|
3770
3866
|
readonly labels: LabelsResource;
|
|
3771
3867
|
readonly drafts: DraftsResource;
|
|
3868
|
+
readonly rules: RulesResource;
|
|
3772
3869
|
/**
|
|
3773
3870
|
* Webhooks API resource
|
|
3774
3871
|
*
|
|
@@ -4375,4 +4472,4 @@ declare class Webhooks {
|
|
|
4375
4472
|
*/
|
|
4376
4473
|
type WebhookMessageData = WebhookMessageObject;
|
|
4377
4474
|
|
|
4378
|
-
export { ALL_SUPPORTED_COUNTRIES, type Account, type AddLabelsRequest, type AnalyticsOverview, type AnalyticsPeriod, type ApiErrorResponse, type ApiKey, AuthenticationError, type AutoTopUpSettings, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, type BillingBreakdown, type BillingBreakdownOptions, type BulkProvisionResult, type BulkProvisionResultItem, type BulkProvisionWorkspace, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type Conversation, type ConversationListResponse, type ConversationStatus, type ConversationWithMessages, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateDraftRequest, type CreateKeyOptions, type CreateLabelRequest, type CreateOptInPageOptions, type CreateOptInPageResult, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreateWorkspaceOptions, type CreatedApiKey, type CreditAnalytics, type CreditAnalyticsDataPoint, type CreditTransaction, type Credits, type DeliveryAnalyticsItem, type DeliveryStatus, type DnsRecord, type DraftListResponse, type DraftStatus, type EnterpriseAccount, type EnterpriseWebhook, type EnterpriseWebhookTestResult, type EnterpriseWorkspace, type EnterpriseWorkspaceDetail, type EnterpriseWorkspaceSummary, type GetConversationOptions, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type Invitation, type Label, type LabelListResponse, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListConversationsOptions, type ListDraftsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type MediaFile, type MediaUploadOptions, type Message, type MessageAnalytics, type MessageAnalyticsDataPoint, type MessageDraft, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type OptInPage, type PricingTier, type ProvisionWorkspaceOptions, type ProvisionWorkspaceResult, type QuotaSettings, RateLimitError, type RateLimitInfo, type ReplyToConversationRequest, type ResumeWorkspaceResult, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendInvitationOptions, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type SetCustomDomainResult, type SetWorkspaceWebhookOptions, type SetWorkspaceWebhookResult, type SuggestRepliesResponse, type SuggestedReply, type SuspendWorkspaceOptions, type SuspendWorkspaceResult, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type TransferCreditsOptions, type TransferCreditsResult, type UpdateAutoTopUpOptions, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateConversationRequest, type UpdateDraftRequest, type UpdateOptInPageOptions, type UpdateQuotaOptions, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, type WorkspaceBillingItem, type WorkspaceCredits, type WorkspaceWebhook, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
|
|
4475
|
+
export { ALL_SUPPORTED_COUNTRIES, type Account, type AddLabelsRequest, type AnalyticsOverview, type AnalyticsPeriod, type ApiErrorResponse, type ApiKey, AuthenticationError, type AutoTopUpSettings, type BatchListResponse, type BatchMessageItem, type BatchMessageRequest, type BatchMessageResponse, type BatchMessageResult, type BatchStatus, type BillingBreakdown, type BillingBreakdownOptions, type BulkProvisionResult, type BulkProvisionResultItem, type BulkProvisionWorkspace, CREDITS_PER_SMS, type Campaign, type CampaignListResponse, type CampaignPreview, type CampaignStatus, type CancelledMessageResponse, type CheckVerificationRequest, type CheckVerificationResponse, type CircuitState, type Contact, type ContactList, type ContactListResponse, type ContactListsResponse, type Conversation, type ConversationListResponse, type ConversationStatus, type ConversationWithMessages, type CreateCampaignRequest, type CreateContactListRequest, type CreateContactRequest, type CreateDraftRequest, type CreateKeyOptions, type CreateLabelRequest, type CreateOptInPageOptions, type CreateOptInPageResult, type CreateTemplateRequest, type CreateVerifySessionRequest, type CreateWebhookOptions, type CreateWorkspaceOptions, type CreatedApiKey, type CreditAnalytics, type CreditAnalyticsDataPoint, type CreditTransaction, type Credits, type DeliveryAnalyticsItem, type DeliveryStatus, type DnsRecord, type DraftListResponse, type DraftStatus, type EnterpriseAccount, type EnterpriseWebhook, type EnterpriseWebhookTestResult, type EnterpriseWorkspace, type EnterpriseWorkspaceDetail, type EnterpriseWorkspaceSummary, type GenerateBusinessPageOptions, type GenerateBusinessPageResponse, type GetConversationOptions, type ImportContactItem, type ImportContactsError, type ImportContactsRequest, type ImportContactsResponse, InsufficientCreditsError, type Invitation, type Label, type LabelListResponse, type ListBatchesOptions, type ListCampaignsOptions, type ListContactsOptions, type ListConversationsOptions, type ListDraftsOptions, type ListMessagesOptions, type ListScheduledMessagesOptions, type ListVerificationsOptions, type MediaFile, type MediaUploadOptions, type Message, type MessageAnalytics, type MessageAnalyticsDataPoint, type MessageDraft, type MessageListResponse, type MessageStatus, type MessageType, NetworkError, NotFoundError, type OptInPage, type PricingTier, type ProvisionWorkspaceOptions, type ProvisionWorkspaceResult, type QuotaSettings, RateLimitError, type RateLimitInfo, type ReplyToConversationRequest, type ResumeWorkspaceResult, SANDBOX_TEST_NUMBERS, SUPPORTED_COUNTRIES, type ScheduleCampaignRequest, type ScheduleMessageRequest, type ScheduledMessage, type ScheduledMessageListResponse, type ScheduledMessageStatus, type SendInvitationOptions, type SendMessageRequest, type SendVerificationRequest, type SendVerificationResponse, type SenderType, Sendly, type SendlyConfig, SendlyError, type SendlyErrorCode, type SetCustomDomainResult, type SetWorkspaceWebhookOptions, type SetWorkspaceWebhookResult, type SuggestRepliesResponse, type SuggestedReply, type SuspendWorkspaceOptions, type SuspendWorkspaceResult, type Template, type TemplateListResponse, type TemplatePreview, type TemplateStatus, type TemplateVariable, TimeoutError, type TransferCreditsOptions, type TransferCreditsResult, type UpdateAutoTopUpOptions, type UpdateCampaignRequest, type UpdateContactListRequest, type UpdateContactRequest, type UpdateConversationRequest, type UpdateDraftRequest, type UpdateOptInPageOptions, type UpdateQuotaOptions, type UpdateTemplateRequest, type UpdateWebhookOptions, type ValidateSessionTokenRequest, type ValidateSessionTokenResponse, ValidationError, type Verification, type VerificationDeliveryStatus, type VerificationListResponse, type VerificationStatus, type VerifySession, type VerifySessionStatus, type Webhook, type WebhookCreatedResponse, type WebhookDelivery, type WebhookEvent, type WebhookEventType, type WebhookMessageData, type WebhookMessageStatus, type WebhookSecretRotation, WebhookSignatureError, type WebhookTestResult, Webhooks, type WorkspaceBillingItem, type WorkspaceCredits, type WorkspaceWebhook, calculateSegments, Sendly as default, generateWebhookSignature, getCountryFromPhone, isCountrySupported, parseWebhookEvent, validateMessageText, validatePhoneNumber, validateSenderId, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -2162,6 +2162,13 @@ var TemplatesResource = class {
|
|
|
2162
2162
|
updatedAt: t.updated_at
|
|
2163
2163
|
};
|
|
2164
2164
|
}
|
|
2165
|
+
async generate(request) {
|
|
2166
|
+
return this.http.request({
|
|
2167
|
+
method: "POST",
|
|
2168
|
+
path: "/templates/generate",
|
|
2169
|
+
body: { ...request }
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2165
2172
|
};
|
|
2166
2173
|
|
|
2167
2174
|
// src/resources/campaigns.ts
|
|
@@ -3341,6 +3348,9 @@ var EnterpriseResource = class {
|
|
|
3341
3348
|
if (options.generateOptInPage !== void 0) {
|
|
3342
3349
|
body.generateOptInPage = options.generateOptInPage;
|
|
3343
3350
|
}
|
|
3351
|
+
if (options.generateBusinessPage !== void 0) {
|
|
3352
|
+
body.generateBusinessPage = options.generateBusinessPage;
|
|
3353
|
+
}
|
|
3344
3354
|
const response = await this.http.request({
|
|
3345
3355
|
method: "POST",
|
|
3346
3356
|
path: "/enterprise/workspaces/provision",
|
|
@@ -3348,6 +3358,36 @@ var EnterpriseResource = class {
|
|
|
3348
3358
|
});
|
|
3349
3359
|
return transformKeys(response);
|
|
3350
3360
|
}
|
|
3361
|
+
async generateBusinessPage(options) {
|
|
3362
|
+
if (!options.businessName || options.businessName.trim().length === 0) {
|
|
3363
|
+
throw new Error("businessName is required");
|
|
3364
|
+
}
|
|
3365
|
+
const response = await this.http.request({
|
|
3366
|
+
method: "POST",
|
|
3367
|
+
path: "/enterprise/business-page/generate",
|
|
3368
|
+
body: { ...options }
|
|
3369
|
+
});
|
|
3370
|
+
return response;
|
|
3371
|
+
}
|
|
3372
|
+
async uploadVerificationDocument(file, options) {
|
|
3373
|
+
const formData = new FormData();
|
|
3374
|
+
if (file instanceof Blob) {
|
|
3375
|
+
formData.append("file", file, options?.filename || "document");
|
|
3376
|
+
} else {
|
|
3377
|
+
const blob = new Blob([file]);
|
|
3378
|
+
formData.append("file", blob, options?.filename || "document");
|
|
3379
|
+
}
|
|
3380
|
+
if (options?.workspaceId) {
|
|
3381
|
+
formData.append("workspaceId", options.workspaceId);
|
|
3382
|
+
}
|
|
3383
|
+
if (options?.verificationId) {
|
|
3384
|
+
formData.append("verificationId", options.verificationId);
|
|
3385
|
+
}
|
|
3386
|
+
return this.http.requestFormData(
|
|
3387
|
+
"/enterprise/verification-document/upload",
|
|
3388
|
+
formData
|
|
3389
|
+
);
|
|
3390
|
+
}
|
|
3351
3391
|
};
|
|
3352
3392
|
|
|
3353
3393
|
// src/resources/conversations.ts
|
|
@@ -3410,6 +3450,15 @@ var ConversationsResource = class {
|
|
|
3410
3450
|
path: `/conversations/${id}/reopen`
|
|
3411
3451
|
});
|
|
3412
3452
|
}
|
|
3453
|
+
async getContext(conversationId, options) {
|
|
3454
|
+
const params = new URLSearchParams();
|
|
3455
|
+
if (options?.maxMessages) params.set("max_messages", String(options.maxMessages));
|
|
3456
|
+
const qs = params.toString();
|
|
3457
|
+
return this.http.request({
|
|
3458
|
+
method: "GET",
|
|
3459
|
+
path: `/conversations/${conversationId}/context${qs ? `?${qs}` : ""}`
|
|
3460
|
+
});
|
|
3461
|
+
}
|
|
3413
3462
|
async suggestReplies(conversationId) {
|
|
3414
3463
|
return this.http.request({
|
|
3415
3464
|
method: "POST",
|
|
@@ -3511,6 +3560,40 @@ var DraftsResource = class {
|
|
|
3511
3560
|
}
|
|
3512
3561
|
};
|
|
3513
3562
|
|
|
3563
|
+
// src/resources/rules.ts
|
|
3564
|
+
var RulesResource = class {
|
|
3565
|
+
http;
|
|
3566
|
+
constructor(http) {
|
|
3567
|
+
this.http = http;
|
|
3568
|
+
}
|
|
3569
|
+
async list() {
|
|
3570
|
+
return this.http.request({
|
|
3571
|
+
method: "GET",
|
|
3572
|
+
path: "/rules"
|
|
3573
|
+
});
|
|
3574
|
+
}
|
|
3575
|
+
async create(request) {
|
|
3576
|
+
return this.http.request({
|
|
3577
|
+
method: "POST",
|
|
3578
|
+
path: "/rules",
|
|
3579
|
+
body: { ...request }
|
|
3580
|
+
});
|
|
3581
|
+
}
|
|
3582
|
+
async update(id, request) {
|
|
3583
|
+
return this.http.request({
|
|
3584
|
+
method: "PATCH",
|
|
3585
|
+
path: `/rules/${id}`,
|
|
3586
|
+
body: { ...request }
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
async delete(id) {
|
|
3590
|
+
await this.http.request({
|
|
3591
|
+
method: "DELETE",
|
|
3592
|
+
path: `/rules/${id}`
|
|
3593
|
+
});
|
|
3594
|
+
}
|
|
3595
|
+
};
|
|
3596
|
+
|
|
3514
3597
|
// src/client.ts
|
|
3515
3598
|
var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
|
|
3516
3599
|
var DEFAULT_TIMEOUT2 = 3e4;
|
|
@@ -3535,6 +3618,7 @@ var Sendly = class {
|
|
|
3535
3618
|
conversations;
|
|
3536
3619
|
labels;
|
|
3537
3620
|
drafts;
|
|
3621
|
+
rules;
|
|
3538
3622
|
/**
|
|
3539
3623
|
* Webhooks API resource
|
|
3540
3624
|
*
|
|
@@ -3722,6 +3806,7 @@ var Sendly = class {
|
|
|
3722
3806
|
this.conversations = new ConversationsResource(this.http);
|
|
3723
3807
|
this.labels = new LabelsResource(this.http);
|
|
3724
3808
|
this.drafts = new DraftsResource(this.http);
|
|
3809
|
+
this.rules = new RulesResource(this.http);
|
|
3725
3810
|
this.webhooks = new WebhooksResource(this.http);
|
|
3726
3811
|
this.account = new AccountResource(this.http);
|
|
3727
3812
|
this.verify = new VerifyResource(this.http);
|
package/dist/index.mjs
CHANGED
|
@@ -2102,6 +2102,13 @@ var TemplatesResource = class {
|
|
|
2102
2102
|
updatedAt: t.updated_at
|
|
2103
2103
|
};
|
|
2104
2104
|
}
|
|
2105
|
+
async generate(request) {
|
|
2106
|
+
return this.http.request({
|
|
2107
|
+
method: "POST",
|
|
2108
|
+
path: "/templates/generate",
|
|
2109
|
+
body: { ...request }
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2105
2112
|
};
|
|
2106
2113
|
|
|
2107
2114
|
// src/resources/campaigns.ts
|
|
@@ -3281,6 +3288,9 @@ var EnterpriseResource = class {
|
|
|
3281
3288
|
if (options.generateOptInPage !== void 0) {
|
|
3282
3289
|
body.generateOptInPage = options.generateOptInPage;
|
|
3283
3290
|
}
|
|
3291
|
+
if (options.generateBusinessPage !== void 0) {
|
|
3292
|
+
body.generateBusinessPage = options.generateBusinessPage;
|
|
3293
|
+
}
|
|
3284
3294
|
const response = await this.http.request({
|
|
3285
3295
|
method: "POST",
|
|
3286
3296
|
path: "/enterprise/workspaces/provision",
|
|
@@ -3288,6 +3298,36 @@ var EnterpriseResource = class {
|
|
|
3288
3298
|
});
|
|
3289
3299
|
return transformKeys(response);
|
|
3290
3300
|
}
|
|
3301
|
+
async generateBusinessPage(options) {
|
|
3302
|
+
if (!options.businessName || options.businessName.trim().length === 0) {
|
|
3303
|
+
throw new Error("businessName is required");
|
|
3304
|
+
}
|
|
3305
|
+
const response = await this.http.request({
|
|
3306
|
+
method: "POST",
|
|
3307
|
+
path: "/enterprise/business-page/generate",
|
|
3308
|
+
body: { ...options }
|
|
3309
|
+
});
|
|
3310
|
+
return response;
|
|
3311
|
+
}
|
|
3312
|
+
async uploadVerificationDocument(file, options) {
|
|
3313
|
+
const formData = new FormData();
|
|
3314
|
+
if (file instanceof Blob) {
|
|
3315
|
+
formData.append("file", file, options?.filename || "document");
|
|
3316
|
+
} else {
|
|
3317
|
+
const blob = new Blob([file]);
|
|
3318
|
+
formData.append("file", blob, options?.filename || "document");
|
|
3319
|
+
}
|
|
3320
|
+
if (options?.workspaceId) {
|
|
3321
|
+
formData.append("workspaceId", options.workspaceId);
|
|
3322
|
+
}
|
|
3323
|
+
if (options?.verificationId) {
|
|
3324
|
+
formData.append("verificationId", options.verificationId);
|
|
3325
|
+
}
|
|
3326
|
+
return this.http.requestFormData(
|
|
3327
|
+
"/enterprise/verification-document/upload",
|
|
3328
|
+
formData
|
|
3329
|
+
);
|
|
3330
|
+
}
|
|
3291
3331
|
};
|
|
3292
3332
|
|
|
3293
3333
|
// src/resources/conversations.ts
|
|
@@ -3350,6 +3390,15 @@ var ConversationsResource = class {
|
|
|
3350
3390
|
path: `/conversations/${id}/reopen`
|
|
3351
3391
|
});
|
|
3352
3392
|
}
|
|
3393
|
+
async getContext(conversationId, options) {
|
|
3394
|
+
const params = new URLSearchParams();
|
|
3395
|
+
if (options?.maxMessages) params.set("max_messages", String(options.maxMessages));
|
|
3396
|
+
const qs = params.toString();
|
|
3397
|
+
return this.http.request({
|
|
3398
|
+
method: "GET",
|
|
3399
|
+
path: `/conversations/${conversationId}/context${qs ? `?${qs}` : ""}`
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3353
3402
|
async suggestReplies(conversationId) {
|
|
3354
3403
|
return this.http.request({
|
|
3355
3404
|
method: "POST",
|
|
@@ -3451,6 +3500,40 @@ var DraftsResource = class {
|
|
|
3451
3500
|
}
|
|
3452
3501
|
};
|
|
3453
3502
|
|
|
3503
|
+
// src/resources/rules.ts
|
|
3504
|
+
var RulesResource = class {
|
|
3505
|
+
http;
|
|
3506
|
+
constructor(http) {
|
|
3507
|
+
this.http = http;
|
|
3508
|
+
}
|
|
3509
|
+
async list() {
|
|
3510
|
+
return this.http.request({
|
|
3511
|
+
method: "GET",
|
|
3512
|
+
path: "/rules"
|
|
3513
|
+
});
|
|
3514
|
+
}
|
|
3515
|
+
async create(request) {
|
|
3516
|
+
return this.http.request({
|
|
3517
|
+
method: "POST",
|
|
3518
|
+
path: "/rules",
|
|
3519
|
+
body: { ...request }
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
async update(id, request) {
|
|
3523
|
+
return this.http.request({
|
|
3524
|
+
method: "PATCH",
|
|
3525
|
+
path: `/rules/${id}`,
|
|
3526
|
+
body: { ...request }
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
async delete(id) {
|
|
3530
|
+
await this.http.request({
|
|
3531
|
+
method: "DELETE",
|
|
3532
|
+
path: `/rules/${id}`
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
};
|
|
3536
|
+
|
|
3454
3537
|
// src/client.ts
|
|
3455
3538
|
var DEFAULT_BASE_URL2 = "https://sendly.live/api/v1";
|
|
3456
3539
|
var DEFAULT_TIMEOUT2 = 3e4;
|
|
@@ -3475,6 +3558,7 @@ var Sendly = class {
|
|
|
3475
3558
|
conversations;
|
|
3476
3559
|
labels;
|
|
3477
3560
|
drafts;
|
|
3561
|
+
rules;
|
|
3478
3562
|
/**
|
|
3479
3563
|
* Webhooks API resource
|
|
3480
3564
|
*
|
|
@@ -3662,6 +3746,7 @@ var Sendly = class {
|
|
|
3662
3746
|
this.conversations = new ConversationsResource(this.http);
|
|
3663
3747
|
this.labels = new LabelsResource(this.http);
|
|
3664
3748
|
this.drafts = new DraftsResource(this.http);
|
|
3749
|
+
this.rules = new RulesResource(this.http);
|
|
3665
3750
|
this.webhooks = new WebhooksResource(this.http);
|
|
3666
3751
|
this.account = new AccountResource(this.http);
|
|
3667
3752
|
this.verify = new VerifyResource(this.http);
|