> 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/marketing/marketing-plan/sample-flows.md

## Article Content:

# Marketing Plan 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.

## Generate a marketing plan and publish its posts

The core flow: generate a plan for a site, then schedule its posts for publishing.

> **Prerequisite:** The site must be published, and the social channels you want to publish to must be connected through the Publisher API.

To generate a plan and publish its posts:

1. Call [Generate Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/generate-marketing-plan.md). The response returns a `status` of `GENERATING`.
1. Poll [Get Social Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/get-social-marketing-plan.md) until `status` is `ACTIVE`. The response contains the plan's `marketingActivities`, and the near-term activities already include generated posts in their `items`.
1. Collect the IDs of the `items` whose `status` is `DRAFT` from the activities you want to publish.
1. Call [Schedule Drafts](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/schedule-drafts.md) with those IDs to schedule the posts for publishing. Note that `ScheduleDrafts` only schedules drafts for channels the site has connected through the Publisher; drafts for unconnected channels are left as drafts.

## Tailor the plan with marketing settings

Before generating, configure the site's marketing preferences so the AI produces a plan that matches the brand's goal, voice, and channels.

To tailor and generate a plan:

1. Optionally, call [Get Plan Goal Options](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-settings-v1/get-plan-goal-options.md) and [Get Point Of View Options](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-settings-v1/get-point-of-view-options.md) to retrieve the selectable values for those settings.
1. Call [Upsert Marketing Settings](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-settings-v1/upsert-marketing-settings.md) with the chosen goal, social channels, point of view, posting frequency, and other preferences.
1. Call [Generate Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/generate-marketing-plan.md). The response returns a `status` of `GENERATING`.
1. Poll [Get Social Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/get-social-marketing-plan.md) until `status` is `ACTIVE`. The generated activities and posts reflect the configured settings.

## Plan around a custom calendar event

Add an event, such as a seasonal sale or product launch, so the AI builds activities around it.

To plan around an event:

1. Call [Create Event](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/calendar-event-v1/create-event.md) with the event's name and date. For a repeating event, set a recurring rule instead of a date.
1. Call [Generate Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/generate-marketing-plan.md), or [Regenerate Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/regenerate-marketing-plan.md) if the site already has a plan. The response returns a `status` of `GENERATING`.
1. Poll [Get Social Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/get-social-marketing-plan.md) until `status` is `ACTIVE`. The plan's activities account for the event.

## Generate and schedule posts for more activities

When a plan is generated, posts are created automatically only for the near-term activities. Use this flow to generate posts for the remaining activities and schedule them.

To generate and schedule more posts:

1. Call [Get Social Marketing Plan](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/get-social-marketing-plan.md) and note the IDs of the activities that don't yet have posts.
1. Call [Generate Social Posts](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/generate-social-posts.md) with those activity IDs. The response returns immediately while generation continues in the background.
1. Poll [Get Marketing Activity Posts](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/get-marketing-activity-posts.md) for those activities until the posts appear.
1. Collect the IDs of the `items` whose `status` is `DRAFT`.
1. Call [Schedule Drafts](https://dev.wix.com/docs/api-reference/business-management/marketing/marketing-plan/marketing-plan-v1/schedule-drafts.md) with those IDs to schedule them for publishing. Note that `ScheduleDrafts` only schedules drafts for channels the site has connected through the Publisher; drafts for unconnected channels are left as drafts.