This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a (draft) copy of an existing campaign.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function reuseCampaign(campaignId: string): Promise<ReuseCampaignResponse>;
ID of the message to be duplicated.
import { campaigns } from "wix-email-marketing.v2";
// Sample campaignId = "cc332004-418c-496b-a870-c086790c149d";
export async function myReuseCampaignFunction(campaignId) {
try {
const result = await campaigns.reuseCampaign(campaignId);
console.log("Success! Your campaign has been reused.");
return result;
} catch (error) {
console.error(error);
}
}
/* Promise resolves to:
* {
* "campaign": {
* "campaignId": "cc332004-418c-496b-a870-c086790c149d",
* "title": "Announcing a Special Offer",
* "firstImageUrl": "https://static.wixstatic.com/media/eceb8e_07a78e49568947ffa34fd4983cdd94ae~mv2.png",
* "editorType": "WEB",
* "status": "ACTIVE",
* "visibilityStatus": "DRAFT",
* "distributionStatus": "NOT_STARTED",
* "dateCreated": "2023-08-13T05:15:32.000Z",
* "dateUpdated": "2023-08-13T05:15:32.868Z",
* "sendingState": "DRAFT",
* "campaignType": "EMAIL_MARKETING"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.