This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Returns a list of email campaigns.
Default sort by date_updated
in desc
order.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function listCampaigns(
options: ListCampaignsOptions,
): Promise<ListCampaignsResponse>;
Options to use when getting the list of campaigns.
import { campaigns } from "wix-email-marketing.v2";
// 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"
* }
* ]
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.