smartlead-mcp-by-leadmagic
Version:
💜 The Premier Model Context Protocol Server for SmartLead's Cold Email Automation Platform - Complete API coverage with 116+ tools for campaign management, lead tracking, smart delivery, and analytics. Beautiful purple-gradient installer, zero-config set
123 lines • 4.64 kB
JavaScript
/**
* SmartLead MCP Server - Campaign Management Client
*
* Client module for campaign management API endpoints.
* Handles all campaign-related operations including creation, updates, sequences, and analytics.
*
* @author LeadMagic Team
* @version 1.5.0
*/
import { BaseSmartLeadClient } from '../../client/base.js';
/**
* Campaign Management Client
*
* Provides methods for managing SmartLead campaigns including:
* - Creating and updating campaigns
* - Managing campaign schedules and settings
* - Email sequence management
* - Campaign analytics and reporting
*/
export class CampaignManagementClient extends BaseSmartLeadClient {
// ================================
// CAMPAIGN MANAGEMENT METHODS
// ================================
/**
* Create a new campaign
*/
async createCampaign(params) {
const response = await this.withRetry(() => this.apiClient.post('/campaigns/create', params), 'create campaign');
return response.data;
}
/**
* Update campaign schedule
*/
async updateCampaignSchedule(campaignId, params) {
const response = await this.withRetry(() => this.apiClient.post(`/campaigns/${campaignId}/schedule`, params), 'update campaign schedule');
return response.data;
}
/**
* Update campaign settings
*/
async updateCampaignSettings(campaignId, params) {
const response = await this.withRetry(() => this.apiClient.post(`/campaigns/${campaignId}/settings`, params), 'update campaign settings');
return response.data;
}
/**
* Update campaign status
*/
async updateCampaignStatus(campaignId, status) {
const response = await this.withRetry(() => this.apiClient.patch(`/campaigns/${campaignId}/status`, { status }), 'update campaign status');
return response.data;
}
/**
* Get campaign by ID
*/
async getCampaign(campaignId) {
const response = await this.withRetry(() => this.apiClient.get(`/campaigns/${campaignId}`), 'get campaign');
return response.data;
}
/**
* List all campaigns
*/
async listCampaigns(params) {
const response = await this.withRetry(() => this.apiClient.get('/campaigns', { params }), 'list campaigns');
return response.data;
}
/**
* Save campaign sequence
*/
async saveCampaignSequence(campaignId, sequence) {
const response = await this.withRetry(() => this.apiClient.post(`/campaigns/${campaignId}/sequence`, sequence), 'save campaign sequence');
return response.data;
}
/**
* Get campaign sequence
*/
async getCampaignSequence(campaignId) {
const response = await this.withRetry(() => this.apiClient.get(`/campaigns/${campaignId}/sequence`), 'get campaign sequence');
return response.data;
}
/**
* Get campaigns with analytics (combined endpoint)
*/
async getCampaignsWithAnalytics(params) {
const response = await this.withRetry(() => this.apiClient.get('/campaigns/analytics', { params }), 'get campaigns with analytics');
return response.data;
}
/**
* Delete campaign
*/
async deleteCampaign(campaignId) {
const response = await this.withRetry(() => this.apiClient.delete(`/campaigns/${campaignId}`), 'delete campaign');
return response.data;
}
/**
* Export campaign data
*/
async exportCampaignData(campaignId, params) {
const response = await this.withRetry(() => this.apiClient.get(`/campaigns/${campaignId}/export`, { params }), 'export campaign data');
return response.data;
}
/**
* Fetch campaign analytics by date range
*/
async fetchCampaignAnalyticsByDateRange(campaignId, params) {
const response = await this.withRetry(() => this.apiClient.get(`/campaigns/${campaignId}/analytics`, { params }), 'fetch campaign analytics by date range');
return response.data;
}
/**
* Get campaign sequence analytics
*/
async getCampaignSequenceAnalytics(campaignId, params) {
const response = await this.withRetry(() => this.apiClient.get(`/campaigns/${campaignId}/sequence/analytics`, { params }), 'get campaign sequence analytics');
return response.data;
}
/**
* Fetch all campaigns using lead ID
*/
async fetchAllCampaignsUsingLeadId(params) {
const response = await this.withRetry(() => this.apiClient.get('/campaigns/by-lead', { params }), 'fetch all campaigns using lead ID');
return response.data;
}
}
//# sourceMappingURL=client.js.map