Website embed code
diff --git a/src/app/components/whatsapp-chatbot/WhatsAppReceptionTab.tsx b/src/app/components/whatsapp-chatbot/WhatsAppReceptionTab.tsx
index b2930f40..001a44dd 100644
--- a/src/app/components/whatsapp-chatbot/WhatsAppReceptionTab.tsx
+++ b/src/app/components/whatsapp-chatbot/WhatsAppReceptionTab.tsx
@@ -11,6 +11,7 @@ import {
} from "../../../services/api";
import type { WhatsAppTemplateRecord } from "../../../services/api/types";
import { useAppNav } from "../../contexts/AppNavContext";
+import { WhatsAppCtaEditor, normalizeCtasForSave, type WhatsAppCtaItem } from "../whatsapp/WhatsAppCtaEditor";
const IS: React.CSSProperties = {
width: "100%",
@@ -57,7 +58,10 @@ function emptyDrip(): ConciergeReceptionDrip {
body: "",
mediaType: "none",
mediaUrl: "",
+ contentKind: "custom",
+ agendaCount: 3,
templateId: "",
+ ctas: [],
};
}
@@ -117,14 +121,37 @@ export function WhatsAppReceptionTab({
const save = async () => {
setSaving(true);
setMsg(null);
+ let dripsPayload: ConciergeReceptionDrip[];
+ try {
+ dripsPayload = (reception.drips || []).map((d) => {
+ const ctas =
+ d.contentKind === "upcoming_agenda" ? [] : normalizeCtasForSave((d.ctas || []) as WhatsAppCtaItem[]);
+ if (ctas.length && !String(d.body || "").trim()) {
+ throw new Error("Drip message text is required when buttons are set.");
+ }
+ return {
+ _id: d._id,
+ trigger: d.trigger,
+ delayMinutes: d.delayMinutes,
+ body: d.body,
+ mediaType: d.contentKind === "upcoming_agenda" ? "none" : d.mediaType,
+ mediaUrl: d.contentKind === "upcoming_agenda" ? "" : d.mediaUrl,
+ contentKind: d.contentKind || "custom",
+ agendaCount: d.agendaCount,
+ templateId: d.templateId || null,
+ sendAt: d.sendAt || null,
+ ctas,
+ };
+ });
+ } catch (e) {
+ setSaving(false);
+ setMsg(e instanceof Error ? e.message : "Invalid buttons");
+ return;
+ }
const res = await conciergeBotsApi.update(bot._id, {
reception: {
...reception,
- drips: (reception.drips || []).map((d) => ({
- ...d,
- templateId: d.templateId || null,
- sendAt: d.sendAt || null,
- })),
+ drips: dripsPayload,
},
});
setSaving(false);
@@ -252,6 +279,11 @@ export function WhatsAppReceptionTab({
Drip messages
+
+ Drips are queued when a visitor messages (or is identified), not when you click Save.
+ If someone already checked in, they need to send another WhatsApp message to pick up a newly added drip.
+ Upcoming agenda drips list the next sessions at send time (not when you save).
+