Before you start
- One-time codes are available to every workspace. You need a connected WhatsApp number and an approved authentication template.
- Go to One-time codes in the dashboard and choose the WhatsApp number the codes are sent from, then an approved authentication template (or create one there; it must be approved by WhatsApp first). Turn codes on.
- The template sets the message and the expiry. WhatsApp writes the text of an authentication message, and the minutes a code stays valid are the ones set on the template. A request can’t change either. If the template shows no expiry, Boom treats the code as valid for 10 minutes.
- Use an API key from your backend.
/api/v1/cdp base other pages use:
Send a code
reference (optional, up to 255 characters) is your label for what the code is
for, such as an appointment id. It is echoed back and can be used to verify.
Keep the otpId: it is the simplest way to verify.
Verify a code
otpId, phone or personExternalId
(the last two together with the same reference you sent with, if any). code
is the 6 to 10 digits the person entered.
A wrong code is not an HTTP error: you get 200 with valid: false.
attemptsRemaining counts the wrong guesses left before the code locks. The
limit is set on the dashboard (5 by default).
Boom also stops guessing across codes: after 20 wrong codes for the same phone
within 24 hours, further attempts are refused (valid: false, the code stays
PENDING, attemptsRemaining doesn’t move) until older failures age out.
404 otp_not_found means no code matches. 422 otp_unverifiable means Boom
can no longer check that code; send a new one.
Resending
Calling send again for the same person while their code is still valid sends the same code again and returns the sameotpId with resent: true. The
expiry does not move. Once the code has expired, the next send creates a new one.
Two limits apply, both set on the dashboard (defaults shown):
- Cooldown (30 seconds): a send to a phone too soon after the last send to it is refused.
- Hourly cap (5 sends per phone per hour).
reference on it. If the code
is about to expire when you call send, Boom issues a new code with a new
otpId (resent: false) instead of resending one the person can barely use.
Both answer 429, and the error body tells you how long to wait:
code is resend_cooldown or too_many_sends. Read retryAfterSeconds from the
body: these 429s don’t set a Retry-After header. Two requests for the same
phone at the same moment are treated as one, and the second gets
resend_cooldown.
People who share a phone
A family, a clinic front desk or a shared work phone can mean several people on one number. By default a phone has one live code. To give each person their own, passpersonExternalId or reference on both send and verify:
reference (or person) never verifies another’s. A verify by
bare phone only matches codes that were sent without either. The cooldown and
the hourly cap count per phone, not per person: one patient’s send also
starts the cooldown for the others on that number.
Errors
Errors use the standard shape.Boom does not apply a limit across your whole organization: only the
per-phone cooldown, hourly cap and wrong-guess limits above. Protecting your
endpoint from abuse (for example someone requesting codes for numbers that
aren’t theirs) is up to your app.
Billing and the inbox
Each code that WhatsApp delivers is billed as an authentication template message, and so is each delivered resend. The Send a test code button on the dashboard sends and bills a real code too. Codes appear in the person’s conversation like any outbound message, but the code itself is shown as dots (••••••) in the inbox and in the stored message. Boom keeps the code encrypted only while it can
still be resent and clears it once the code is verified, expired or locked. Code
records, with the phone number they were sent to, are deleted after 90 days.
Sending a code doesn’t reopen a closed conversation or assign it to anyone.
Related
- Authentication: API keys and environments
- Message logs: delivery status for each code sent
- Rate limits & errors