Guides setup and extension of the CrestApps Orchard Core Marketing module for customer segments, Liquid email campaigns, purchase tracking, and checkout coupon pairing.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate accurate setup and extension guidance for the CrestApps Marketing module, which keeps what each customer has bought, groups customers into segments, and sends Liquid email campaigns to a segment's customers who accept marketing.
CrestApps.OrchardCore.Marketing (or the CrestApps.OrchardCore.Cms.Core.Targets bundle) in the web/startup project.CrestApps.OrchardCore.Marketing. It depends on CrestApps.OrchardCore.Commerce, CrestApps.OrchardCore.Customers, CrestApps.OrchardCore.Orders, Orchard Core Email (OrchardCore.Email) and Outreach (CrestApps.OrchardCore.Outreach) (see orchardcore-customers for Customer.AcceptsMarketing).OrchardCore.Email with SMTP or Azure) and set the site's Base URL. Sending needs both.Active, accept marketing and have an email are sent to. Do not bypass this in custom code.CrestApps.OrchardCore.Checkout); see orchardcore-checkout. Campaigns carry their codes.orchardcore-orders and orchardcore-carts; the shared Commerce menu and storefront account by orchardcore-commerce.{ "steps": [...] }.sealed modifier, except View Models.| Item | Value |
|---|---|
| Feature ID | CrestApps.OrchardCore.Marketing |
| YesSql collection | Marketing |
| Records | CustomerPurchases (CustomerPurchasesIndex), Segment (SegmentIndex), Campaign (CampaignIndex), PurchasesBackfill |
| Stores | ICustomerPurchasesStore, ISegmentStore, ICampaignStore |
| Services | CustomerPurchasesService (RecordAsync, BackfillAsync), CampaignService (CanSendAsync, RenderAsync, SendTestAsync, StartSendingAsync, CancelAsync, CountAsync) |
| Order seam filled | IOrderEventHandler (CustomerPurchasesOrderHandler) |
| Background task | MarketingBackgroundTask (every minute) |
| Unsubscribe | GET and POST marketing/unsubscribe?token= (MarketingUnsubscribe route and shape) |
| Permission | ManageMarketing (Administrator, Store manager, Marketing) |
| Admin | Commerce > Segments (marketing/segments), Commerce > Campaigns (marketing/campaigns) on the AdminList standard |
{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Email",
"CrestApps.OrchardCore.Customers",
"CrestApps.OrchardCore.Orders",
"CrestApps.OrchardCore.Marketing"
],
"disable": []
}
]
}
CustomerPurchases (its id is the customer's) holds OrderCount, TotalSpent (paid orders less refunds, in the store currency, converted with IShopperCurrency), FirstOrderUtc, LastOrderUtc, Country (the last order's billing or shipping country), and OrderIds and RefundIds that make recording idempotent.
CustomerPurchasesOrderHandler calls CustomerPurchasesService.RecordAsync when an order is paid or refunded.MarketingBackgroundTask backfills orders paid before the feature was enabled, 200 per run, newest first, tracking progress in PurchasesBackfill.Segment has a Name, Description and SegmentRules. Every rule given must hold, on customers with at least one order.
| Rule | Meaning |
|---|---|
MinOrders, MaxOrders | Order count range |
MinSpent, MaxSpent | Lifetime spend range in the store currency |
LastOrderAtLeastDaysAgo | Lapsed buyers |
LastOrderWithinDays | Recent buyers |
FirstOrderWithinDays | New customers |
Country | Last order's country |
ICustomerPurchasesStore.ListAsync(rules, utcNow, afterId, take) pages a segment by document id, so customers added while a campaign sends come after the cursor. CountAsync counts a segment; the segment editor shows its customers and how many accept marketing (up to 10,000).
Campaign holds Name, SegmentId, Subject and Body (Liquid), Status (Draft, Scheduled, Sending, Sent, Canceled), ScheduledUtc, the Cursor, and Sent, Skipped and Failed counts.
Liquid values:
| Value | Content |
|---|---|
Customer | CampaignCustomer: FirstName, LastName, Name, Email, OrderCount, TotalSpent, LastOrderUtc |
StoreName | The site's name |
UnsubscribeUrl | The customer's own unsubscribe link. One is appended when the body has none |
<p>Hi {{ Customer.FirstName }},</p>
<p>It has been a while since your last order at {{ StoreName }}.
Use <strong>COMEBACK15</strong> for 15% off your next order.</p>
<p><a href="{{ UnsubscribeUrl }}">Unsubscribe</a></p>
Campaigns are sent by the Outreach engine. MarketingBackgroundTask starts a scheduled campaign when ScheduledUtc passes, and CampaignService.StartSendingAsync hands it to the engine as an outreach run (Campaign.OutreachRunId): the MarketingSegment audience source pages the segment 50 customers at a time from the cursor (skipping customers who are not Active, do not accept marketing or have no email), the engine checks consent (Email, as a Customer) before each email so a mid-run unsubscribe stops it, the MarketingCampaign renderer adds the unsubscribe link, and the Email sender sends HTML plus a text part. The run's counts and cursor are copied back; the campaign is Sent when the run completes, or Canceled when a batch keeps failing (for example the Base URL was removed). Canceling a campaign stops its run, and a campaign half sent before the engine resumes at its cursor. Until a default email provider is configured, CanSendAsync is false and the editor says so instead of queuing. The campaign editor's test send renders the message as the segment's first customer would get it.
The Marketing segments and campaigns deployment step (Commerce) writes a MarketingSegments step, then a MarketingCampaigns step. Both match by ItemId and are validated like their editors. A recipe never sends email: a campaign is exported without its delivery state, a new campaign always imports as a draft, and a campaign scheduled or sending on the site is left alone.
{
"steps": [
{
"name": "MarketingSegments",
"Segments": [
{ "ItemId": "4sg00000000000000000000001", "Name": "Lapsed buyers", "Rules": { "MinOrders": 1, "LastOrderAtLeastDaysAgo": 180 } }
]
},
{
"name": "MarketingCampaigns",
"Campaigns": [
{ "ItemId": "4cp00000000000000000000001", "Name": "Win back", "SegmentId": "4sg00000000000000000000001", "Subject": "We miss you", "Body": "Come back for 10% off." }
]
}
]
}
UnsubscribeController serves marketing/unsubscribe?token=. The token is the customer id protected by a time-limited data protector (400 days). A POST turns AcceptsMarketing off and needs no antiforgery token, so mail apps' one-click unsubscribe works.
Discount codes come from Checkout's coupon catalog (orchardcore-checkout), which applies discounts before tax and spreads them across item lines so each line is taxed on what the buyer pays. Useful pairings with a campaign:
MaxRedemptionsPerCustomer 1 and an end date, typed into the campaign body.ICouponStore.GenerateCodesAsync), exported as CSV from the coupon admin, for one code per recipient.GET discount/{code}?redirect=/shop in the body, which stores the code in a cookie and applies it at checkout.CustomerEmail or CustomerId.Ship coupons between sites with Checkout's Coupons recipe step:
{
"steps": [
{
"name": "Coupons",
"Coupons": [
{ "Code": "COMEBACK15", "Description": "Lapsed buyer campaign", "Kind": "Percentage", "Percentage": 15, "MaxRedemptionsPerCustomer": 1, "EndsUtc": "2027-03-01T00:00:00Z", "IsEnabled": true }
]
}
]
}
orchardcore-reports).orchardcore-reviews).MarketingBackgroundTask reports on the shared crestapps.background_task.* instruments (CrestApps.OrchardCore.Platform meter): items started and not_started per campaign, and skipped when the site has no base URL. The sends themselves run through Outreach (orchardcore-outreach).
| Symptom | Check |
|---|---|
Campaign cannot be sent, or ends Canceled | Configure a default Orchard Core email provider and the site Base URL; check the outreach run |
| Segment counts zero | Purchases are still backfilling (200 orders a minute), or no customer matches every rule |
| Many customers skipped | They are not Active, do not accept marketing, or have no email |
| Unsubscribe link fails | The token is older than 400 days, or the link was altered |
| A code in the campaign is refused | Check the coupon's dates, limits, scope and currency in Commerce > Coupons |
What SKILL.md sets; muted values are Claude Code's defaults
/crestapps-orchardcore:orchardcore-marketingfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job