How-to · 4 min read

OTP delivery: webhooks vs polling

Polling is easy to start with; webhooks are how you scale. How to choose, and how to set up a webhook for incoming codes.

Both get you the code; they trade simplicity for latency and load.

Polling

while True:
    o = client.orders.sms(order.order_id)
    if o.sms: break
    time.sleep(1.5)

Fine for scripts and tests. At volume it adds latency (you wait for the next poll) and request overhead.

Webhooks

Register a URL and the server POSTs the code the moment it lands. Verify the HMAC-SHA256 signature header, return 2xx fast, and process async.

POST /your/webhook
X-Webhook-Schema-Version: 1
{ "order_id":"ord_91f3", "event":"sms.received", "otp":"123456" }

Use polling to prototype, webhooks in production — lower latency, fewer requests, and you never miss a code to a poll-interval gap.


Ready to build? Create a free Eveses account, top up a wallet, and grab your API key — no KYC. See the API docs or live pricing.

FAQ

▸Should I poll or use webhooks for OTPs?
Poll to prototype; use webhooks in production for lower latency and less load. Webhooks push the code the moment it arrives.
▸How do I verify a webhook?
Check the HMAC-SHA256 signature header against your signing secret, then return 2xx quickly and process asynchronously.
Related guides