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 hostname —
no https://, no www., and no slashes.
Your public GitHub Pages URL
https://yourusername.github.io
Allowed Domains value
yourusername.github.io
- Open your form inside Web2Phone.
- Find the field Allowed Domains.
- Add
yourusername.github.io. - 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
- Visit your GitHub Pages site.
- Submit the form.
- 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