> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Reuse # Package: emailMarketing # Namespace: CampaignService # Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/reuse-campaign.md ## Permission Scopes: Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING ## Introduction Creates a copy of an existing campaign. --- ## REST API ### Schema ``` Method: reuse Description: Creates a copy of an existing campaign. URL: https://www.wixapis.com/email-marketing/v1/campaigns/{campaignId}/reuse Method: POST Return type: ReuseCampaignResponse - name: campaign | type: Campaign | description: Campaign information. - name: campaignId | type: string | description: Campaign GUID. - name: title | type: string | description: Marketing campaign title. If you don't provide the value, the title automatically gets the value of an email subject. - name: firstImageUrl | type: string | description: URL of the first image after the logo. - name: editorType | type: Enum | description: Editor type. - enum: - UNKNOWN: Unknown editor. This value isn't used. - WEB: Classic web editor. - MOBILE: Classic mobile editor. - MJML: Chat (AI) based web editor. - name: status | type: Enum | description: Campaign status. - enum: - UNKNOWN: Unknown campaign. This value isn't used. - ACTIVE: Campaign is active. - ARCHIVED: Campaign is archived. - DELETED: Campaign is deleted. - name: visibilityStatus | type: Enum | description: Campaign visibility status. - enum: - UNKNOWN: Unknown status. This value isn't used. - DRAFT: Campaign isn't published yet. - PUBLISHED: Campaign is published. - TEMPLATE: Campaign is a template. - name: distributionStatus | type: Enum | description: Campaign distribution status. - enum: - UNKNOWN: Unknown distribution status. - NOT_STARTED: Campaign isn't distributed to recipients yet. - SCHEDULED: Campaign is scheduled for distribution. - IN_DETECTION: Campaign is in screening for malicious content. - IN_MODERATION: Campaign is in review by the site moderators. - SAMPLING: Several recipients are selected for campaign testing, and campaign is sent out to them. - SENDING: Campaign is being sent out to all recipients. - REJECTED: Campaign is rejected. - TERMINATED: Campaign is terminated after a failed sampling test. - DISTRIBUTED: Campaign is fully distributed to all recipients. - PAUSED: Scheduled campaign is paused. - name: publishingData | type: PublishingData | description: Publishing data. The field is returned empty if the campaign isn't published. - name: landingPageUrl | type: string | description: Landing page URL. - name: statistics | type: CampaignStatistics | description: Marketing campaign statistics. - name: landingPage | type: LandingPageStatistics | description: Landing page statistics of a marketing campaign. - name: opened | type: integer | description: Number of times when a landing page was loaded or viewed. - name: clicked | type: integer | description: Number of times a link was clicked in a landing page. - name: emailCampaign | type: DistributionStatistics | description: Email distribution statistics of a marketing campaign. - name: delivered | type: integer | description: Number of delivered emails. - name: opened | type: integer | description: Number of recipients who opened an email. If the same recipient opened the same email twice, it is counted as a one unique open. - name: clicked | type: integer | description: Number of recipients who clicked a link in the email. If the same recipient clicked the same link twice, it is counted as a one unique click. If the same recipient clicked different links, it is counted as a one unique click. - name: bounced | type: integer | description: Number of emails that didn't reach the recipient. - name: complained | type: integer | description: Number of recipients who reported the email as a spam. - name: notSent | type: integer | description: Number of emails that weren't sent due to the campaign termination. - name: total | type: TotalStatistics | description: Combined statistics of landing page and email distribution. - name: mailsSent | type: integer | description: Total number of emails sent. - name: opened | type: integer | description: Number of landing page views and opened emails. - name: clicked | type: integer | description: Number of landing page and email link clicks. - name: datePublished | type: string | description: Marketing campaign publish date. - name: dateCreated | type: string | description: Date and time when the campaign was created. - name: dateUpdated | type: string | description: Date and time when the campaign was updated. ``` ### Examples ### Reuse Campaign ```curl curl -X POST 'https://www.wixapis.com/email-marketing/v1/campaigns/98b5a0b3-549b-4e58-b933-a8bd40923a14/reuse' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.emailMarketing.CampaignService.reuse(campaignId) Description: Creates a copy of an existing campaign. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: campaignId Method parameters: param name: campaignId | type: string | description: GUID of the message to be duplicated. | required: true Return type: PROMISE - name: campaign | type: Campaign | description: Campaign information. - name: campaignId | type: string | description: Campaign GUID. - name: title | type: string | description: Marketing campaign title. If you don't provide the value, the title automatically gets the value of an email subject. - name: firstImageUrl | type: string | description: URL of the first image after the logo. - name: editorType | type: Enum | description: Editor type. - enum: - UNKNOWN: Unknown editor. This value isn't used. - WEB: Classic web editor. - MOBILE: Classic mobile editor. - MJML: Chat (AI) based web editor. - name: status | type: Enum | description: Campaign status. - enum: - UNKNOWN: Unknown campaign. This value isn't used. - ACTIVE: Campaign is active. - ARCHIVED: Campaign is archived. - DELETED: Campaign is deleted. - name: visibilityStatus | type: Enum | description: Campaign visibility status. - enum: - UNKNOWN: Unknown status. This value isn't used. - DRAFT: Campaign isn't published yet. - PUBLISHED: Campaign is published. - TEMPLATE: Campaign is a template. - name: distributionStatus | type: Enum | description: Campaign distribution status. - enum: - UNKNOWN: Unknown distribution status. - NOT_STARTED: Campaign isn't distributed to recipients yet. - SCHEDULED: Campaign is scheduled for distribution. - IN_DETECTION: Campaign is in screening for malicious content. - IN_MODERATION: Campaign is in review by the site moderators. - SAMPLING: Several recipients are selected for campaign testing, and campaign is sent out to them. - SENDING: Campaign is being sent out to all recipients. - REJECTED: Campaign is rejected. - TERMINATED: Campaign is terminated after a failed sampling test. - DISTRIBUTED: Campaign is fully distributed to all recipients. - PAUSED: Scheduled campaign is paused. - name: publishingData | type: PublishingData | description: Publishing data. The field is returned empty if the campaign isn't published. - name: landingPageUrl | type: string | description: Landing page URL. - name: statistics | type: CampaignStatistics | description: Marketing campaign statistics. - name: landingPage | type: LandingPageStatistics | description: Landing page statistics of a marketing campaign. - name: opened | type: integer | description: Number of times when a landing page was loaded or viewed. - name: clicked | type: integer | description: Number of times a link was clicked in a landing page. - name: emailCampaign | type: DistributionStatistics | description: Email distribution statistics of a marketing campaign. - name: delivered | type: integer | description: Number of delivered emails. - name: opened | type: integer | description: Number of recipients who opened an email. If the same recipient opened the same email twice, it is counted as a one unique open. - name: clicked | type: integer | description: Number of recipients who clicked a link in the email. If the same recipient clicked the same link twice, it is counted as a one unique click. If the same recipient clicked different links, it is counted as a one unique click. - name: bounced | type: integer | description: Number of emails that didn't reach the recipient. - name: complained | type: integer | description: Number of recipients who reported the email as a spam. - name: notSent | type: integer | description: Number of emails that weren't sent due to the campaign termination. - name: total | type: TotalStatistics | description: Combined statistics of landing page and email distribution. - name: mailsSent | type: integer | description: Total number of emails sent. - name: opened | type: integer | description: Number of landing page views and opened emails. - name: clicked | type: integer | description: Number of landing page and email link clicks. - name: datePublished | type: Date | description: Marketing campaign publish date. - name: dateCreated | type: Date | description: Date and time when the campaign was created. - name: dateUpdated | type: Date | description: Date and time when the campaign was updated. ``` ### Examples ### Creates a draft copy of an existing campaign with a new title (with elevated permissions) ```javascript import { campaigns } from '@wix/email-marketing'; import { auth } from '@wix/essentials'; const elevatedReuseCampaign = auth.elevate(campaigns.reuseCampaign); // Sample campaignId = "cc332004-418c-496b-a870-c086790c149d"; export async function myReuseCampaignFunction(campaignId) { try { const result = await elevatedReuseCampaign(campaignId); const updatedTitle = 'Summer Special'; if (result.campaign.title === 'Announcing a Special Offer') { result.campaign.title = updatedTitle; } console.log(`Success! Your campaign with id: ${campaignId} has been reused with an updated title: ${updatedTitle}`) return result; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "campaign": { * "campaignId": "dbdb53d6-c9a8-4475-8aff-f43ca2fdf8c1", * "title": "Summer Special", * "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" * } * } */ ``` ### Creates a draft copy of an existing campaign with a new title ```javascript import { campaigns } from '@wix/email-marketing'; // Sample campaignId = "cc332004-418c-496b-a870-c086790c149d"; export async function myReuseCampaignFunction(campaignId) { try { const result = await campaigns.reuseCampaign(campaignId); const updatedTitle = 'Summer Special'; if (result.campaign.title === 'Announcing a Special Offer') { result.campaign.title = updatedTitle; } console.log(`Success! Your campaign with id: ${campaignId} has been reused with an updated title: ${updatedTitle}`) return result; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "campaign": { * "campaignId": "dbdb53d6-c9a8-4475-8aff-f43ca2fdf8c1", * "title": "Summer Special", * "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" * } * } */ ``` ### Creates a draft copy of an existing campaign (with elevated permissions) ```javascript import { campaigns } from '@wix/email-marketing'; import { auth } from '@wix/essentials'; const elevatedReuseCampaign = auth.elevate(campaigns.reuseCampaign); // Sample campaignId = "cc332004-418c-496b-a870-c086790c149d"; export async function myReuseCampaignFunction(campaignId) { try { const result = await elevatedReuseCampaign(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" * } * } */ ``` ### Creates a draft copy of an existing campaign ```javascript import { campaigns } from '@wix/email-marketing'; // 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" * } * } */ ``` ### reuseCampaign (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { campaigns } from '@wix/email-marketing'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { campaigns }, // Include the auth strategy and host as relevant }); async function reuseCampaign(campaignId) { const response = await myWixClient.campaigns.reuseCampaign(campaignId); }; ``` ---