Send OTP Codes and Notifications via WhatsApp API · Lime API
How to send verification codes, alerts and order notifications over WhatsApp with Lime API: OTP mode, code examples and how it compares to SMS.
Verification codes, order confirmations, delivery updates and system alerts have one thing in common: the user is waiting for them. WhatsApp is where many of your users already look first, and a message there arrives with your name and profile picture instead of a random short code.
This guide shows how to send these messages with Lime API, and how OTP mode turns a number into a clean, send-only channel.
What to send over WhatsApp
- One-time passwords for sign-up, login and password reset
- Order notifications: confirmed, shipped, out for delivery
- Appointment reminders for clinics, salons and studios
- System alerts to your own team: a failed payment, a server down, a new high-value lead
All of these are messages the recipient expects. That is the best possible kind of traffic for a WhatsApp number.
Send a code with sendMessage
Every Lime instance has its own URL and token. Sending a code is one call to sendMessage:
curl -X POST "https://api.lime-api.com/waInstance{idInstance}/sendMessage/{apiTokenInstance}" \
-H "Content-Type: application/json" \
-d '{"chatId":"15551234567@c.us","message":"Your verification code is 482913. It expires in 10 minutes."}'
# -> { "idMessage": "3EB0C767D26A1D8A4E1F" }
chatId is the phone number in international format, without + or leading zeros, followed by @c.us. The response gives you an idMessage you can store and match against delivery status events in your webhook.
The same call from Node.js:
const base = 'https://api.lime-api.com/waInstance' + process.env.LIME_INSTANCE
async function sendOtp(phone, code) {
const res = await fetch(base + '/sendMessage/' + process.env.LIME_TOKEN, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
chatId: phone + '@c.us',
message: 'Your verification code is ' + code + '. It expires in 10 minutes.',
linkPreview: false,
}),
})
if (!res.ok) throw new Error('WhatsApp send failed: ' + res.status)
return (await res.json()).idMessage
}
And from Python:
import os, requests
def send_otp(phone: str, code: str) -> str:
url = f"https://api.lime-api.com/waInstance{os.environ['LIME_INSTANCE']}/sendMessage/{os.environ['LIME_TOKEN']}"
r = requests.post(url, json={
"chatId": f"{phone}@c.us",
"message": f"Your verification code is {code}. It expires in 10 minutes.",
}, timeout=15)
r.raise_for_status()
return r.json()["idMessage"]
Lime is Green API compatible, so if you already use a Green API SDK, point it at Lime's base URL and it keeps working. The quickstart covers creating the instance and connecting the number in about two minutes.
Turn on OTP mode
A number that sends codes has a problem: people reply to it. "Thanks", "Didn't get it", "Who is this?". Nobody reads those messages, and leaving them unanswered is a poor experience.
OTP mode (in the instance's Webhooks & Settings tab) is built for a send-only number:
- Automatic replies. Anyone who writes to the number gets a reply that the number is not monitored. Write one reply per line and a random one is picked each time. Spintax like
{Hi|Hello} works too. - Cooldown. The same person gets at most one automatic reply per period (in hours, 24 by default), even if they send many messages. This also prevents reply loops with other bots.
- Private chats only. It never replies in groups.
- Calls rejected. Incoming calls are rejected automatically.
- Automations off. The instance's automations do not run in this mode.
- Webhooks still sent. Your server still receives incoming messages and status events, so you can log them or escalate.
A reply might read: {Hi|Hello}, this number only sends verification codes and does not answer messages. For support, contact us through our website.
You can also set it through the API with setSettings, using otpMode, otpReplies and otpReplyCooldownHours.
Keep codes fast and safe
- Use the Fast preset only for a reply-style flow. OTP traffic goes to people who just asked for a code, so short delays are reasonable. For bulk notifications to many people at once, use Balanced and sending protection, see how to avoid a WhatsApp ban.
- Make sure sending hours apply to broadcasts only, not to all messages, so a code at night is not held until the morning.
- Do not put links in codes unless you need them. Set
linkPreview to false if you do. - Have a fallback. WhatsApp may block numbers that send spam, and some users do not have WhatsApp. Keep an email or SMS fallback for critical login flows. You can check a number first with the
checkWhatsapp method in the docs. - Keep the phone and profile in order. A complete profile with your brand name and logo helps users trust the message.
How it compares to SMS
SMS is typically billed per message, and the cost scales with every code you send. With Lime, you pay a flat price per WhatsApp number: Pro is $9.90 per month or $99 per year, with no per-message fees and no setup fees. Sending ten codes or ten thousand costs the same, within WhatsApp's anti-spam rules. See pricing and the 2026 WhatsApp API pricing comparison.
There are trade-offs. Lime connects a regular WhatsApp number (QR or pairing code), not the official Meta Business API, so you get speed and a flat price instead of Meta's templates and per-conversation pricing. Lime is not affiliated with WhatsApp or Meta. If you need to choose, read unofficial vs official WhatsApp API.
Start sending
- Create a free account. The Developer plan lets you test with up to 3 destination numbers.
- Connect a dedicated number for codes and turn on OTP mode.
- Call
sendMessage from your backend. Everything else is in the docs.