About Campaigns
The Campaigns API provides functionality for managing your email marketing campaigns.
With the Campaigns API you can:
- Get or list email campaigns.
- Create a draft copy of an existing campaign.
- Permanently delete a campaign.
- List statistics and list recipients of campaigns.
- Pause a scheduled campaign.
- Publish a campaign or send a test email.
Setup
To use the Campaigns API, install the @wix/email-marketing
package using npm or Yarn:
1npm install @wix/email-marketing
or
1yarn add @wix/email-marketing
Then import { campaigns }
from @wix/email-marketing
:
1import { campaigns } from '@wix/email-marketing'
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:function deleteCampaign(campaignId: string): Promise<void>
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:function getCampaign(campaignId: string, options: GetCampaignOptions): Promise<Campaign>
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:function listCampaigns(options: ListCampaignsOptions): Promise<ListCampaignsResponse>
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:function listRecipients(campaignId: string, activity: RecipientsActivityEnum, options: ListRecipientsOptions): Promise<ListRecipientsResponse>
- 'DELIVERED'
- 'OPENED'
- 'CLICKED'
- 'BOUNCED'
- 'NOT_SENT'
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:function listStatistics(campaignIds: Array<string>): Promise<ListStatisticsResponse>
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:function pauseScheduling(campaignId: string): Promise<void>
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:function publishCampaign(campaignId: string, options: PublishCampaignOptions): Promise<PublishCampaignResponse>
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:function reschedule(campaignId: string, sendAt: ): Promise<void>
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:function reuseCampaign(campaignId: string): Promise<ReuseCampaignResponse>
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:function sendTest(campaignId: string, options: SendTestOptions): Promise<void>