Skip to main content

Marketing

The application contributes metadata. The platform owns campaigns, delivery, and analytics.

Register

app.marketing({
version: 1,
audiences: [
{
id: 'vip_guests',
label: 'VIP guests',
source: 'customer_hub',
customerHub: { tags: ['vip'], consentPurpose: 'marketing' },
},
{
id: 'inactive_customers',
label: 'Inactive customers',
source: 'app_query',
appQuery: { tool: 'restaurant.listInactiveCustomers', input: { days: 30 } },
},
],
variables: [
{ id: 'guest_name', label: 'Guest name', type: 'string', source: 'customer_hub', path: 'display_name', required: true },
{ id: 'offer_title', label: 'Offer title', type: 'string', source: 'campaign', required: true },
],
actions: [
{ id: 'book_table', label: 'Book a table', kind: 'whatsapp_cta', landingPageId: 'booking', urlTemplate: '{{booking_url}}' },
],
landingPages: [
{ id: 'booking', label: 'Booking', path: '/booking', host: 'app' },
],
channels: [
{ id: 'whatsapp', enabled: true },
],
});

Call once per process (marketing() may only be called once).

Field reference

ConceptAllowed values (SDK)
Audience sourcecustomer_hub, app_query, static_filter
Variable typestring, number, datetime, boolean, url, currency
Variable sourcecustomer_hub, app_context, campaign, literal
Action kindurl, deep_link, quick_reply, whatsapp_cta, postback
Landing hostapp, platform
Channel idwhatsapp, email, website_widget, or custom string

provider on channels is reserved (multi-provider) — not implemented in Phase 1.

Runtime client

getRegistration(): Promise<Record<string, unknown> | null>

Not confirmed on ToolContext: handlers do not receive ctx.marketing in 1.7.0 — only app.marketing({…}) metadata plus the optional exported buildMarketingContext helper. Gated by QEFRO_MARKETING_ENABLED. Audience resolve / campaigns = platform Phase 2+.

Sync

Managed installs: solution-service refreshes marketing registration after install/upgrade via capabilities.list (best-effort).

Ownership boundary

AppPlatform
Audience definitionsCampaign creation
Variables / CTAs / landing metadataWhatsApp/email delivery
app_query tools that resolve audiencesAnalytics