> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Flows

## Article: Sample Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/sample-flows.md

## Article Content:

# Audience Service API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. It provides a useful starting point as you plan your implementation.

## Resolve an audience into participants

Suppose you want to notify all contacts with a specific label, such as `VIP`. Before you can send the notification, you need to resolve that audience into the individual contacts it represents.

To resolve an audience into participants:

1. Call [List Audience Providers](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-audience-providers.md), filtering by `participantTypes: ["CONTACT"]` and `scope: "SPECIFIC_SITE"`, to find a provider that can resolve contacts by label.
1. From the response, note the matching provider's `id`, in the format `{appId}_{key}`, and its `inputSchema`, which describes the parameters it needs.
1. Call [List Participants](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-participants.md), passing an audience built from that provider's `id` and the label ID as input data. For example:

    ```json
    {
      "audiences": [
        {
          "audienceProviderId": "74bff718-5977-47f2-9e5f-a9fd0047fd1f_labels",
          "audienceProviderData": {
            "labelIds": ["custom.vip-customer"]
          }
        }
      ]
    }
    ```

1. If the response's `pagingMetadata.hasNext` is `true`, call List Participants again, passing `pagingMetadata.cursors.next` as `paging.cursor`, to retrieve the next page of participants.

## Estimate audience size before resolving participants

Suppose you're building an automation that notifies all contacts with the `VIP` label whenever some trigger occurs. You want to show the estimated size of that audience while the automation is being set up, without resolving the actual participants until the automation runs and the notification is actually sent.

To estimate audience size before resolving participants:

1. Call [List Audience Providers](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-audience-providers.md) and check the matching provider's `implementedMethods.countParticipants` field to see whether it supports counting.
1. Call [Count Participants](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/count-participants.md), passing the same audience you would use to resolve participants. For example:

    ```json
    {
      "audiences": [
        {
          "audienceProviderId": "74bff718-5977-47f2-9e5f-a9fd0047fd1f_labels",
          "audienceProviderData": {
            "labelIds": ["custom.vip-customer"]
          }
        }
      ]
    }
    ```

1. Read the `count` for the audience from the response, and store it with the automation or task definition to show the estimated size until it's run. If the provider doesn't support counting, `count` is `1` instead of an exact number.
1. When the automation's trigger fires, call [List Participants](https://dev.wix.com/docs/api-reference/business-management/notifications/audiences/audience-v1/list-participants.md) with the same audience to resolve the actual participants to notify.