Using Web2Phone with GitHub Pages

Add a working contact form to any GitHub Pages website using a single Web2Phone embed snippet — no backend, servers, or API knowledge needed.

1. Prerequisites

  • A GitHub account
  • A GitHub Pages site (user site or project site)
  • A Web2Phone account with a form created

2. Find Your GitHub Pages URL

GitHub Pages URLs look like:

https://yourusername.github.io
https://yourusername.github.io/your-project-name/

These URLs reduce to a single hostname for Web2Phone configuration.

3. Add Your Hostname to Allowed Domains

Web2Phone only accepts submissions from hostnames you authorise. For GitHub Pages, enter only the hostnameno https://, no www., and no slashes.

Your public GitHub Pages URL

https://yourusername.github.io

Allowed Domains value

yourusername.github.io
  1. Open your form inside Web2Phone.
  2. Find the field Allowed Domains.
  3. Add yourusername.github.io.
  4. Click Save.

This one hostname works for both user sites and project sites.

4. Copy Your Web2Phone Embed Snippet

Inside your form settings, click “Copy Embed Snippet”. It includes your public key, endpoint, and JavaScript handler.

5. Paste the Snippet into Your GitHub Pages Site

Open your index.html (or any HTML file), and paste the snippet where you want your form.

<form data-web2phone="form"
  data-public-key="YOUR_PUBLIC_KEY"
  data-endpoint="https://web2phone.co.uk/api/v1/submit/">

  <div><input name="name" placeholder="Your name" required></div>
  <div><input name="email" type="email" placeholder="you@example.com" required></div>
  <div><input name="phone" placeholder="+447700900123"></div>
  <div><textarea name="message" placeholder="Your message" required></textarea></div>

  <button type="submit">Send</button>
  <p data-w2p-output style="margin-top:8px;color:#333;"></p>

</form>

<script src="https://web2phone.co.uk/static/formsapp/js/embed.js"></script>

YOUR_PUBLIC_KEY will be automatically shown in your forms embed snippet.

6. Test Your Form

  1. Visit your GitHub Pages site.
  2. Submit the form.
  3. You should receive:
    • ✔ A WhatsApp message
    • ✔ A backup email

If it doesn’t work, re-check your Allowed Domains and public key.

Next Steps

Continue with Cloudflare Pages or Webflow setup guides.

Back to Getting Started Create Your Free Account