Docs • Integration

Using Web2Phone with Django Templates

Use Web2Phone inside plain Django templates with the standard embed snippet — no Django views, no models, no backend form handling.

If you haven’t created a form yet, start with the Getting Started guide.

How delivery works

Web2Phone delivers to WhatsApp if enabled and delivery succeeds. If WhatsApp is disabled (or delivery fails), it falls back to email. Failed deliveries appear in your dashboard as queued or failed. Successful submissions are not shown.

Step 1

Create a Web2Phone Form

  1. Create a form in the Web2Phone dashboard.
  2. Under Allowed Domains, add your site’s hostname (for example example.com, www.example.com, localhost).
  3. Save the form and copy the embed snippet.
⚠️

Allowed Domains rules

Web2Phone checks the hostname the form is submitted from. Protocols, paths, and query strings are ignored.

  • ✅ Enter the hostname only (e.g. example.com)
  • example.com and www.example.com are treated as equivalent
  • ❌ No http:// or https://
  • ❌ No paths (like /contact)
  • ❌ No wildcards (like *.example.com)
Step 2

Paste the Snippet into a Template

Open the template where you want the form (for example contact.html) and paste the snippet exactly as provided.

<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>
  <textarea name="message" placeholder="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>

Always copy the snippet from your dashboard so the public key is correct.

Do not add Django CSRF to this form

This form posts directly to Web2Phone, not your Django backend. You do not need {{ csrf_token }}.

Step 3

Test and Verify Delivery

  1. Load your page in a browser.
  2. Submit a test message.
  3. Expect WhatsApp or email delivery based on your form settings.
🧯

If it doesn’t work

  • Confirm the hostname in Allowed Domains matches your site (www is optional).
  • Check you used the snippet from the correct form.
  • Look in the dashboard for queued or failed submissions.