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
4// Sample campaignId = 'ea46013c-bbbf-4617-ad5d-9247bc4c0970';
5
6// Sample activity = 'OPENED';
7
8// Sample options value:
9// {
10// paging: {
11// cursor: "string",
12// limit: 2,
13// }
14// }
15
16export const myListRecipientsFunction = webMethod(Permissions.Anyone, async (campaignId, activity, options) => {
17 try {
18 const result = await campaigns.listRecipients(campaignId, activity, options);
19
20 console.log("Success! Recipients found.")
21 return result;
22 } catch (error) {
23 console.error(error);
24 }
25});
26
27/* Promise returns:
28 * {
29 * "recipients": [
30 * {
31 * "contactId": "cbdf2bf6-85fb-4b27-b7e3-deb7601a6d47",
32 * "lastActivityDate": "2023-08-12T09:05:20.000Z"
33 * }
34 * ],
35 * "pagingMetadata": {
36 * "count": 1,
37 * "tooManyToCount": true
38 * }
39 * }
40 */
41