getCampaign( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves information about an email campaign by the specified ID.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Email Marketing
Learn more about app permissions.
Method Declaration
Copy
function getCampaign(
  campaignId: string,
  options: GetCampaignOptions,
): Promise<Campaign>;
Method Parameters
campaignIdstringRequired

Campaign ID.


optionsGetCampaignOptions

Options to use when getting a campaign.

Returns
Return Type:Promise<Campaign>
JavaScript
import { campaigns } from "wix-email-marketing.v2"; // Sample campaignId value: 'ff61204b-b19a-5cc8-823b-7eed8ae5fc28' // Sample options value: // { // optionIncludeStatistics: true, // } export async function myGetCampaignFunction(campaignId, options) { try { const result = campaigns.getCampaign(campaignId, options); console.log("Success! Retrieved results:", result); return result; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "campaign":{ * "campaignId": "b98a4436-10f5-47bd-9c6f-370962adfe54", * "title": "A New Tutorial for You", * "firstImageUrl": "https://static.wixstatic.com/media/6191b8_77d27f7d028a4b50850b7f92dadcd578~mv2.png", * "editorType": "WEB", * "status": "ACTIVE", * "visibilityStatus": "PUBLISHED", * "distributionStatus": "DISTRIBUTED", * "publishingData": { * "landingPageUrl": "https://shoutout.wix.com/so/54OdUqUrf?languageTag=en", * "statistics": { * "landingPage": { * "opened": 150, * "clicked": 80 * }, * "emailCampaign": { * "delivered": 700, * "opened": 200, * "clicked": 0, * "bounced": 0, * "complained": 0, * "notSent": 0 * }, * "total": { * "mailsSent": 1, * "opened": 200, * "clicked": 500 * } * }, * "datePublished": "2023-08-10T09:40:59.000Z", * "wasResentToNonOpeners": false * }, * "dateCreated": "2023-08-10T09:40:47.000Z", * "dateUpdated": "2023-08-10T09:40:59.045Z", * "sendingState": "SENT", * "campaignType": "EMAIL_MARKETING" * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?