Verify phone numbers with WhatsApp OTP
A sign-up, or a sign-in without a password, needs proof that a person holds a phone number. Threadwire does it over WhatsApp, from your own number, with one API call. The short video above shows it on a made-up shop's sign-in page: the person sends a code, your number replies, and the site gets the verified number.
The link: the person sends the code
This is the way we recommend.
- Your system asks for an OTP with one API request. It gets back a link, a QR code and a code.
- Your site shows it. On a phone, the link is a button. On a computer, the QR code is there to scan. WhatsApp opens with the message already typed, so they only press Send. The code is shown too, for anyone who would rather type it.
- You get the number. When the message reaches your number in time, the OTP is verified. A webhook brings the phone that sent it, and that is what you sign them in with.
Your number then answers with a short confirmation, in English or Arabic.
Why the link is better
- It is the safest message there is. Your number only replies, so there is no daily limit on new people, no night hours and no waiting.
- The message itself proves the number. WhatsApp says who sent it, so there is no code to copy back into your app.
- There is no fee per code. A plan is priced by how many numbers you link.
Give the phone in the request when you know it. The code is then accepted only from that phone, so a forwarded link signs nobody else in. Give your app's name too: it is in the message they send, so a forwarded link says what it signs in to.
Rarely, WhatsApp hides the sender's number. The OTP still completes, but without a phone: never sign anyone in by it.
The code: your number sends it
Your number can also send a code, the way an SMS code works, and your system checks what the person types. The fifth wrong code fails it.
Know its limit first. To someone who never wrote to your number, that code is a first message. With protection on, it counts against the day's new people, and it is not sent at night. A late code is useless, so it never waits: if it cannot go within about two minutes, the OTP fails at once and says why. People who get a code and never write back also count against your number's reply score. That is why the link is better: it always works.
Built to be safe
Codes are random, and only a keyed hash of each one is stored. A code expires after a time you choose, and limits per phone stop anyone from flooding a number with codes.
Every OTP in your panel
OTP, in your panel's menu for admins, lists every OTP your system started, and whether it was verified. Filter them by status, way and number, and cancel one that is still pending. Try it makes a link you complete from your own phone. The code is never kept, so it is never shown.
WhatsApp OTP sums it up on one page, and how we keep numbers safe explains the protection. The WhatsApp OTP guide has the requests, the answers and every limit.