Search.../

listRecipients( )

Developer Preview

Retrieves a list of recipients for a selected campaign based on a specific recipient activity.

Description

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.

This function is not a universal function and runs only on the backend.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function listRecipients(campaignId: string, activity: string, options: ListRecipientsOptions): Promise<ListRecipientsResponse>

listRecipients Parameters

NAME
TYPE
DESCRIPTION
campaignId
string

Campaign ID.

activity
string

Required. Email activity to filter for. One of:

  • 'DELIVERED'
  • 'OPENED'
  • 'CLICKED'
  • 'BOUNCED'
  • 'NOT_SENT'
options
Optional
ListRecipientsOptions

Options to use when getting the list of recipients.

Returns

Return Type:

Promise<
ListRecipientsResponse
>
NAME
TYPE
DESCRIPTION
pagingMetadata
PagingMetadataV2

Details on the paged set of returned results.

recipients
Array<
CampaignRecipientDetails
>

List of recipients.

Was this helpful?

Retrieves a list of recipients for a selected campaign based on a specific recipient activity (dashboard page code)

Copy Code
1import { campaigns } from 'wix-email-marketing.v2';
2
3// Sample campaignId = 'ea46013c-bbbf-4617-ad5d-9247bc4c0970';
4
5// Sample activity = 'OPENED';
6
7// Sample options value:
8// {
9// paging: {
10// cursor: "string",
11// limit: 2,
12// }
13// }
14
15export async function myListRecipientsFunction(campaignId, activity, options) {
16 try {
17 const result = await campaigns.listRecipients(campaignId, activity, options);
18
19 console.log("Success! Recipients found.")
20 return result;
21 } catch (error) {
22 console.error(error);
23 }
24}
25
26/* Promise returns:
27 * {
28 * "recipients": [
29 * {
30 * "contactId": "cbdf2bf6-85fb-4b27-b7e3-deb7601a6d47",
31 * "lastActivityDate": "2023-08-12T09:05:20.000Z"
32 * }
33 * ],
34 * "pagingMetadata": {
35 * "count": 1,
36 * "tooManyToCount": true
37 * }
38 * }
39 */
Retrieves a list of recipients for a selected campaign based on a specific recipient activity (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { campaigns } from 'wix-email-marketing.v2';
3
4export const myListRecipientsFunction = webMethod(Permissions.Anyone, async (campaignId, activity, options) => {
5 try {
6 const result = await campaigns.listRecipients(campaignId, activity, options);
7
8 console.log("Success! Recipients found.")
9 return result;
10 } catch (error) {
11 console.error(error);
12 }
13});
14
15/* Promise returns:
16 * {
17 * "recipients": [
18 * {
19 * "contactId": "cbdf2bf6-85fb-4b27-b7e3-deb7601a6d47",
20 * "lastActivityDate": "2023-08-12T09:05:20.000Z"
21 * }
22 * ],
23 * "pagingMetadata": {
24 * "count": 1,
25 * "tooManyToCount": true
26 * }
27 * }
28 */
29