listCampaigns( )


Returns a list of email campaigns.

By default sorts by the dateUpdated field in the DESC order.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Access Verticals by Automations
Set Up Automations
Manage Email Marketing
Read Email Marketing
Learn more about app permissions.
Method Declaration
Copy
function listCampaigns(
  options: ListCampaignsOptions,
): Promise<ListCampaignsResponse>;
Method Parameters
optionsListCampaignsOptions

Options to use when getting the list of campaigns.

Returns
Return Type:Promise<ListCampaignsResponse>
JavaScript
import { campaigns } from "@wix/email-marketing"; // Sample options value: // { // paging: { // limit: 2, // offset: 0 // } // } export async function myListCampaignsFunction(options) { try { const results = await campaigns.listCampaigns(options); console.log("Success! Retrieved results:", results); return results; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "campaigns": [ * { * "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", * "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" * }, * { * "campaignId": "fb21c999-40b5-4364-8e75-18273da41983", * "title": "What did we do last month?", * "firstImageUrl": "https://static.wixstatic.com/media/eceb8e_e65cd7284b4c4144a4fb8b2f3ce30a68~mv2_d_2000_1334_s_2.png", * "editorType": "WEB", * "status": "ACTIVE", * "visibilityStatus": "PUBLISHED", * "distributionStatus": "DISTRIBUTED", * "publishingData": { * "landingPageUrl": "https://shoutout.wix.com/so/83OdQ8pDA?languageTag=en", * "datePublished": "2023-08-10T09:25:15.000Z", * "wasResentToNonOpeners": false * }, * "dateCreated": "2023-08-09T11:51:27.000Z", * "dateUpdated": "2023-08-10T09:25:14.952Z", * "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?