Yawnder SMS Updates & Customer Care
Get text updates about your Yawnder order — confirmations, delivery scheduling, ETA, and customer-care replies. Transactional only. No marketing.
What you’ll receive
- Order confirmations
- Delivery scheduling and ETA updates
- Out-for-delivery and delivered notifications
- Financing application status
- Showroom appointment confirmations
- Warranty / return support and replies to your questions
Opt in to Yawnder text updates
`.trim();
const META_DESC = “Opt in to Yawnder transactional SMS: order confirmations, delivery scheduling, ETA updates, and customer-care replies. Reply STOP to opt out, HELP for help.”;
const PRIVACY_SMS_HTML = `
SMS / Mobile Information
Yawnder sends transactional SMS messages (order confirmations, shipping, delivery scheduling and ETAs, and customer service replies) to customers who have opted in. Customers opt in by (1) providing a mobile number at in-store checkout at our Encinitas showroom, (2) entering a mobile number and checking the SMS consent box at online checkout on yawnder.com, or (3) checking the SMS consent box on the opt-in form at yawnder.com/sms/ or other website lead forms. The consent checkbox is unchecked by default.
No mobile information will be shared with third parties or affiliates for marketing or promotional purposes. Information sharing with subcontractors who support the service (such as delivery and customer service vendors) is permitted. Mobile opt-in data and consent is never shared with any third party.
Message frequency varies based on order activity. Message and data rates may apply. Reply HELP for help, STOP to opt out at any time. See our SMS Terms.
`.trim();
async function upsertSmsPage() {
const lookup = await fetch(“https://yawnder.com/wp-json/wp/v2/pages?slug=sms&context=edit”, { headers: authHeaders() });
const existing = await lookup.json();
const id = Array.isArray(existing) && existing.length ? existing[0].id : null;
const payload = {
title: “SMS Updates & Customer Care”,
slug: “sms”,
status: “publish”,
content: PAGE_HTML,
meta: {
rank_math_title: “SMS Updates & Customer Care | Yawnder”,
rank_math_description: META_DESC,
rank_math_robots: [“index”, “follow”],
},
};
const url = id ? `https://yawnder.com/wp-json/wp/v2/pages/${id}` : “https://yawnder.com/wp-json/wp/v2/pages”;
const res = await fetch(url, { method: “POST”, headers: authHeaders(), body: JSON.stringify(payload) });
const body = await res.json();
return { ok: res.ok, action: id ? “updated” : “created”, id: body.id || id, link: body.link, status: res.status };
}
async function patchPrivacy() {
const r = await fetch(“https://yawnder.com/wp-json/wp/v2/pages/4160?context=edit&_fields=content”, { headers: authHeaders() });
const page = await r.json();
const raw: string = page?.content?.raw ?? “”;
if (!raw) return { ok: false, error: “no content” };
if (raw.includes(“yawnder-sms-privacy”)) {
return { ok: true, skipped: “already-present” };
}
const newContent = raw + “\n\n” + PRIVACY_SMS_HTML + “\n”;
const upd = await fetch(“https://yawnder.com/wp-json/wp/v2/pages/4160”, {
method: “POST”, headers: authHeaders(), body: JSON.stringify({ content: newContent }),
});
return { ok: upd.ok, status: upd.status, appended: true };
}
Deno.serve(async (req) => {
if (req.method === “OPTIONS”) return new Response(null, { headers: corsHeaders });
const _denied = await requireStaff(req);
if (_denied) return _denied;
try {
const sms = await upsertSmsPage();
const privacy = await patchPrivacy();
return new Response(JSON.stringify({ sms, privacy }), {
headers: { …corsHeaders, “Content-Type”: “application/json” },
status: 200,
});
} catch (err) {
return new Response(JSON.stringify({ ok: false, error: String(err) }), {
headers: { …corsHeaders, “Content-Type”: “application/json” },
status: 500,
});
}
});