smartlead-mcp-server
Version:
MCP server for Smartlead campaign management integration. Features include creating campaigns, updating campaign settings, and managing campaign sequences.
119 lines • 4.28 kB
JavaScript
// Type definitions for campaign management
// Type guards
export function isCreateCampaignParams(args) {
return (typeof args === 'object' &&
args !== null &&
'name' in args &&
typeof args.name === 'string');
}
export function isUpdateCampaignScheduleParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isUpdateCampaignSettingsParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isUpdateCampaignStatusParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number' &&
'status' in args &&
typeof args.status === 'string' &&
['PAUSED', 'STOPPED', 'START'].includes(args.status));
}
export function isGetCampaignParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isGetCampaignSequenceParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isListCampaignsParams(args) {
return typeof args === 'object' && args !== null;
}
export function isSaveCampaignSequenceParams(args) {
if (typeof args !== 'object' ||
args === null ||
!('campaign_id' in args) ||
typeof args.campaign_id !== 'number' ||
!('sequence' in args) ||
!Array.isArray(args.sequence)) {
return false;
}
const sequence = args.sequence;
return sequence.every(isValidSequenceItem);
}
// New type guards for the remaining campaign management endpoints
export function isGetCampaignsByLeadParams(args) {
return (typeof args === 'object' &&
args !== null &&
'lead_id' in args &&
typeof args.lead_id === 'number');
}
export function isExportCampaignLeadsParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isDeleteCampaignParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number');
}
export function isGetCampaignAnalyticsByDateParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number' &&
'start_date' in args &&
typeof args.start_date === 'string' &&
'end_date' in args &&
typeof args.end_date === 'string');
}
export function isGetCampaignSequenceAnalyticsParams(args) {
return (typeof args === 'object' &&
args !== null &&
'campaign_id' in args &&
typeof args.campaign_id === 'number' &&
'start_date' in args &&
typeof args.start_date === 'string' &&
'end_date' in args &&
typeof args.end_date === 'string');
}
function isValidSequenceItem(item) {
return (typeof item === 'object' &&
item !== null &&
'seq_number' in item &&
typeof item.seq_number === 'number' &&
'seq_delay_details' in item &&
typeof item.seq_delay_details === 'object' &&
item.seq_delay_details !== null &&
'delay_in_days' in item.seq_delay_details &&
typeof item.seq_delay_details.delay_in_days === 'number' &&
'variant_distribution_type' in item &&
typeof item.variant_distribution_type === 'string' &&
'seq_variants' in item &&
Array.isArray(item.seq_variants) &&
item.seq_variants.every((variant) => typeof variant === 'object' &&
variant !== null &&
'subject' in variant &&
typeof variant.subject === 'string' &&
'email_body' in variant &&
typeof variant.email_body === 'string' &&
'variant_label' in variant &&
typeof variant.variant_label === 'string'));
}
//# sourceMappingURL=campaign.js.map