Docs • Static Sites

Using Web2Phone with GitHub Pages

Add a working contact form to any GitHub Pages site using a single Web2Phone embed snippet — no backend, servers, or build tools required.

Web2Phone handles validation, delivery to WhatsApp (if enabled), and email fallback automatically.

Step 1

Prerequisites

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

Find your GitHub Pages hostname

GitHub Pages URLs usually look like this:

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

For Web2Phone, you only use the hostname. In both cases, that hostname is: yourusername.github.io

Step 3

Add your hostname to Allowed Domains

Web2Phone only accepts submissions from domains you explicitly allow. For GitHub Pages, enter the hostname only.

Your site URL

https://yourusername.github.io

Allowed Domains value

yourusername.github.io
⚠️

Allowed Domains rules

  • Use the hostname only (example: yourusername.github.io)
  • No http:// or https://
  • No paths, query strings, or trailing slashes
  • No wildcards
  • Adding yourusername.github.io also allows www.yourusername.github.io automatically
Step 4

Copy your Web2Phone embed snippet

Open your form in the Web2Phone dashboard and click Copy Embed Snippet. It already contains your public key and the correct endpoint.

Step 5

Paste the snippet into your site

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

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

  <input name="name" placeholder="Your name" required>
  <input name="email" type="email" placeholder="[email protected]" required>
  <input name="phone" placeholder="+447700900123">
  <textarea name="message" placeholder="Your message" required></textarea>

  <button type="submit">Send</button>
  <p data-w2p-output></p>
</form>

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

Replace YOUR_PUBLIC_KEY only if you are not using the snippet copied directly from your dashboard.

Step 6

Test your form

  1. Visit your GitHub Pages site.
  2. Submit the form.
  3. You should receive:
    • ✔ WhatsApp message (if enabled)
    • ✔ Email notification (fallback)

If nothing arrives, double-check the Allowed Domains value and ensure you used the correct embed snippet.

Next steps

Web2Phone also works with Cloudflare Pages, Webflow, WordPress, and more.