Search.../

deleteCampaign( )

Developer Preview

Permanently deletes a campaign.

Description

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function deleteCampaign(campaignId: string): Promise<void>

deleteCampaign Parameters

NAME
TYPE
DESCRIPTION
campaignId
string

Campaign ID.

Returns

Return Type:

Promise<
void
>

Was this helpful?

Permanently deletes a campaign

Copy Code
1import { campaigns } from 'wix-email-marketing.v2';
2
3// Sample campaignId value: "fb21c999-40b5-4364-8e75-18273da41983";
4
5export async function myDeleteCampaignFunction(campaignId) {
6 try {
7 const result = await campaigns.deleteCampaign(campaignId);
8
9 console.log(`Campaign ${campaignId} successfully deleted`)
10 return result;
11 } catch (error) {
12 console.error(error);
13 }
14}
15
16/* Promise resolves to void */