This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a confirmed marketing consent with a state
of CONFIRMED
.
Required fields:
details.type
.details.email
OR details.phone
.lastConfirmationActivity
.To create a marketing consent with a different state, use Upsert Marketing Consent, or Bulk Upsert Marketing Consent.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function createMarketingConsent(
marketingConsent: MarketingConsent,
): Promise<MarketingConsent>;
Marketing consent to create.
import { marketingConsent } from "wix-marketing.v2";
async function createMarketingConsent(marketingConsent) {
try {
const result =
await marketingConsent.createMarketingConsent(marketingConsent);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.