About Campaigns

The Campaigns API provides functionality for managing your email marketing campaigns.

With the Campaigns API you can:

Was this helpful?
Yes
No

Setup

To use the Campaigns API, install the @wix/email-marketing package using npm or Yarn:

Copy
1
npm install @wix/email-marketing

or

Copy
1
yarn add @wix/email-marketing

Then import { campaigns } from @wix/email-marketing:

Copy
1
import { campaigns } from '@wix/email-marketing'
Was this helpful?
Yes
No

deleteCampaign( )

Developer Preview

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

Permanently deletes a campaign.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function deleteCampaign(campaignId: string): Promise<void>
Method Parameters
campaignIdstringRequired
Campaign ID.
Was this helpful?
Yes
No

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.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
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>
Was this helpful?
Yes
No

listCampaigns( )

Developer Preview

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.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function listCampaigns(options: ListCampaignsOptions): Promise<ListCampaignsResponse>
Method Parameters
optionsListCampaignsOptions
Options to use when getting the list of campaigns.
Returns
Return Type:Promise<ListCampaignsResponse>
Was this helpful?
Yes
No

listRecipients( )

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 a list of recipients for a selected campaign based on a specific recipient activity.

Pages are returned with a maximum of 1,000 recipients per page and defaults to 40 recipients per page.

Use List Statistics to retrieve a list of activity for selected campaigns. Use List Campaigns to retrieve additional information for your campaigns.

If no activity is included, this endpoint returns an error.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Email Marketing
Manage Email Marketing
Learn more about permission scopes.
Copy
function listRecipients(campaignId: string, activity: RecipientsActivityEnum, options: ListRecipientsOptions): Promise<ListRecipientsResponse>
Method Parameters
campaignIdstringRequired
Campaign ID.

activityRecipientsActivityEnumRequired
8 enum supported values:
BOUNCEDCLICKEDDELIVEREDNOT_OPENEDNOT_SENTOPENEDSENTUNKNOWN
Required. Email activity to filter for. One of:
  • 'DELIVERED'
  • 'OPENED'
  • 'CLICKED'
  • 'BOUNCED'
  • 'NOT_SENT'

optionsListRecipientsOptions
Options to use when getting the list of recipients.
Returns
Return Type:Promise<ListRecipientsResponse>
Was this helpful?
Yes
No

listStatistics( )

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 a list of statistics for up to 100 selected campaigns.

For each campaign, you receive the total activity count for the campaign's landing page and email. For example, the total amount of times the landing page was opened, or the total amount of email recipients that clicked a link in an email.

Use List Campaigns to retrieve additional information for your campaigns. Use List Recipients to retrieve a list of recipients and their activities related to a selected campaign.

Permission Scopes

For app development, you must have one of the following permission scopes:
Read Email Marketing
Manage Email Marketing
Learn more about permission scopes.
Copy
function listStatistics(campaignIds: Array<string>): Promise<ListStatisticsResponse>
Method Parameters
campaignIdsArray<string>Required
IDs of the campaigns to retrieve (max 100 campaigns).
Returns
Return Type:Promise<ListStatisticsResponse>
Was this helpful?
Yes
No

pauseScheduling( )

Developer Preview

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

Pauses a scheduled campaign.

Learn more about market campaign scheduling.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function pauseScheduling(campaignId: string): Promise<void>
Method Parameters
campaignIdstringRequired
Campaign ID.
Was this helpful?
Yes
No

publishCampaign( )

Developer Preview

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

Publishes/sends a specified campaign.

If no emailDistributionOptions parameters are specified, the campaign is only published as a landing page.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function publishCampaign(campaignId: string, options: PublishCampaignOptions): Promise<PublishCampaignResponse>
Method Parameters
campaignIdstringRequired
Campaign ID

optionsPublishCampaignOptions
Options to use when publishing a campaign.
Returns
Return Type:Promise<PublishCampaignResponse>
Was this helpful?
Yes
No

reschedule( )

Developer Preview

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

Change sending time for already scheduled campaign.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function reschedule(campaignId: string, sendAt: ): Promise<void>
Method Parameters
campaignIdstringRequired
ID of the campaign to reschedule.

sendAtDateRequired
New time that this email marketing campaign should be sent at.
Was this helpful?
Yes
No

reuseCampaign( )

Developer Preview

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.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function reuseCampaign(campaignId: string): Promise<ReuseCampaignResponse>
Method Parameters
campaignIdstringRequired
ID of the message to be duplicated.
Returns
Return Type:Promise<ReuseCampaignResponse>
Was this helpful?
Yes
No

sendTest( )

Developer Preview

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

Sends a test email for preview purposes.

It is heavily throttled, so don't use this for regular campaign sending.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Email Marketing
Learn more about permission scopes.
Copy
function sendTest(campaignId: string, options: SendTestOptions): Promise<void>
Method Parameters
campaignIdstringRequired
Campaign ID.

optionsSendTestOptions
Options for sending a test email.
Was this helpful?
Yes
No