Premium support portal for:
This version uses a Cloudflare Worker Custom Domain. The Worker is the origin for the complete support.afmarbre.com hostname, while afmarbre.com remains your existing WordPress site.
- Moved from
afmarbre.com/supporttosupport.afmarbre.com - Changed the Wrangler configuration from a Worker Route to a Custom Domain
- Redesigned the page around A-F Marbre's premium marble / natural-stone visual language
- Uses an A-F Marbre site image for the hero
- Uses the main afmarbre.com favicon/site icon for browser tabs and Apple home-screen bookmarks
- Uses the exact showroom map link from the current contact page
- Added polished desktop + mobile layouts
- Includes a prominent link to the A-F Marbre chatbot at
https://chat.afmarbre.com/ - Adds Light / Dark / System theme controls to the support portal
- Shares the selected theme across
*.afmarbre.comwith the first-partyafmarbre_themecookie - Added support workflow sections and FAQ
- Added
/health - Keeps Turnstile, form validation, honeypot protection and Cloudflare Email Service
- Generates unique support references
- Keeps customer e-mail as
Reply-To
The Wrangler config contains:
"routes": [ { "pattern": "support.afmarbre.com", "custom_domain": true } ]
Cloudflare will create and manage the DNS entry and TLS certificate for the Custom Domain.
If support.afmarbre.com already has an existing CNAME record, remove that CNAME before adding/deploying the Worker Custom Domain. Do not point a separate CNAME at a workers.dev URL.
This support Worker does not use Cloudflare Email Service. It calls the existing API Worker through a Cloudflare Service Binding.
It sends the validated support ticket server-to-server to:
https://api.afmarbre.com/api/support
That endpoint lives in the existing A-F Marbre API Worker (mistral-agent-chat) and uses the Resend API key already configured there.
The destination is:
The Resend message uses the customer's submitted email as reply_to, so pressing Reply in Gmail addresses the customer directly.
afmarbre-support uses a Cloudflare Service Binding named AFMARBRE_API pointing to the Worker mistral-agent-chat. That avoids a public DNS hop and CORS, while still authenticating with a shared secret.
Set the same SUPPORT_API_TOKEN on both Workers:
# Paul / API Worker (mistral-agent-chat) npx wrangler secret put SUPPORT_API_TOKEN # Support portal Worker (this project) npx wrangler secret put SUPPORT_API_TOKEN
The support Worker sends Authorization: Bearer <SUPPORT_API_TOKEN> on every ticket. The API Worker rejects requests without a matching token (protects the public https://api.afmarbre.com/api/support route as well).
Create a Turnstile widget and add:
support.afmarbre.com
as an allowed hostname.
Copy the public site key into wrangler.jsonc:
"TURNSTILE_SITE_KEY": "0x4AAAAAAELV-6t0f-Bafy_y"
Store the Turnstile secret as a Worker secret:
npx wrangler@latest secret put TURNSTILE_SECRET
Paste the secret when Wrangler asks for it.
Never put the secret directly in wrangler.jsonc.
From this project directory:
npm install npm run deploy
or without installing dependencies permanently:
npx wrangler@latest deploy
When the deployment finishes, open:
https://support.afmarbre.com/
Confirm that:
https://support.afmarbre.com/loads over HTTPS.- The A-F Marbre hero image loads.
- Turnstile completes successfully.
- A test submission redirects back to
/. - A reference similar to
AFM-20260809-AB12CD34appears. - Your configured support inbox receives the ticket.
- Pressing Reply addresses the customer's e-mail.
Health endpoint:
https://support.afmarbre.com/health
It should return:
{"ok":true,"service":"afmarbre-support"}Email delivery is handled by Resend in api.afmarbre.com; there is no send_email binding in this Worker.
afmarbre-support-worker/
├── src/
│ └── index.js
├── wrangler.jsonc
├── package.json
├── .gitignore
└── README.md
The support form does not accept file uploads. Customers who need to send photos/videos are directed to WhatsApp. This keeps the public form lightweight and reduces abuse risk.
The hero image is loaded from the existing A-F Marbre WordPress media library. If you later change the WordPress image URL, update BRAND_IMAGE near the top of src/index.js.
This build uses [email protected] as the public support inbox and the primary destination for support-form tickets.
The API sends each ticket to [email protected], privately BCCs [email protected], and keeps the visitor's submitted address as the message Reply-To.
Flow:
- Customer submits the support form.
- The main ticket arrives at
[email protected]. - A private BCC copy is also delivered to
[email protected]. - The customer never sees the Gmail copy address.
- Reply from the
[email protected]mailbox to keep all customer-facing mail on the A-F Marbre domain.
Only [email protected] is shown publicly on the support page.
Before production, verify [email protected] as a Cloudflare Email Service / Email Routing destination.
The support page loads a live note from:
GET https://support.afmarbre.com/status-summary
That Worker route fetches your public Better Stack status JSON:
https://status.afmarbre.com/index.json
- A public status page whose custom domain is
status.afmarbre.com(or the Better Stack subdomain). - At least one monitor published on that status page (API, website, support, chat, etc.).
- Confirm in a browser:
https://status.afmarbre.com/index.json
You should see JSON with data.attributes.aggregate_state (operational, degraded, downtime, or maintenance).
- Optional Worker var override:
"STATUS_JSON_URL": "https://status.afmarbre.com/index.json"
No Better Stack API token is required for this public JSON endpoint.
The status strip stays hidden while everything is operational, and appears when the aggregate state is degraded, down, or under maintenance (or when an announcement is set).