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.
Prerequisites
- A GitHub account
- A GitHub Pages site (user site or project site)
- A Web2Phone account with a form created
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
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://orhttps:// - No paths, query strings, or trailing slashes
- No wildcards
-
Adding
yourusername.github.ioalso allowswww.yourusername.github.ioautomatically
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.
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.
Test your form
- Visit your GitHub Pages site.
- Submit the form.
-
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.