smartlead_delete_campaign_webhook
Remove a specific webhook from an email marketing campaign to stop receiving automated notifications or data updates for that campaign.
Instructions
Delete a specific webhook from a campaign.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes | ID of the campaign containing the webhook | |
| id | Yes | ID of the webhook to delete |
Implementation Reference
- src/handlers/webhooks.ts:139-182 (handler)The core handler function that validates input, calls the SmartLead API to delete the specified webhook from a campaign, and returns the response or error.async function handleDeleteCampaignWebhook( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isDeleteCampaignWebhookParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_delete_campaign_webhook' ); } try { const smartLeadClient = createSmartLeadClient(apiClient); const { campaign_id, id } = args; // The API documentation suggests a DELETE with a body payload // Different from typical REST practices but following the API spec const response = await withRetry( async () => smartLeadClient.delete(`/campaigns/${campaign_id}/webhooks`, { data: { id } }), 'delete campaign webhook' ); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], isError: false, }; } catch (error: any) { return { content: [{ type: 'text', text: `API Error: ${error.response?.data?.message || error.message}` }], isError: true, }; } }
- src/tools/webhooks.ts:63-81 (schema)Tool definition with name, description, category, and JSON schema for input parameters.export const DELETE_CAMPAIGN_WEBHOOK_TOOL: CategoryTool = { name: 'smartlead_delete_campaign_webhook', description: 'Delete a specific webhook from a campaign.', category: ToolCategory.WEBHOOKS, inputSchema: { type: 'object', properties: { campaign_id: { type: 'string', description: 'ID of the campaign containing the webhook', }, id: { type: 'integer', description: 'ID of the webhook to delete', }, }, required: ['campaign_id', 'id'], }, };
- src/index.ts:222-224 (registration)Registers all webhook tools, including 'smartlead_delete_campaign_webhook', into the MCP tool registry if the webhooks category is enabled by license.if (enabledCategories.webhooks) { toolRegistry.registerMany(webhookTools); }
- src/types/webhooks.ts:80-89 (schema)Runtime type guard function for validating input parameters against the DeleteCampaignWebhookParams interface.export function isDeleteCampaignWebhookParams(args: unknown): args is DeleteCampaignWebhookParams { return ( typeof args === 'object' && args !== null && 'campaign_id' in args && typeof (args as DeleteCampaignWebhookParams).campaign_id === 'string' && 'id' in args && typeof (args as DeleteCampaignWebhookParams).id === 'number' ); }
- src/handlers/webhooks.ts:28-30 (handler)Switch case in the webhook tool dispatcher that routes calls to the specific delete handler function.case 'smartlead_delete_campaign_webhook': { return handleDeleteCampaignWebhook(args, apiClient, withRetry); }