WaitlistContactUsIQ is in early access and provided as is. Use at your own risk.Join the waitlist

Astro

A .astro page with the plain HTML form and a redirect to /thanks, or the hosted embed with is:inline. Zero client JavaScript apart from Turnstile.

Sample: samples/astro (src/pages/contact.astro, contact-embed.astro, thanks.astro, README). Any adapter; static output is fine.

The snippet

astro
---
const formId = import.meta.env.PUBLIC_CONTACTUSIQ_FORM_ID ?? 'au_xxxxxxx';
const turnstileSiteKey = import.meta.env.PUBLIC_TURNSTILE_SITE_KEY ?? '0x4AAAAAAA_PLACEHOLDER';
const thanksUrl = new URL('/thanks', Astro.site ?? 'https://example.com').href;
---
<form action={`https://api.contactusiq.com/s/${formId}`} method="POST">
  <input name="name" type="text" required />
  <input name="email" type="email" required />
  <textarea name="message" required></textarea>
  <input name="_honeypot" type="text" tabindex="-1" autocomplete="off" style="position:absolute;left:-10000px" />
  <input type="hidden" name="_redirect" value={thanksUrl} />
  <div class="cf-turnstile" data-sitekey={turnstileSiteKey}></div>
  <button type="submit">Send</button>
</form>
<script is:inline src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>

The hosted embed alternative:

astro
<div id="contactusiq-form"></div>
<script is:inline src={`https://api.contactusiq.com/f/${formId}/embed.js`} data-target="#contactusiq-form" async defer></script>

is:inline is required on both external scripts; without it Astro tries to bundle them.

Steps

  1. Copy the .astro files into src/pages/.
  2. Add PUBLIC_CONTACTUSIQ_FORM_ID=au_xxxxxxx and PUBLIC_TURNSTILE_SITE_KEY=0x4AAAAAAA_PLACEHOLDER to .env, or edit the defaults at the top of each file.
  3. Set site in astro.config.mjs (for example site: 'https://www.example.com') so _redirect becomes an absolute URL; otherwise hard-code it.
  4. Build and deploy on the verified domain. Visit /contact or /contact-embed.

How to test

/contact: a 303 redirect to /thanks. /contact-embed: the form renders in the div and a submit returns 200 with {"ok":true,"id":"..."}.

Troubleshooting

SymptomCause and fix
Redirect goes to the wrong host_redirect must be absolute. Check site in astro.config.mjs.
Redirected but nothing in the inboxOrigin mismatch: astro dev on localhost is not a verified domain. Test on the deployed site.
Embed script 404 or missingThe script tag lacks is:inline, or the form id is wrong or unpublished.